From: <be...@us...> - 2012-08-01 18:53:27
|
Revision: 10797 http://octave.svn.sourceforge.net/octave/?rev=10797&view=rev Author: benjf5 Date: 2012-08-01 18:53:17 +0000 (Wed, 01 Aug 2012) Log Message: ----------- Fixing a few errors for packaging. Modified Paths: -------------- trunk/octave-forge/extra/lssa/INDEX trunk/octave-forge/extra/lssa/inst/cubicwgt.m trunk/octave-forge/extra/lssa/inst/lombcoeff.m trunk/octave-forge/extra/lssa/inst/lombnormcoeff.m trunk/octave-forge/extra/lssa/inst/lscomplexwavelet.m trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m trunk/octave-forge/extra/lssa/inst/lsrealwavelet.m trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m trunk/octave-forge/extra/lssa/src/fastlscomplex.cc trunk/octave-forge/extra/lssa/src/fastlsreal.cc Modified: trunk/octave-forge/extra/lssa/INDEX =================================================================== --- trunk/octave-forge/extra/lssa/INDEX 2012-08-01 15:45:50 UTC (rev 10796) +++ trunk/octave-forge/extra/lssa/INDEX 2012-08-01 18:53:17 UTC (rev 10797) @@ -1,7 +1,7 @@ cubicwgt fastlscomplex lombcoeff -lomgnormcoeff +lombnormcoeff lscomplex lscomplexwavelet lscorrcoeff Modified: trunk/octave-forge/extra/lssa/inst/cubicwgt.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/cubicwgt.m 2012-08-01 15:45:50 UTC (rev 10796) +++ trunk/octave-forge/extra/lssa/inst/cubicwgt.m 2012-08-01 18:53:17 UTC (rev 10797) @@ -2,7 +2,7 @@ ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software -## Foundation; either version 3 of the License, or (at your option) any later +## Foundation; either version 2 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT Modified: trunk/octave-forge/extra/lssa/inst/lombcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lombcoeff.m 2012-08-01 15:45:50 UTC (rev 10796) +++ trunk/octave-forge/extra/lssa/inst/lombcoeff.m 2012-08-01 18:53:17 UTC (rev 10797) @@ -36,5 +36,5 @@ function coeff = lombcoeff(T, X, o) theta = atan2(sum(sin(2 .* o .* T )), sum(cos(2.*o.*T)))/ (2 * o ); coeff = ( sum(X .* cos(o .* T - theta))**2)/(sum(cos(o.*T-theta).**2)) + ( sum(X .* sin(o .* T - theta))**2)/(sum(sin(o.*T-theta).**2)); -end function +endfunction Modified: trunk/octave-forge/extra/lssa/inst/lombnormcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lombnormcoeff.m 2012-08-01 15:45:50 UTC (rev 10796) +++ trunk/octave-forge/extra/lssa/inst/lombnormcoeff.m 2012-08-01 18:53:17 UTC (rev 10797) @@ -27,4 +27,4 @@ coeff = ( ( sum ( X .* cos( omega .* T - tau ) ) .^ 2 ./ sum ( cos ( omega .* T - tau ) .^ 2 ) + sum ( X .* sin ( omega .* T - tau ) ) .^ 2 / sum ( sin ( omega .* T - tau ) .^ 2 ) ) / ( 2 * var(X) ) ); -end \ No newline at end of file +endfunction Modified: trunk/octave-forge/extra/lssa/inst/lscomplexwavelet.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lscomplexwavelet.m 2012-08-01 15:45:50 UTC (rev 10796) +++ trunk/octave-forge/extra/lssa/inst/lscomplexwavelet.m 2012-08-01 18:53:17 UTC (rev 10797) @@ -1,7 +1,5 @@ ## Copyright (C) 2012 Ben Lewis <be...@gm...> ## -## This code is part of GNU Octave. -## ## This software is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 2 of the License, or (at your option) any later Modified: trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m 2012-08-01 15:45:50 UTC (rev 10796) +++ trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m 2012-08-01 18:53:17 UTC (rev 10797) @@ -2,7 +2,7 @@ ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software -## Foundation; either version 3 of the License, or (at your option) any later +## Foundation; either version 2 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT @@ -24,6 +24,8 @@ ## default is cubicwgt if left blank, and its radius is 1, ## as defined as the default for @var{winradius}. ## +## @seealso lswaveletcoeff lscomplexwavelet lsrealwavelet +## ## @end deftypefn ## Demo with sin, cos as Nir suggested. Modified: trunk/octave-forge/extra/lssa/inst/lsrealwavelet.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lsrealwavelet.m 2012-08-01 15:45:50 UTC (rev 10796) +++ trunk/octave-forge/extra/lssa/inst/lsrealwavelet.m 2012-08-01 18:53:17 UTC (rev 10797) @@ -1,9 +1,30 @@ -# Copyright (C) 2012 Benjamin Lewis <be...@gm...> +## Copyright (C) 2012 Benjamin Lewis <be...@gm...> +## +## This program is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free Software +## Foundation; either version 2 of the License, or (at your option) any later +## version. +## +## This program is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +## details. +## +## You should have received a copy of the GNU General Public License along with +## this program; if not, see <http://www.gnu.org/licenses/>. ##-*- texinfo -*- -## @deffun {Function File} {t =} +## @deffun {Function File} {t =} lsrealwavelet( @var{time}, @var{mag}, +## @var{maxfreq}, @var{coefficients}, @var{octaves}, @var{time_min}, +## @var{time_max}, @var{min_window_count} ) ## +## Computes a windowed transform of the supplied (@var{time}, @var{mag}) series +## of real-valued magnitudes, applying progressively wider windows as the +## frequencies tested decline from the maximum frequency. +## +## Currently non-functional. ## +## @seealso lscomplexwavelet lswaveletcoeff lscorrcoeff ## ## @end deffun @@ -65,6 +86,4 @@ o *= omegamult; endfor - - endfunction Modified: trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m 2012-08-01 15:45:50 UTC (rev 10796) +++ trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m 2012-08-01 18:53:17 UTC (rev 10797) @@ -25,6 +25,8 @@ ## while @var{winradius} is the windowing radius, and defaults ## to 1 (the radius of cubicwgt.) ## +## @seealso lscorrcoeff lscomplexwavelet lsrealwavelet +## ## @end deftypefn %!demo Modified: trunk/octave-forge/extra/lssa/src/fastlscomplex.cc =================================================================== --- trunk/octave-forge/extra/lssa/src/fastlscomplex.cc 2012-08-01 15:45:50 UTC (rev 10796) +++ trunk/octave-forge/extra/lssa/src/fastlscomplex.cc 2012-08-01 18:53:17 UTC (rev 10797) @@ -1,5 +1,18 @@ /* Copyright (C) 2012 Benjamin Lewis <be...@gm...> - * GNU GPLv2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ Modified: trunk/octave-forge/extra/lssa/src/fastlsreal.cc =================================================================== --- trunk/octave-forge/extra/lssa/src/fastlsreal.cc 2012-08-01 15:45:50 UTC (rev 10796) +++ trunk/octave-forge/extra/lssa/src/fastlsreal.cc 2012-08-01 18:53:17 UTC (rev 10797) @@ -1,5 +1,18 @@ /* Copyright (C) 2012 Benjamin Lewis <be...@gm...> - * Licensed under the GNU GPLv2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ @@ -285,13 +298,13 @@ // In this case, there is no next record, but this record has data. if ( record_current->stored_data ) { int p = 0; - for( exp_pse_ptr = exp_power_series_elements + 1 , temp_ptr_alpha = temp_alpha ; p < 12 ; p++ , exp_pse_ptr++ ) { + for( exp_pse_ptr = exp_power_series_elements , temp_ptr_alpha = temp_alpha ; ; ) { tpra = temp_ptr_alpha; temp_ptr_alpha->x = record_current->power_series[p]->x; (temp_ptr_alpha++)->t = record_current->power_series[p]->t; temp_ptr_beta->x = -record_current->power_series[p]->x; (temp_ptr_beta++)->t = -record_current->power_series[p]->t; - for( exp_ptr = exp_power_series_elements, record_current->power_series[p] = *temp_ptr_alpha * *exp_ptr; ; ) { + for( exp_ptr = exp_pse_ptr++, record_current->power_series[p]->x = tpra->x * *exp_ptr, record_current->power_series[p]->t = tpra->t * *exp_ptr ; ; ) { /* This next block is from Mathias' code, and it does a few * ... unsavoury things. First off, it uses conditionals with * break in order to avoid potentially accessing null regions @@ -299,87 +312,82 @@ * numbers. However, remembering that most of these will not * actually be accessed for the first iterations, it's easier. */ - if ( ++exp_ptr >= exp_pse_ptr ) break; - --tpra; - h = *tpra * *exp_ptr; - record_current->power_series[p].real() -= h.imag(); - record_current->power_series[p].imag() += h.real(); - if ( ++exp_ptr >= exp_pse_ptr ) break; - --tpra; - record_current->power_series[p] -= *tpra * *exp_ptr; - if ( ++exp_ptr >= exp_pse_ptr ) break; - --tpra; - h = -*tpra * *exp_ptr; - record_current->power_series[p].real() -= h.imag(); - record_current->power_series[p].imag() += h.real(); - if ( ++exp_ptr >= exp_pse_ptr ) break; - --tpra; - record_current->power_series[p] += *tpra * *exp_ptr; + if ( --exp_ptr < exp_power_series_elements ) break; + ++tpra; + record_current->power_series[p]->x -= tpra->x * *exp_ptr; + record_current->power_series[p]->t -= tpra->t * *exp_ptr; + if ( --exp_ptr < exp_power_series_elements ) break; + ++tpra; + record_current->power_series[p]->x += tpra->x * *exp_ptr; + record_current->power_series[p]->t += tpra->x * *exp_ptr; } + if ( ++p >= 12 ) break; + temp_ptr_alpha->x = -record_current->power_series[p]->x; + (temp_ptr_alpha++)->t = -record_current->power_series[p]->t; + temp_ptr_beta->x = record_current->power_series[p]->x; + (temp_ptr_beta++)->t = record_current->power_series[p]->t; + for( tprb = temp_beta, exp_ptr = exp_pse_ptr++, record_current->power_series[p]->t = tprb->t * *exp_ptr; exp_ptr > exp_power_series_elements ; ) { + ++tprb; + --exp_ptr; + record_current->power_series[p]->t += tprb->t * *exp_ptr; + } + if ( ++p >= 12 ) break; } - if ( ! record_ref ) break; // Last record was reached } - else { - record_next = record_ref; - if ( record_current->stored_data ) { - int p = 0, q = 0; - for( exp_pse_ptr = exp_power_series_elements + 1, temp_ptr_alpha = temp_alpha, temp_ptr_beta = temp_beta; p < 12 ; p++, q++, exp_pse_ptr++ ) { - tpra = temp_ptr_alpha; - *temp_ptr_alpha++ = record_current->power_series[p] + record_next->power_series[q]; - *temp_ptr_beta++ = record_current->power_series[p] - record_next->power_series[1]; - tprb = temp_ptr_beta; - for( exp_ptr = exp_power_series_elements, record_current->power_series[p] = *tpra * *exp_ptr; ; ) { - if ( ++exp_ptr >= exp_pse_ptr ) break; - tprb -= 2; - h = *tprb * *exp_ptr; - record_current->power_series[p].real() -= h.imag(); - record_current->power_series[p].imag() += h.real(); - if ( ++exp_ptr >= exp_pse_ptr ) break; - tpra -= 2; - record_current->power_series[p] -= *tpra * *exp_ptr; - if ( ++exp_ptr >= exp_pse_ptr ) break; - tprb -= 2; - h = - *tprb * *exp_ptr; - record_current->power_series[p].real() -= h.imag(); - record_current->power_series[p].imag() += h.real(); - if ( ++exp_ptr >= exp_pse_ptr ) break; - tpra -= 2; - record_current->power_series[p] += *tpra * *exp_ptr; - } + if ( ! record_ref ) break; // Last record was reached + } + else { + record_next = record_ref; + if ( record_current->stored_data ) { + int p = 0; + for( exp_pse_ptr = exp_power_series_elements, temp_ptr_alpha = temp_alpha, temp_ptr_beta = temp_beta; ; ) { + temp_ptr_alpha->x = record_current->power_series[p]->x + record_next->power_series[p]->x; + (temp_ptr_alpha++)->t = record_current->power_series[p]->t + record_next->power_series[p]->t; + temp_ptr_beta->x = record_ref->power_series[p]->x - record_current->power_series[p]->x; + (temp_ptr_beta++)->t = record_ref->power_series[p]->t - record_current->power_series[p]->t; + for( tpra = temp_alpha, exp_ptr = exp_pse_ptr++, record_current->power_series[p]->x = tpra->x * *exp_ptr, record_current->power_series[p]->t = tpra->x * *exp_ptr; ; ) { + if ( --exp_ptr < exp_pse_ptr ) break; + ++tpra; + record_current->power_series[p]->x -= tpra->x * *exp_ptr; + record_current->power_series[p]->t -= tpra->t * *exp_ptr; + if ( --exp_ptr < exp_pse_ptr ) break; + ++tpra; + record_current->power_series[p]->x += tpra->x * *exp_ptr; + record_current->power_series[p]->t += tpra->t * *exp_ptr; } - } else { - int q = 0; - for( exp_pse_ptr = exp_power_series_elements + 1, temp_ptr_alpha = temp_alpha, temp_ptr_beta = temp_beta; q < 12; q++, exp_pse_ptr++ ) { - tpra = temp_ptr_alpha; - *temp_ptr_alpha++ = std::complex<double>(record_next->power_series[q]); - for ( exp_ptr = exp_power_series_elements, record_next->power_series[q] = *tpra * *exp_ptr; ; ) { - if ( ++exp_ptr >= exp_pse_ptr ) break; - --tpra; - h = *tpra * *exp_ptr; - record_next->power_series[q].real() -= h.imag(); - record_next->power_series[q].imag() += h.real(); - if ( ++exp_ptr >= exp_pse_ptr ) break; - --tpra; - record_next->power_series[q] -= *tpra * *exp_ptr; - if ( ++exp_ptr >= exp_pse_ptr ) break; - --tpra; - h = -*tpra * *exp_ptr; - record_next->power_series[q].real() -= h.imag(); - record_next->power_series[q].imag() += h.real(); - if ( ++exp_ptr >= exp_pse_ptr ) break; - --tpra; - record_next->power_series[q] += *tpra * *exp_ptr; - } + if ( ++p >= 12 ) break; + temp_ptr_alpha->x = record_next->power_series[p]->x - record_current->power_series[p]->x; + (temp_ptr_alpha++)->t = record_next->power_series[p]->t - record_current->power_series[p]->t; + temp_ptr_beta->x = record_current->power_series[p]->x + record_next->power_series[p]->x; + (temp_ptr_beta++)->t = record_current->power_series[p]->t + record_next->power_series[p]->t; + for(tprb = temp_beta, exp_ptr = exp_pse_ptr++, record_current->power_series[p]->x = tprb->x * *exp_ptr, record_current->power_series[p]->t = tprb->x * *exp_ptr; exp_ptr > exp_power_series_elements; ) { + ++tprb; + --exp_ptr; + record_current->power_series[p]->x += tprb->x * *exp_ptr; + record_current->power_series[p]->t += tprb->t * *exp_ptr; } + if ( ++p >= 12 ) break; } - record_current->stored_data = true; - record_ref = record_next; - record_current->next = record_ref->next; - delete record_ref; - } + } else { + int q = 0; + for( exp_pse_ptr = exp_power_series_elements, temp_ptr_alpha = temp_alpha, temp_ptr_beta = temp_beta; ; ) { + temp_ptr_alpha->x = record_next->power_series[q]->x; + temp_ptr_alpha->t = record_next->power_series[q]->t; + for(tpra = temp_alpha, exp_ptr = exp_pse_ptr++, record_next->power_series[q]->x = tpra->x * *exp_ptr, record_next->power_series[q]->t = tpra->t * *exp_ptr; exp_ptr > exp_power_series_elements; ) { + ++tpra; + --exp_ptr; + record_next->power_series[q]->x += tpra->x * *exp_ptr; + record_next->power_series[q]->t += tpra->t * *exp_ptr; + } + if ( ++q >= 12 ) break; + } + record_current->stored_data = true; + record_ref = record_next; + record_current->next = record_ref->next; + record_next = 0; + delete record_ref; } } - - + } return results; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |