From: <be...@us...> - 2012-05-22 02:02:39
|
Revision: 10485 http://octave.svn.sourceforge.net/octave/?rev=10485&view=rev Author: benjf5 Date: 2012-05-22 02:02:32 +0000 (Tue, 22 May 2012) Log Message: ----------- Added cubicwgt and the wavelet coefficient functions. Added Paths: ----------- trunk/octave-forge/extra/lssa/cubicwgt.m trunk/octave-forge/extra/lssa/nucorrcoeff.m trunk/octave-forge/extra/lssa/nuwaveletcoeff.m Added: trunk/octave-forge/extra/lssa/cubicwgt.m =================================================================== --- trunk/octave-forge/extra/lssa/cubicwgt.m (rev 0) +++ trunk/octave-forge/extra/lssa/cubicwgt.m 2012-05-22 02:02:32 UTC (rev 10485) @@ -0,0 +1,22 @@ +## 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 3 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/>. + +## This function implements the windowing function on page 10 of the doc. +## if t is in [-1,1] then the windowed term is a = 1 + ( |t|^2 * ( 2|t| - 3 ) +## else the windowed term is 0. +function a = cubicwgt(t) ## where t is the set of time values + a = abs(t); + a = ifelse( ( a < 1 ), 1 + ( ( a .^ 2 ) .* ( 2 .* a - 3 ) ), a = 0); +endfunction Added: trunk/octave-forge/extra/lssa/nucorrcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/nucorrcoeff.m (rev 0) +++ trunk/octave-forge/extra/lssa/nucorrcoeff.m 2012-05-22 02:02:32 UTC (rev 10485) @@ -0,0 +1,38 @@ +## 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 3 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/>. + +## nucorrcoeff, computes a coefficient of the wavelet correlation of two time series + +function coeff = nucorrcoeff(X1, Y1, X2, Y2, t, o, wgt = cubicwgt, wgtrad = 1) + so = 0.05 * o; + ## The first solution that comes to mind is admittedly slightly ugly and has a data footprint of O(2n) + ## but it is vectorised. + mask = ( abs( X1 - t ) * so ) < wgtrad; + mask = mask .* [ 1 : length(mask) ]; + rx1 = X1(mask); ## I've kept the variable names from the R function here + ry1 = Y1(mask); ## Needs to have a noisy error if length(Y1) != length(X1) -- add this! + mask = ( abs( X2 - t ) * so ) < wgtrad; + mask = mask .* [ 1 : length(mask) ]; + rx2 = X2(mask); + ry2 = Y2(mask); + ## I've used the same mask for all of these as it's an otherwise unimportant variable ... can this leak memory? + length(rx1) ##printing this length is probably used as a warning if 0 is returned; I inculded it + ## in particular to maintain an exact duplicate of the R function. + s = sum( wgt( ( rx1 - t ) .* so ) ) * sum( wgt( ( rx2 - t ) .* so ); + coeff = ifelse( s != 0 , ( sum( wgt( ( rx1 - t ) .* so ) .* exp( i .* o .* rx1 ) .* ry1 ) + * sum( wgt( ( rx2 - t ) .* so ) .* exp( i .* o .* rx2 ) .* ry2 ) ) / s, 0 ); + + +endfunction \ No newline at end of file Added: trunk/octave-forge/extra/lssa/nuwaveletcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/nuwaveletcoeff.m (rev 0) +++ trunk/octave-forge/extra/lssa/nuwaveletcoeff.m 2012-05-22 02:02:32 UTC (rev 10485) @@ -0,0 +1,27 @@ +## 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/>. + +function coeff = nuwaveletcoeff( X , Y , t , o , wgt = cubicwgt , wgtrad = 1 ) + so = 0.05 .* o; + mask = abs( X - t ) * so < wgtrad; + mask = mask .* [ 1 : length(mask) ]; + rx = X(mask); + ## This was the fastest way to extract a matching subset that I could think of, but it has a complexity O(2n). + ry = Y(mask); + ## Going by the R code, this can use the same mask. + s = sum( wgt( ( X - t ) .* so ) ); + coeff = ifelse( s != 0 , sum( wgt( ( rx - t ) .* so) .* exp( i .* o .* ( rx - t ) ) .* ry ) ./ s , 0 ); + +endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <be...@us...> - 2012-05-22 22:34:17
|
Revision: 10499 http://octave.svn.sourceforge.net/octave/?rev=10499&view=rev Author: benjf5 Date: 2012-05-22 22:34:07 +0000 (Tue, 22 May 2012) Log Message: ----------- Documented and added demo code for cubicwgt, nucorrcoeff, nuwaveletcoeff. Modified Paths: -------------- trunk/octave-forge/extra/lssa/cubicwgt.m trunk/octave-forge/extra/lssa/nucorrcoeff.m trunk/octave-forge/extra/lssa/nuwaveletcoeff.m Added Paths: ----------- trunk/octave-forge/extra/lssa/data/ trunk/octave-forge/extra/lssa/data/ch4.csv trunk/octave-forge/extra/lssa/data/co2.csv trunk/octave-forge/extra/lssa/data/deut.csv trunk/octave-forge/extra/lssa/data/dust.csv trunk/octave-forge/extra/lssa/data/o18.csv Modified: trunk/octave-forge/extra/lssa/cubicwgt.m =================================================================== --- trunk/octave-forge/extra/lssa/cubicwgt.m 2012-05-22 20:15:30 UTC (rev 10498) +++ trunk/octave-forge/extra/lssa/cubicwgt.m 2012-05-22 22:34:07 UTC (rev 10499) @@ -13,10 +13,28 @@ ## 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-*- +## @deftypefn {Function File} {a =} cubicwgt {series} +## Return the series as windowed by a cubic polynomial, +## 1 + ( x ^ 2 * ( 2 x - 3 ) ), assuming x is in [-1,1]. +## @end deftypefn + +%!demo +%! h = 2; +%! hcw = cubicwgt(h) +%! m = 0.01; +%! mcw = cubicwgt(m) +%! k = [ 0 , 3 , 1.5, -1, -0.5, -0.25, 0.75 ]; +%! kcw = cubicwgt(k) +%! kt = k'; +%! ktcw = cubicwgt(kt); +%! ## Tests cubicwgt on two scalars and two vectors; cubicwgt will work on any array input. + + ## This function implements the windowing function on page 10 of the doc. ## if t is in [-1,1] then the windowed term is a = 1 + ( |t|^2 * ( 2|t| - 3 ) ## else the windowed term is 0. -function a = cubicwgt(t) ## where t is the set of time values - a = abs(t); +function a = cubicwgt(s) ## where s is the value to be windowed + a = abs(s); a = ifelse( ( a < 1 ), 1 + ( ( a .^ 2 ) .* ( 2 .* a - 3 ) ), a = 0); endfunction Added: trunk/octave-forge/extra/lssa/data/ch4.csv =================================================================== --- trunk/octave-forge/extra/lssa/data/ch4.csv (rev 0) +++ trunk/octave-forge/extra/lssa/data/ch4.csv 2012-05-22 22:34:07 UTC (rev 10499) @@ -0,0 +1,459 @@ +"","Depth.corrected","Ice.age..GT4.","Gas.age","CH4..ppbv." +"1",149.2,5683,2347,668 +"2",173.1,6828,3634,636 +"3",177.4,7043,3833,595 +"4",228.7,9528,6225,588 +"5",236.4,9901,6614,574 +"6",266,11334,8113,616 +"7",303.8,13526,10189,667 +"8",321.2,14538,11013,621 +"9",325,14775,11143,511 +"10",331.7,15215,11329,477 +"11",342.1,15922,11719,501 +"12",356,16974,12626,662 +"13",365.6,17755,13412,610 +"14",366.2,17803,13457,642 +"15",381.7,19089,14241,445 +"16",426.3,22829,16417,395 +"17",443.5,24315,17695,363 +"18",458.3,25557,18950,349 +"19",471,26595,20004,379 +"20",491.3,28356,21636,348 +"21",506.4,29630,22977,406 +"22",507.4,29716,23059,339 +"23",510.2,29967,23392,371 +"24",513.6,30250,23714,377 +"25",517.6,30591,24146,403 +"26",519.7,30761,24327,403 +"27",522.5,30998,24643,340 +"28",522.6,31011,24654,360 +"29",522.7,31020,24662,381 +"30",525.6,31266,24875,358 +"31",528.2,31487,25073,392 +"32",532.2,31828,25423,377 +"33",532.4,31845,25440,381 +"34",532.4,31845,25440,379 +"35",535,32058,25684,360 +"36",540,32465,25999,363 +"37",541.5,32583,26099,382 +"38",541.5,32583,26099,386 +"39",545.2,32887,26336,387 +"40",547,33042,26471,412 +"41",549.4,33240,26672,426 +"42",552,33461,26884,418 +"43",554.2,33646,27064,448 +"44",556.5,33833,27342,464 +"45",560.2,34136,27702,435 +"46",562.5,34318,27951,416 +"47",563.1,34371,28016,403 +"48",565.2,34530,28195,382 +"49",569.2,34832,28551,396 +"50",571.4,34985,28743,425 +"51",574.3,35210,28943,435 +"52",577.8,35464,29130,436 +"53",581.8,35766,29410,421 +"54",582.8,35839,29493,416 +"55",583.3,35876,29542,429 +"56",589.2,36346,30175,481 +"57",591.7,36558,30385,489 +"58",593.8,36729,30591,482 +"59",599.1,37157,31088,394 +"60",602.6,37444,31479,429 +"61",609.7,38013,32176,469 +"62",612,38203,32384,505 +"63",615.5,38491,32715,548 +"64",617.7,38678,32952,532 +"65",619.5,38826,33161,520 +"66",622.2,39039,33474,530 +"67",625.1,39268,33823,509 +"68",627.6,39464,34108,500 +"69",627.6,39464,34108,483 +"70",629.2,39593,34285,484 +"71",633.4,39917,34644,418 +"72",635.1,40060,34784,403 +"73",639.5,40424,35038,459 +"74",641.3,40573,35163,414 +"75",644.6,40841,35387,375 +"76",648,41112,35573,423 +"77",649.2,41209,35645,443 +"78",653.8,41551,35883,431 +"79",664.1,42305,36641,484 +"80",682,43702,38109,520 +"81",683,43785,38201,493 +"82",694.6,44764,39388,424 +"83",699.5,45181,39828,448 +"84",706.1,45770,40626,537 +"85",712.9,46360,41358,522 +"86",724.8,47360,42131,441 +"87",748.3,49296,43546,419 +"88",765.3,50634,44788,402 +"89",788.2,52446,47024,466 +"90",812,54457,49398,504 +"91",834.8,56300,51174,480 +"92",860.6,58258,52870,514 +"93",885.3,60288,55564,528 +"94",911.4,62633,57737,442 +"95",937.3,65016,59604,411 +"96",962.4,67405,61582,414 +"97",986.3,69627,63694,415 +"98",1011.3,71767,65701,434 +"99",1037.5,74017,68495,424 +"100",1062.2,76023,71014,458 +"101",1087.2,78042,72849,430 +"102",1112.6,80064,75367,462 +"103",1137.7,81921,76875,402 +"104",1162.1,83615,78995,438 +"105",1186.5,85262,81122,497 +"106",1209.7,86826,82843,545 +"107",1237.2,88808,84929,594 +"108",1261.2,90609,86323,529 +"109",1289.2,92632,88051,425 +"110",1309.2,94039,89363,417 +"111",1338.2,96047,91691,454 +"112",1363.7,97841,93660,443 +"113",1387.2,99498,95349,406 +"114",1413,101234,96900,407 +"115",1442.8,103125,99067,476 +"116",1451.4,103726,99833,480 +"117",1463.3,104574,100842,521 +"118",1476.1,105492,101829,493 +"119",1505,107599,103372,559 +"120",1526.2,109395,105204,591 +"121",1532,109872,105675,564 +"122",1542.1,110674,106203,437 +"123",1557.4,111923,107007,451 +"124",1582.8,113952,108994,468 +"125",1614.8,116215,111442,448 +"126",1627.7,117059,112559,443 +"127",1630.3,117221,112793,463 +"128",1637.7,117677,113479,505 +"129",1638.8,117747,113574,483 +"130",1643.4,118037,114031,497 +"131",1649,118376,114508,511 +"132",1654.5,118705,115060,485 +"133",1658.6,118958,115401,503 +"134",1664.5,119314,115768,520 +"135",1667.6,119504,116037,550 +"136",1669.5,119620,116200,531 +"137",1671.3,119728,116353,548 +"138",1674.2,119907,116605,575 +"139",1680,120259,117052,541 +"140",1684.5,120528,117342,555 +"141",1686.2,120623,117446,572 +"142",1688.4,120749,117589,590 +"143",1694,121079,117964,560 +"144",1694.6,121116,118010,573 +"145",1697.7,121296,118205,575 +"146",1704.7,121710,118631,563 +"147",1708.8,121941,118853,559 +"148",1714.2,122245,119164,589 +"149",1716,122345,119273,573 +"150",1719.4,122538,119499,584 +"151",1722.6,122718,119704,591 +"152",1731.2,123222,120320,603 +"153",1735.2,123443,120571,601 +"154",1736.8,123535,120652,578 +"155",1739,123658,120765,606 +"156",1744.3,123953,121090,592 +"157",1751.5,124348,121561,598 +"158",1754.3,124505,121752,594 +"159",1759.4,124787,122020,618 +"160",1765.5,125136,122367,592 +"161",1768.5,125298,122528,594 +"162",1770,125380,122606,600 +"163",1775.7,125692,122968,598 +"164",1780,125933,123279,604 +"165",1783.1,126109,123445,601 +"166",1786.8,126316,123677,622 +"167",1789.2,126447,123815,602 +"168",1789.4,126458,123826,630 +"169",1794.2,126710,124077,618 +"170",1797.8,126893,124244,619 +"171",1804.5,127236,124597,610 +"172",1814.8,127750,125176,649 +"173",1818.4,127930,125354,645 +"174",1819.6,127992,125424,623 +"175",1820.4,128032,125468,677 +"176",1824.6,128239,125679,672 +"177",1831,128549,126093,633 +"178",1832.3,128614,126200,644 +"179",1834.2,128712,126343,644 +"180",1834.7,128738,126380,636 +"181",1838.5,128932,126652,632 +"182",1844.8,129266,127008,638 +"183",1848.4,129450,127214,655 +"184",1852.3,129669,127440,666 +"185",1853.9,129752,127526,683 +"186",1857.4,129937,127716,653 +"187",1860.6,130111,127890,687 +"188",1863.8,130286,128080,708 +"189",1869.4,130605,128364,710 +"190",1870.2,130653,128399,699 +"191",1874.4,130904,128576,700 +"192",1875.5,130973,128632,704 +"193",1878.8,131178,128812,676 +"194",1883.3,131459,129062,552 +"195",1884.2,131519,129125,565 +"196",1888.6,131813,129348,540 +"197",1893.4,132149,129675,560 +"198",1897.9,132470,129898,524 +"199",1903.6,132880,130172,542 +"200",1910.9,133444,130549,492 +"201",1921.5,134310,131146,477 +"202",1922.3,134383,131195,491 +"203",1932.1,135318,131795,453 +"204",1954.6,137611,133340,431 +"205",1969.9,139296,134211,399 +"206",1980.2,140452,135003,352 +"207",1987.4,141257,135683,357 +"208",1994.7,142075,136367,374 +"209",1998,142440,136659,377 +"210",2005.9,143326,137393,348 +"211",2009.4,143720,137686,339 +"212",2016.4,144496,138408,318 +"213",2030.9,146122,140072,319 +"214",2042.5,147403,141422,345 +"215",2063.7,149756,143980,355 +"216",2088.6,152467,146784,356 +"217",2102.4,154026,148566,400 +"218",2109,154786,149406,418 +"219",2116,155625,150303,410 +"220",2119,155987,150633,376 +"221",2127.2,156981,151441,395 +"222",2137.1,158157,152562,445 +"223",2143,158819,153173,414 +"224",2153.4,159908,154129,382 +"225",2164,161077,155299,377 +"226",2167.2,161450,155706,406 +"227",2177.3,162574,157299,403 +"228",2180.4,162912,157806,381 +"229",2196.4,164820,159791,376 +"230",2225,168391,162996,405 +"231",2247,170922,165278,420 +"232",2273,174105,169266,478 +"233",2302,177644,172596,456 +"234",2312.3,179000,174189,402 +"235",2325,180546,175440,468 +"236",2348,183525,178550,503 +"237",2363,185640,180779,522 +"238",2373,187067,181718,464 +"239",2386,188892,183355,470 +"240",2399,190587,185063,510 +"241",2414,192382,187199,445 +"242",2425,193816,189335,440 +"243",2437,195298,191057,414 +"244",2475,199904,195625,460 +"245",2501,202717,199292,558 +"246",2525,205458,202212,612 +"247",2543,207803,204283,482 +"248",2552,208947,205148,425 +"249",2554.9,209310,205439,421 +"250",2557.7,209648,205715,413 +"251",2560.9,210056,206122,436 +"252",2564.9,210526,206675,466 +"253",2567.5,210840,207033,463 +"254",2570.4,211178,207418,455 +"255",2574.2,211628,207991,496 +"256",2575.5,211784,208183,475 +"257",2579.9,212295,208796,476 +"258",2581.9,212531,209078,485 +"259",2584.7,212846,209414,515 +"260",2588.5,213282,209975,473 +"261",2590.4,213503,210237,498 +"262",2595.1,214036,210830,567 +"263",2596.7,214219,211005,503 +"264",2600.4,214642,211481,509 +"265",2603.7,215011,211929,586 +"266",2606.6,215343,212281,551 +"267",2609.7,215685,212662,554 +"268",2612.5,216019,213010,545 +"269",2615.5,216377,213385,569 +"270",2621.7,217099,214153,581 +"271",2629,217944,214996,558 +"272",2633.5,218492,215504,568 +"273",2636.7,218908,215879,586 +"274",2639.5,219276,216310,544 +"275",2643.7,219835,216923,557 +"276",2646.4,220230,217253,541 +"277",2649.4,220678,217577,483 +"278",2656.2,221718,218342,440 +"279",2659.5,222273,218767,436 +"280",2666.7,223548,219680,476 +"281",2669.4,224060,220047,473 +"282",2674.6,224993,220760,498 +"283",2676.9,225380,220997,480 +"284",2682.6,226339,221612,482 +"285",2691,227885,222958,494 +"286",2693.6,228349,223446,532 +"287",2698,229167,224630,532 +"288",2700.5,229641,225136,512 +"289",2702.9,230076,225535,506 +"290",2705.6,230547,225888,497 +"291",2707.9,230945,226213,483 +"292",2711.8,231619,226726,484 +"293",2714.7,232092,227224,476 +"294",2717.7,232571,227840,445 +"295",2732.5,234771,230668,439 +"296",2735.7,235233,231383,460 +"297",2738.7,235652,231990,495 +"298",2741.9,236109,232615,502 +"299",2744.8,236498,233139,514 +"300",2747.6,236866,233646,541 +"301",2751.1,237301,234126,540 +"302",2753.6,237602,234470,550 +"303",2756.2,237889,234781,540 +"304",2759.2,238213,235222,554 +"305",2765.2,238907,236234,582 +"306",2771.2,239672,237466,619 +"307",2773.5,240010,237834,631 +"308",2776.5,240465,238199,650 +"309",2780,241055,238623,500 +"310",2782.8,241549,238943,554 +"311",2785.5,242091,239249,538 +"312",2788.5,242675,239545,522 +"313",2794.6,243821,240205,498 +"314",2797.5,244444,240576,484 +"315",2800.5,245091,240966,470 +"316",2806.5,246378,242067,509 +"317",2815.6,248369,243657,402 +"318",2818.5,249027,244198,437 +"319",2821.5,249668,244861,401 +"320",2824.5,250307,245481,380 +"321",2830.4,251542,246709,405 +"322",2833.8,252268,247436,399 +"323",2836.5,252876,248083,424 +"324",2839.5,253557,248977,447 +"325",2842.4,254218,249751,465 +"326",2845.5,254871,250460,467 +"327",2851.5,256180,251519,421 +"328",2854.4,256860,252183,410 +"329",2857.5,257602,252957,511 +"330",2860.5,258358,253889,486 +"331",2866.5,259879,255230,398 +"332",2870.4,260916,256038,408 +"333",2872.7,261510,256489,385 +"334",2876.2,262453,257245,402 +"335",2881.5,263865,258495,457 +"336",2884.5,264663,259226,445 +"337",2887.5,265454,259956,426 +"338",2890.5,266260,260759,448 +"339",2893.5,267040,261596,454 +"340",2896.4,267804,262388,448 +"341",2899.5,268556,263204,441 +"342",2902.5,269304,264042,442 +"343",2905.5,270050,264831,443 +"344",2911.4,271448,266485,417 +"345",2914.5,272177,267443,453 +"346",2917.5,272836,268273,429 +"347",2919.4,273254,268677,441 +"348",2926.5,274800,270677,484 +"349",2935.5,276729,273010,472 +"350",2941.5,278016,274443,508 +"351",2944.5,278704,275209,516 +"352",2951.2,280356,276867,522 +"353",2956.5,281738,277924,430 +"354",2964.5,283807,279541,430 +"355",2973.9,286496,282325,507 +"356",2979.5,288010,283491,464 +"357",2988.6,290551,286214,482 +"358",2994.5,292129,287852,522 +"359",2997.5,292853,288492,454 +"360",3000.4,293619,289444,433 +"361",3003.5,294493,290568,438 +"362",3009.5,296156,292472,475 +"363",3015.6,297835,293700,429 +"364",3018.5,298620,294611,468 +"365",3021.5,299407,295514,464 +"366",3027.7,300970,297181,460 +"367",3030.4,301671,298058,487 +"368",3033.5,302450,299016,486 +"369",3036.5,303199,299875,511 +"370",3039.5,303931,300639,545 +"371",3042.5,304738,301489,539 +"372",3045.5,305609,302452,603 +"373",3048.5,306552,303328,568 +"374",3051.5,307461,303951,588 +"375",3054.5,308352,304584,435 +"376",3057.7,309277,305303,443 +"377",3060.5,310076,306088,457 +"378",3063.5,310900,307124,478 +"379",3066.5,311701,308097,478 +"380",3072.5,313289,310035,488 +"381",3075.6,314077,310980,522 +"382",3078.5,314816,311769,570 +"383",3081.6,315590,312666,561 +"384",3084.6,316319,313510,589 +"385",3087.8,317098,314366,624 +"386",3090.5,317773,315139,620 +"387",3093.5,318507,315937,621 +"388",3096.4,319224,316674,639 +"389",3099.5,319976,317442,627 +"390",3102.5,320731,318261,637 +"391",3105.5,321446,318978,639 +"392",3109.5,322330,319871,636 +"393",3111.5,322753,320388,604 +"394",3114.8,323439,321383,604 +"395",3117.5,324019,322109,647 +"396",3119.7,324496,322618,665 +"397",3120.6,324718,322833,731 +"398",3123.5,325403,323488,773 +"399",3126.5,326197,324186,575 +"400",3129.9,327237,324991,581 +"401",3132.4,328055,325525,588 +"402",3135.5,329132,326236,558 +"403",3138.5,330287,327121,537 +"404",3141.5,331496,328084,517 +"405",3145,333066,329234,471 +"406",3147.5,334351,330204,451 +"407",3153.5,337299,332289,458 +"408",3156.5,338745,333600,371 +"409",3159.5,340342,335404,383 +"410",3162.8,341844,336967,342 +"411",3165.5,343109,338273,369 +"412",3169,344841,340163,422 +"413",3171.5,346049,341572,397 +"414",3174.5,347584,342993,442 +"415",3177.8,349293,344729,406 +"416",3180.5,350757,346095,384 +"417",3183.4,352372,347604,398 +"418",3186.5,354121,349160,391 +"419",3189.5,355789,350759,386 +"420",3192.5,357445,352406,392 +"421",3195.7,359181,354326,384 +"422",3199,360896,356202,399 +"423",3200,361445,356838,399 +"424",3201.4,362204,357728,396 +"425",3204.7,363957,359682,454 +"426",3207.5,365473,361167,422 +"427",3210.6,367094,362814,386 +"428",3213.7,368664,364471,397 +"429",3216.5,370069,366191,432 +"430",3219.5,371827,368105,463 +"431",3222.5,373615,369552,517 +"432",3225.5,375314,370919,405 +"433",3228.9,377171,373007,432 +"434",3231.5,378475,374567,482 +"435",3237.5,381820,378183,521 +"436",3240.5,383388,379625,445 +"437",3243.5,384986,381612,516 +"438",3246.5,386818,383527,542 +"439",3249.5,388758,384910,578 +"440",3252.5,390609,386543,567 +"441",3255.5,392628,388652,544 +"442",3258.5,394611,390567,439 +"443",3261.5,396400,392427,448 +"444",3264.5,398086,394620,478 +"445",3267.5,399720,396698,550 +"446",3270.6,401444,398575,574 +"447",3273.8,403146,400362,566 +"448",3276.5,404597,401860,598 +"449",3280.5,406690,404164,600 +"450",3283.5,408217,405823,672 +"451",3286.5,409724,407442,634 +"452",3289.5,411177,408995,644 +"453",3292.8,412968,410793,623 +"454",3295.5,414399,412182,626 +"455",3299,416327,414080,653 +"456",3301.4,417656,415452,678 +"457",3304.4,419336,417173,695 +"458",NA,NA,NA,NA Added: trunk/octave-forge/extra/lssa/data/co2.csv =================================================================== --- trunk/octave-forge/extra/lssa/data/co2.csv (rev 0) +++ trunk/octave-forge/extra/lssa/data/co2.csv 2012-05-22 22:34:07 UTC (rev 10499) @@ -0,0 +1,284 @@ +"","Depth..corrected.","Ice.age..GT4.","Gas.age","CO2..ppmv." +"1",149.1,5679,2342,284.7 +"2",173.1,6828,3634,272.8 +"3",177.4,7043,3833,268.1 +"4",228.6,9523,6220,262.2 +"5",250.3,10579,7327,254.6 +"6",266,11334,8113,259.6 +"7",302.6,13449,10123,261.6 +"8",321.2,14538,11013,263.7 +"9",331.6,15208,11326,244.8 +"10",342.1,15922,11719,238.3 +"11",365.5,17747,13405,236.2 +"12",375.6,18580,13989,225.3 +"13",443.5,24315,17695,182.2 +"14",470.8,26578,19988,189.2 +"15",506.4,29630,22977,191.6 +"16",544.7,32844,26303,188.5 +"17",554.2,33645,27062,191.7 +"18",602.3,37421,31447,205.4 +"19",625.6,39310,33884,209.1 +"20",700.2,45242,39880,209.1 +"21",765,50610,44766,189.3 +"22",788.2,52446,47024,188.4 +"23",800,53436,48229,210.1 +"24",812.2,54474,49414,215.7 +"25",834.8,56300,51174,190.4 +"26",902.2,61783,57068,221.8 +"27",912,62689,57799,210.4 +"28",986.2,69618,63687,195.4 +"29",1011.3,71767,65701,191.4 +"30",1023.5,72797,66883,195 +"31",1087.2,78042,72849,227.4 +"32",1112.5,80057,75360,229.2 +"33",1162.1,83615,78995,217.1 +"34",1175,84515,80059,221.8 +"35",1209.9,86840,82858,231 +"36",1237.2,88808,84929,241.1 +"37",1251.5,89864,85727,236.4 +"38",1261.2,90609,86323,228.1 +"39",1274.2,91560,87180,214.2 +"40",1289.2,92632,88051,217 +"41",1309.2,94039,89363,208 +"42",1338.2,96047,91691,224.3 +"43",1349,96791,92460,228.4 +"44",1387.2,99498,95349,232.1 +"45",1451.5,103733,99842,225.9 +"46",1463.2,104566,100833,230.9 +"47",1476.1,105492,101829,236.9 +"48",1505,107599,103372,228.2 +"49",1526.3,109404,105213,236.9 +"50",1542.1,110674,106203,230.7 +"51",1575.2,113363,108308,238.2 +"52",1582.8,113952,108994,245.7 +"53",1598,115077,110253,251.3 +"54",1615,116228,111456,256.8 +"55",1627.9,117072,112577,266.3 +"56",1637.6,117671,113472,261.4 +"57",1644,118074,114082,274.6 +"58",1651,118499,114738,273.3 +"59",1669.2,119601,116175,262.5 +"60",1687.2,120680,117519,267.6 +"61",1700.9,121485,118396,273.8 +"62",1716,122345,119273,272 +"63",1726.8,122965,120002,265.2 +"64",1736.8,123535,120652,277.7 +"65",1758.2,124721,121961,272.2 +"66",1770,125380,122606,276.5 +"67",1789.2,126447,123815,268.7 +"68",1790,126491,123858,266.6 +"69",1799,126955,124306,266.3 +"70",1804,127210,124571,279.8 +"71",1810,127510,124876,277.2 +"72",1825.7,128293,125746,273.8 +"73",1830,128501,126023,267.1 +"74",1836,128804,126475,262.5 +"75",1841.6,129097,126809,262.6 +"76",1852.4,129674,127445,275.4 +"77",1869.3,130599,128300,274.1 +"78",1870.2,130653,128399,287.1 +"79",1875.9,130998,128652,286.8 +"80",1882.5,131406,129007,282.7 +"81",1890,131908,129411,264.1 +"82",1895,132264,129755,263.4 +"83",1903.5,132873,130167,259 +"84",1932,135308,131789,240.4 +"85",1954.5,137601,133334,224 +"86",1969.8,139285,134205,208.9 +"87",1980.2,140452,135003,204.6 +"88",1987.4,141257,135683,198.1 +"89",1990.6,141615,135976,201.8 +"90",1994.6,142064,136359,202.5 +"91",1998,142440,136659,195.9 +"92",2005.8,143315,137383,194.4 +"93",2009.5,143732,137694,193.4 +"94",2015,144346,138226,190.2 +"95",2025.7,145527,139445,192.3 +"96",2041.5,147292,141312,196.5 +"97",2050.3,148287,142357,190.4 +"98",2077.5,151234,145435,197 +"99",2116,155625,150303,191.9 +"100",2157,160293,154471,189 +"101",2164,161077,155299,185.5 +"102",2203,165646,160494,204.4 +"103",2225,168391,162996,191.6 +"104",2247,170922,165278,183.8 +"105",2280,174920,169870,197.9 +"106",2302,177644,172596,197.8 +"107",2325,180546,175440,190.3 +"108",2333,181502,176271,190.1 +"109",2348,183525,178550,207.7 +"110",2363,185640,180779,213.2 +"111",2372,186927,181617,217.7 +"112",2386,188892,183355,199.8 +"113",2399,190587,185063,203.5 +"114",2414,192382,187199,210.7 +"115",2425,193816,189335,231.4 +"116",2437,195298,191057,231.5 +"117",2451,197086,192632,218 +"118",2475,199904,195625,220.1 +"119",2499,202496,199025,242.6 +"120",2525,205458,202212,251 +"121",2533,206496,203191,239.1 +"122",2543,207803,204283,247.7 +"123",2552.01,208947,205148,244.4 +"124",2557.71,209648,205715,232.2 +"125",2560.91,210053,206119,228.7 +"126",2574.21,211628,207991,238.2 +"127",2584.71,212846,209414,242.2 +"128",2588.81,213315,210022,244.6 +"129",2595.11,214036,210830,247.3 +"130",2596.71,214219,211005,252 +"131",2606.61,215343,212281,257.4 +"132",2621.71,217099,214153,251.2 +"133",2629.41,217989,215041,241.4 +"134",2634.41,218602,215593,240.3 +"135",2636.71,218908,215879,242.7 +"136",2640.41,219393,216459,247.5 +"137",2644.41,219935,217009,251.7 +"138",2646.61,220255,217271,251.2 +"139",2650.41,220822,217676,245.4 +"140",2656.21,221718,218342,240.5 +"141",2666.71,223548,219680,212.2 +"142",2670.41,224240,220182,216.2 +"143",2674.61,224993,220760,207.2 +"144",2677.41,225469,221054,208.9 +"145",2682.61,226339,221612,205.7 +"146",2691.01,227885,222958,203.4 +"147",2693.61,228349,223446,215.7 +"148",2698.01,229167,224630,236.9 +"149",2701.41,229802,225299,234.5 +"150",2702.71,230039,225509,233.1 +"151",2705.61,230547,225888,224.5 +"152",2711.71,231601,226710,232.4 +"153",2715.41,232206,227384,233.9 +"154",2717.71,232571,227840,241.7 +"155",2732.71,234795,230703,245.2 +"156",2735.71,235232,231382,252.2 +"157",2738.71,235652,231990,241.4 +"158",2741.71,236077,232570,247.4 +"159",2744.61,236467,233102,243.1 +"160",2747.61,236866,233646,239.2 +"161",2751.11,237301,234126,245.7 +"162",2753.61,237602,234470,245.9 +"163",2756.21,237889,234781,247.4 +"164",2759.11,238206,235213,252.9 +"165",2765.21,238908,236236,259.8 +"166",2773.51,240006,237831,279 +"167",2782.71,241535,238935,263.8 +"168",2785.51,242092,239250,252.4 +"169",2788.51,242675,239545,249.9 +"170",2794.51,243813,240201,230.4 +"171",2797.51,244446,240577,219.4 +"172",2806.51,246379,242068,214.7 +"173",2815.61,248364,243653,200.2 +"174",2818.61,249046,244215,213.9 +"175",2821.51,249670,244863,195.4 +"176",2824.51,250309,245483,196.7 +"177",2833.81,252279,247447,199 +"178",2836.51,252879,248087,201.9 +"179",2839.51,253559,248980,204 +"180",2845.51,254873,250461,203.9 +"181",2851.51,256182,251521,209.7 +"182",2857.51,257604,252959,208.9 +"183",2860.51,258351,253880,214.7 +"184",2866.51,259882,255233,228.2 +"185",2870.51,260936,256053,199.9 +"186",2872.71,261526,256501,211.7 +"187",2876.21,262455,257247,188.7 +"188",2881.42,263844,258477,194.2 +"189",2884.51,264666,259228,198.9 +"190",2887.51,265457,259958,184.7 +"191",2890.51,266255,260754,190.4 +"192",2893.51,267039,261595,193.9 +"193",2896.51,267825,262411,194.2 +"194",2899.51,268558,263207,198.4 +"195",2902.51,269307,264046,193.2 +"196",2905.51,270052,264834,202.2 +"197",2911.46,271454,266492,211 +"198",2914.51,272171,267434,215.4 +"199",2919.41,273256,268679,223.7 +"200",2926.51,274802,270680,231.4 +"201",2935.51,276731,273012,226.4 +"202",2941.51,278017,274445,230.4 +"203",2944.51,278711,275218,231 +"204",2956.51,281740,277925,220.4 +"205",2959.51,282539,278602,217.2 +"206",2964.51,283810,279543,207.7 +"207",2973.81,286475,282301,212.7 +"208",2979.51,288013,283492,213.2 +"209",2988.61,290554,286217,224.4 +"210",2994.51,292121,287846,236.2 +"211",3003.51,294495,290571,240.2 +"212",3007.01,295477,291769,240.7 +"213",3009.51,296158,292474,250.2 +"214",3015.51,297810,293676,244.9 +"215",3018.51,298623,294615,225.9 +"216",3022.71,299716,295849,227.9 +"217",3027.51,300928,297131,233.2 +"218",3030.41,301665,298051,237.9 +"219",3033.51,302452,299020,239 +"220",3036.51,303201,299877,241.9 +"221",3039.51,303939,300646,251.7 +"222",3042.51,304745,301496,256.8 +"223",3045.51,305612,302456,257.2 +"224",3048.56,306561,303334,246.9 +"225",3051.51,307464,303953,272.7 +"226",3054.51,308358,304590,251.7 +"227",3057.71,309281,305306,244.7 +"228",3063.51,310905,307131,255.9 +"229",3066.51,311704,308101,249.2 +"230",3072.51,313292,310039,256.3 +"231",3075.41,314032,310930,260.4 +"232",3078.51,314822,311774,260.3 +"233",3084.51,316304,313493,266.3 +"234",3090.51,317775,315143,266.2 +"235",3093.51,318509,315940,270.2 +"236",3096.46,319231,316681,271.9 +"237",3099.51,319978,317445,275.2 +"238",3105.51,321448,318980,265 +"239",3109.01,322216,319754,271.8 +"240",3111.51,322746,320378,272.7 +"241",3114.81,323441,321386,273.2 +"242",3117.51,324021,322111,282.4 +"243",3119.51,324461,322582,289.2 +"244",3120.61,324711,322827,288.4 +"245",3123.51,325400,323485,298.7 +"246",3126.51,326200,324189,278.2 +"247",3129.91,327237,324991,285.8 +"248",3132.41,328058,325527,278.7 +"249",3135.51,329135,326239,270.5 +"250",3138.51,330278,327114,255.7 +"251",3141.51,331513,328097,241.9 +"252",3145.01,333111,329267,239.7 +"253",3147.51,334356,330208,234.2 +"254",3153.51,337304,332293,250.2 +"255",3156.51,338770,333627,200.7 +"256",3159.51,340242,335290,205.2 +"257",3162.81,341849,336972,204.9 +"258",3169.01,344844,340165,220.4 +"259",3174.51,347589,342998,221.2 +"260",3177.81,349298,344735,216.2 +"261",3183.41,352377,347610,209.2 +"262",3189.51,355795,350765,193 +"263",3192.51,357450,352412,186.2 +"264",3200.01,361445,356838,201.2 +"265",3204.71,363962,359688,206.4 +"266",3210.51,367048,362766,201.9 +"267",3216.45,370095,366221,214.7 +"268",3222.51,373629,369563,229.7 +"269",3228.91,377177,373014,227 +"270",3231.51,378469,374561,240 +"271",3237.51,381834,378194,246.9 +"272",3240.51,383395,379633,245.9 +"273",3249.51,388757,384909,264.7 +"274",3252.45,390641,386579,259.3 +"275",3258.51,394634,390589,255.2 +"276",3261.51,396423,392451,250.2 +"277",3264.51,398091,394628,266.3 +"278",3267.51,399733,396713,274.7 +"279",3273.81,403173,400390,278 +"280",3283.51,408236,405844,279.7 +"281",3289.45,411202,409022,283.7 +"282",3292.91,413010,410831,276.3 +"283",3299.01,416332,414085,285.5 Added: trunk/octave-forge/extra/lssa/data/deut.csv =================================================================== --- trunk/octave-forge/extra/lssa/data/deut.csv (rev 0) +++ trunk/octave-forge/extra/lssa/data/deut.csv 2012-05-22 22:34:07 UTC (rev 10499) @@ -0,0 +1,3312 @@ +"","Depth.corrected","Ice.age..GT4.","deut","deltaTS" +"1",0,0,-438,0 +"2",1,17,-438,0 +"3",2,35,-438,0 +"4",3,53,-438,0 +"5",4,72,-438,0 +"6",5,91,-438,0 +"7",6,110,-438,0 +"8",7,129,-438,0 +"9",8,149,-442.9,-0.81 +"10",9,170,-437.9,0.02 +"11",10,190,-435.8,0.36 +"12",11,211,-443.7,-0.95 +"13",12,234,-449.1,-1.84 +"14",13,258,-444.6,-1.09 +"15",14,281,-442.5,-0.75 +"16",15,304,-439.3,-0.22 +"17",16,327,-440.9,-0.48 +"18",17,351,-442.5,-0.75 +"19",18,375,-436.6,0.23 +"20",19,397,-430,1.33 +"21",20,420,-435.9,0.35 +"22",21,444,-436.9,0.18 +"23",22,469,-438.5,-0.08 +"24",23,495,-444.5,-1.08 +"25",24,523,-446.4,-1.39 +"26",25,552,-447.7,-1.61 +"27",26,581,-443.4,-0.9 +"28",27,609,-441.6,-0.6 +"29",28,637,-438.1,-0.02 +"30",29,665,-439.1,-0.18 +"31",30,695,-445.4,-1.23 +"32",31,726,-447.3,-1.54 +"33",32,757,-443.1,-0.85 +"34",33,788,-438.6,-0.1 +"35",34,817,-439,-0.17 +"36",35,848,-442.7,-0.78 +"37",36,881,-442.7,-0.78 +"38",37,912,-439,-0.17 +"39",38,944,-439.5,-0.25 +"40",39,976,-439.7,-0.28 +"41",40,1009,-442.9,-0.81 +"42",41,1042,-438.3,-0.05 +"43",42,1074,-436.4,0.27 +"44",43,1107,-443,-0.83 +"45",44,1142,-441.9,-0.65 +"46",45,1176,-439.6,-0.27 +"47",46,1211,-441.9,-0.65 +"48",47,1247,-446.9,-1.48 +"49",48,1285,-447.9,-1.64 +"50",49,1321,-440.4,-0.4 +"51",50,1356,-436,0.33 +"52",51,1390,-438.3,-0.05 +"53",52,1426,-438.8,-0.13 +"54",53,1461,-438.2,-0.03 +"55",54,1497,-440.8,-0.46 +"56",55,1535,-444,-1 +"57",56,1573,-443.8,-0.96 +"58",57,1612,-446,-1.33 +"59",58,1652,-447.1,-1.51 +"60",59,1692,-443.3,-0.88 +"61",60,1732,-444.4,-1.06 +"62",61,1772,-445.3,-1.21 +"63",62,1812,-445.5,-1.24 +"64",63,1853,-443.8,-0.96 +"65",64,1893,-441.2,-0.53 +"66",65,1931,-437.1,0.15 +"67",66,1970,-439.7,-0.28 +"68",67,2009,-440.7,-0.45 +"69",68,2049,-440.3,-0.38 +"70",69,2089,-441.2,-0.53 +"71",70,2129,-441.7,-0.61 +"72",71,2171,-443.7,-0.95 +"73",72,2212,-442.4,-0.73 +"74",73,2253,-437.3,0.12 +"75",74,2291,-431,1.16 +"76",75,2331,-443.9,-0.98 +"77",76,2374,-446.7,-1.44 +"78",77,2418,-442.4,-0.73 +"79",78,2460,-441.8,-0.63 +"80",79,2501,-436.2,0.3 +"81",80,2542,-439.6,-0.27 +"82",81,2585,-446.2,-1.36 +"83",82,2628,-439,-0.17 +"84",83,2670,-438.1,-0.02 +"85",84,2713,-445.2,-1.19 +"86",85,2760,-449.9,-1.97 +"87",86,2805,-441.7,-0.61 +"88",87,2847,-434.5,0.58 +"89",88,2889,-440.3,-0.38 +"90",89,2934,-446.1,-1.34 +"91",90,2980,-446.5,-1.41 +"92",91,3026,-442.4,-0.73 +"93",92,3070,-439.5,-0.25 +"94",93,3114,-441.2,-0.53 +"95",94,3158,-438.5,-0.08 +"96",95,3201,-437.1,0.15 +"97",96,3245,-440.6,-0.43 +"98",97,3289,-441.7,-0.61 +"99",98,3334,-439.8,-0.3 +"100",99,3379,-438.8,-0.13 +"101",100,3422,-436.7,0.22 +"102",101,3466,-437,0.17 +"103",102,3511,-443.5,-0.91 +"104",103,3558,-443.4,-0.9 +"105",104,3603,-436.2,0.3 +"106",105,3646,-434.1,0.65 +"107",106,3689,-434.5,0.58 +"108",107,3732,-437.8,0.03 +"109",108,3778,-441.8,-0.63 +"110",109,3824,-440.8,-0.46 +"111",110,3870,-438,0 +"112",111,3915,-439.4,-0.23 +"113",112,3962,-442,-0.66 +"114",113,4009,-442.4,-0.73 +"115",114,4057,-442.5,-0.75 +"116",115,4104,-443.5,-0.91 +"117",116,4153,-444.6,-1.09 +"118",117,4202,-444,-1 +"119",118,4250,-441.2,-0.53 +"120",119,4295,-434.7,0.55 +"121",120,4339,-431.2,1.13 +"122",121,4381,-431.2,1.13 +"123",122,4423,-431.2,1.13 +"124",123,4466,-431.2,1.13 +"125",124,4509,-431.2,1.13 +"126",125,4552,-432.7,0.88 +"127",126,4596,-436.8,0.2 +"128",127,4642,-440,-0.33 +"129",128,4690,-443.3,-0.88 +"130",129,4739,-441.5,-0.58 +"131",130,4786,-436.5,0.25 +"132",131,4831,-438,0 +"133",132,4880,-444.9,-1.14 +"134",133,4929,-442,-0.66 +"135",134,4977,-440.2,-0.36 +"136",135,5025,-442,-0.66 +"137",136,5072,-437.2,0.13 +"138",137,5118,-436.9,0.18 +"139",138,5165,-440.3,-0.38 +"140",139,5212,-439.3,-0.22 +"141",140,5259,-436.3,0.28 +"142",141,5305,-437.4,0.1 +"143",142,5351,-437.5,0.08 +"144",143,5397,-435,0.5 +"145",144,5442,-435,0.5 +"146",145,5488,-436.8,0.2 +"147",146,5534,-437.9,0.02 +"148",147,5581,-437.5,0.08 +"149",148,5627,-437.8,0.03 +"150",149,5674,-438.37,-0.06 +"151",150,5721,-438.93,-0.15 +"152",151,5769,-439.5,-0.25 +"153",152,5816,-439.3,-0.22 +"154",153,5863,-437.1,0.15 +"155",154,5909,-435.3,0.45 +"156",155,5955,-438.8,-0.13 +"157",156,6004,-442.4,-0.73 +"158",157,6052,-439.25,-0.21 +"159",158,6099,-436.1,0.32 +"160",159,6145,-439,-0.17 +"161",160,6193,-440.2,-0.33 +"162",161,6241,-437.6,0.09 +"163",162,6287,-436.4,0.28 +"164",163,6334,-441.3,-0.55 +"165",164,6385,-447.5,-1.59 +"166",165,6436,-444.4,-1.09 +"167",166,6486,-439.6,-0.31 +"168",167,6534,-441.4,-0.62 +"169",168,6583,-441.5,-0.65 +"170",169,6631,-435.3,0.37 +"171",170,6677,-435.2,0.37 +"172",171,6724,-439.5,-0.36 +"173",172,6773,-442.3,-0.84 +"174",173,6823,-444.9,-1.28 +"175",174,6874,-444,-1.14 +"176",175,6924,-440.5,-0.58 +"177",176,6973,-440.5,-0.59 +"178",177,7023,-443.2,-1.05 +"179",178,7074,-444,-1.2 +"180",179,7124,-440.5,-0.63 +"181",180,7172,-436.5,0.02 +"182",181,7220,-436.8,-0.04 +"183",182,7267,-437.1,-0.11 +"184",183,7315,-438.1,-0.29 +"185",184,7364,-441.2,-0.81 +"186",185,7413,-439.7,-0.58 +"187",186,7462,-436,0.02 +"188",187,7509,-436.2,-0.03 +"189",188,7555,-433.1,0.48 +"190",189,7602,-436,-0.02 +"191",190,7649,-435.7,0.02 +"192",191,7697,-436,-0.04 +"193",192,7745,-440,-0.72 +"194",193,7794,-439,-0.57 +"195",194,7844,-440.9,-0.9 +"196",195,7894,-441,-0.93 +"197",196,7944,-439.5,-0.69 +"198",197,7994,-438.5,-0.54 +"199",198,8043,-439,-0.64 +"200",199,8091,-433.3,0.3 +"201",200,8135,-422.6,2.06 +"202",201,8178,-431.35,0.59 +"203",202,8226,-440.1,-0.87 +"204",203,8276,-439.5,-0.78 +"205",204,8325,-438,-0.55 +"206",205,8374,-435.9,-0.21 +"207",206,8422,-436.1,-0.26 +"208",207,8471,-437.6,-0.52 +"209",208,8520,-438.3,-0.65 +"210",209,8569,-438.4,-0.68 +"211",210,8619,-438.6,-0.73 +"212",211,8668,-437.5,-0.56 +"213",212,8716,-432,0.34 +"214",213,8763,-433.2,0.13 +"215",214,8811,-438.8,-0.81 +"216",215,8861,-437,-0.53 +"217",216,8910,-437,-0.54 +"218",217,8960,-439,-0.88 +"219",218,9009,-436.5,-0.48 +"220",219,9058,-436,-0.41 +"221",220,9107,-437.1,-0.6 +"222",221,9156,-436.5,-0.51 +"223",222,9204,-434.1,-0.13 +"224",223,9252,-431.7,0.26 +"225",224,9298,-433,0.03 +"226",225,9346,-435.5,-0.39 +"227",226,9396,-438,-0.82 +"228",227,9445,-437.2,-0.7 +"229",228,9494,-433.9,-0.16 +"230",229,9542,-433.8,-0.16 +"231",230,9589,-430.2,0.43 +"232",231,9635,-429.6,0.51 +"233",232,9682,-435.4,-0.46 +"234",233,9732,-437.4,-0.8 +"235",234,9782,-437.6,-0.85 +"236",235,9831,-436.9,-0.74 +"237",236,9881,-434.5,-0.36 +"238",237,9929,-434.5,-0.37 +"239",238,9978,-436.1,-0.65 +"240",239,10027,-433.8,-0.28 +"241",240,10075,-434.9,-0.47 +"242",241,10124,-435.5,-0.58 +"243",242,10172,-430,0.31 +"244",243,10218,-428.7,0.52 +"245",244,10265,-432.8,-0.18 +"246",245,10315,-439.5,-1.3 +"247",246,10366,-437.4,-0.97 +"248",247,10415,-434.1,-0.43 +"249",248,10465,-436,-0.76 +"250",249,10515,-436,-0.77 +"251",250,10564,-436,-0.79 +"252",251,10614,-436.6,-0.9 +"253",252,10665,-436.9,-0.96 +"254",253,10715,-435.2,-0.7 +"255",254,10764,-432.5,-0.26 +"256",255,10812,-433.5,-0.44 +"257",256,10861,-434.5,-0.62 +"258",257,10910,-431.6,-0.15 +"259",258,10957,-431.3,-0.12 +"260",259,11005,-431.9,-0.23 +"261",260,11053,-430.3,0.02 +"262",261,11100,-429.8,0.09 +"263",262,11146,-425.8,0.74 +"264",263,11191,-425.3,0.81 +"265",264,11237,-431.2,-0.18 +"266",265,11286,-433,-0.48 +"267",266,11334,-431.7,-0.27 +"268",267,11383,-434.5,-0.73 +"269",268,11434,-437.4,-1.22 +"270",269,11485,-437.8,-1.29 +"271",270,11537,-439.5,-1.57 +"272",271,11590,-439.6,-1.59 +"273",272,11642,-439.7,-1.61 +"274",273,11695,-441,-1.83 +"275",274,11749,-443.2,-2.2 +"276",275,11805,-444.2,-2.37 +"277",276,11861,-447.1,-2.85 +"278",277,11918,-445.3,-2.55 +"279",278,11973,-443.1,-2.19 +"280",279,12029,-447,-2.84 +"281",280,12087,-448.5,-3.09 +"282",281,12144,-446.5,-2.77 +"283",282,12202,-447.3,-2.9 +"284",283,12261,-453.2,-3.88 +"285",284,12323,-455,-4.18 +"286",285,12385,-453.6,-3.96 +"287",286,12446,-451.5,-3.61 +"288",287,12507,-452.4,-3.76 +"289",288,12569,-455.3,-4.25 +"290",289,12632,-455.3,-4.25 +"291",290,12694,-453.27,-3.91 +"292",291,12755,-451.23,-3.57 +"293",292,12815,-449.2,-3.24 +"294",293,12874,-450.2,-3.4 +"295",294,12934,-450.8,-3.5 +"296",295,12994,-451.8,-3.67 +"297",296,13055,-452.9,-3.85 +"298",297,13116,-452.3,-3.75 +"299",298,13177,-452.1,-3.72 +"300",299,13237,-450.5,-3.45 +"301",300,13296,-448.8,-3.17 +"302",301,13355,-448.8,-3.17 +"303",302,13414,-451.8,-3.67 +"304",303,13476,-455.5,-4.28 +"305",304,13539,-453.9,-4.02 +"306",305,13600,-451.2,-3.57 +"307",306,13659,-449.4,-3.27 +"308",307,13718,-447.2,-2.91 +"309",308,13774,-442.9,-2.19 +"310",309,13828,-442,-2.04 +"311",310,13883,-443.2,-2.24 +"312",311,13938,-442.1,-2.06 +"313",312,13992,-443.65,-2.32 +"314",313,14048,-445.2,-2.57 +"315",314,14105,-446.75,-2.83 +"316",315,14163,-448.3,-3.08 +"317",316,14221,-449.85,-3.34 +"318",317,14281,-451.4,-3.6 +"319",318,14342,-452.95,-3.85 +"320",319,14404,-454.5,-4.11 +"321",320,14466,-451.7,-3.64 +"322",321,14526,-452.8,-3.82 +"323",322,14589,-456,-4.34 +"324",323,14651,-453.8,-3.98 +"325",324,14713,-453.5,-3.92 +"326",325,14775,-454.8,-4.14 +"327",326,14839,-457.1,-4.52 +"328",327,14904,-458.1,-4.68 +"329",328,14968,-456.7,-4.44 +"330",329,15032,-458,-4.66 +"331",330,15099,-462,-5.32 +"332",331,15167,-462.5,-5.4 +"333",332,15234,-460.1,-5 +"334",333,15300,-459,-4.81 +"335",334,15366,-458.6,-4.74 +"336",335,15432,-461.1,-5.15 +"337",336,15501,-464.5,-5.71 +"338",337,15570,-463.8,-5.6 +"339",338,15639,-462.9,-5.44 +"340",339,15708,-463.7,-5.57 +"341",340,15777,-462,-5.29 +"342",341,15845,-462.4,-5.35 +"343",342,15915,-467.5,-6.19 +"344",343,15987,-466.3,-5.99 +"345",344,16057,-464.9,-5.75 +"346",345,16128,-466.9,-6.08 +"347",346,16201,-468.5,-6.34 +"348",347,16275,-470.9,-6.74 +"349",348,16350,-471.8,-6.88 +"350",349,16426,-471.8,-6.88 +"351",350,16502,-471,-6.74 +"352",351,16577,-471.2,-6.77 +"353",352,16653,-472.4,-6.97 +"354",353,16729,-473.6,-7.16 +"355",354,16808,-475.6,-7.49 +"356",355,16889,-480.7,-8.33 +"357",356,16974,-481.8,-8.51 +"358",357,17058,-479,-8.04 +"359",358,17139,-476.4,-7.6 +"360",359,17219,-476,-7.53 +"361",360,17298,-475.5,-7.45 +"362",361,17379,-479.4,-8.09 +"363",362,17462,-480.5,-8.27 +"364",363,17544,-477,-7.68 +"365",364,17625,-477.6,-7.78 +"366",365,17706,-478,-7.84 +"367",366,17787,-477.9,-7.82 +"368",367,17868,-477.3,-7.72 +"369",368,17949,-477.5,-7.75 +"370",369,18031,-480.15,-8.19 +"371",370,18116,-482.8,-8.63 +"372",371,18201,-480,-8.16 +"373",372,18283,-478.4,-7.89 +"374",373,18365,-477.5,-7.74 +"375",374,18446,-478.9,-7.97 +"376",375,18530,-482.1,-8.5 +"377",376,18615,-481.7,-8.43 +"378",377,18701,-483.5,-8.73 +"379",378,18787,-481.9,-8.46 +"380",379,18870,-476.6,-7.58 +"381",380,18950,-476.9,-7.63 +"382",381,19032,-479.8,-8.11 +"383",382,19116,-480.7,-8.26 +"384",383,19199,-479.35,-8.03 +"385",384,19282,-478,-7.81 +"386",385,19362,-476.4,-7.54 +"387",386,19443,-477.4,-7.7 +"388",387,19525,-480.1,-8.15 +"389",388,19610,-481.9,-8.45 +"390",389,19696,-483.5,-8.71 +"391",390,19782,-482.4,-8.52 +"392",391,19868,-482.9,-8.61 +"393",392,19953,-479.2,-7.99 +"394",393,20035,-477,-7.62 +"395",394,20116,-478.3,-7.84 +"396",395,20197,-476.4,-7.52 +"397",396,20278,-478.2,-7.82 +"398",397,20361,-480,-8.11 +"399",398,20444,-479.8,-8.08 +"400",399,20528,-479.5,-8.03 +"401",400,20611,-479.6,-8.04 +"402",401,20694,-479.1,-7.96 +"403",402,20777,-478.6,-7.87 +"404",403,20859,-479,-7.94 +"405",404,20943,-480.1,-8.12 +"406",405,21026,-480,-8.1 +"407",406,21110,-479,-7.93 +"408",407,21192,-478.9,-7.91 +"409",408,21275,-478.9,-7.91 +"410",409,21358,-479.45,-8 +"411",410,21442,-480,-8.09 +"412",411,21525,-477.8,-7.73 +"413",412,21605,-475.6,-7.36 +"414",413,21686,-477.4,-7.66 +"415",414,21769,-480.9,-8.24 +"416",415,21854,-481.5,-8.33 +"417",416,21939,-480.2,-8.12 +"418",417,22023,-480.4,-8.15 +"419",418,22108,-482,-8.41 +"420",419,22196,-484.5,-8.82 +"421",420,22284,-484.5,-8.82 +"422",421,22371,-482.3,-8.45 +"423",422,22457,-481.4,-8.3 +"424",423,22543,-481.85,-8.37 +"425",424,22629,-482.3,-8.45 +"426",425,22716,-482.75,-8.52 +"427",426,22803,-483.2,-8.59 +"428",427,22888,-479.5,-7.97 +"429",428,22972,-479.2,-7.92 +"430",429,23057,-482.7,-8.5 +"431",430,23145,-484.5,-8.8 +"432",431,23234,-485.1,-8.89 +"433",432,23324,-485.8,-9.01 +"434",433,23412,-483,-8.54 +"435",434,23497,-478.3,-7.76 +"436",435,23581,-480.95,-8.2 +"437",436,23668,-483.6,-8.63 +"438",437,23755,-483.6,-8.63 +"439",438,23843,-483.6,-8.63 +"440",439,23931,-482.5,-8.44 +"441",440,24017,-481.4,-8.26 +"442",441,24102,-480,-8.03 +"443",442,24186,-479.1,-7.87 +"444",443,24272,-484,-8.68 +"445",444,24363,-488.3,-9.39 +"446",445,24453,-482.7,-8.46 +"447",446,24537,-477.1,-7.53 +"448",447,24619,-477,-7.51 +"449",448,24700,-477,-7.5 +"450",449,24781,-475.5,-7.25 +"451",450,24860,-474,-7 +"452",451,24941,-477.45,-7.57 +"453",452,25024,-480.9,-8.14 +"454",453,25109,-480,-7.98 +"455",454,25193,-479.1,-7.83 +"456",455,25277,-478.2,-7.68 +"457",456,25360,-479.5,-7.89 +"458",457,25445,-481.8,-8.27 +"459",458,25531,-481,-8.13 +"460",459,25615,-478.4,-7.7 +"461",460,25697,-474.5,-7.05 +"462",461,25776,-474.1,-6.98 +"463",462,25855,-475.8,-7.26 +"464",463,25936,-476,-7.29 +"465",464,26017,-477.1,-7.47 +"466",465,26099,-477.2,-7.48 +"467",466,26180,-475.3,-7.16 +"468",467,26261,-475.8,-7.24 +"469",468,26342,-477.7,-7.55 +"470",469,26425,-479.3,-7.82 +"471",470,26510,-480.7,-8.05 +"472",471,26595,-481,-8.09 +"473",472,26681,-481,-8.09 +"474",473,26766,-478.9,-7.74 +"475",474,26849,-477.8,-7.56 +"476",475,26933,-479.9,-7.9 +"477",476,27019,-484.4,-8.64 +"478",477,27110,-486.7,-9.02 +"479",478,27202,-486.7,-9.02 +"480",479,27293,-485.5,-8.82 +"481",480,27382,-484.3,-8.62 +"482",481,27470,-481.4,-8.14 +"483",482,27555,-479.6,-7.84 +"484",483,27641,-482.3,-8.28 +"485",484,27730,-484.6,-8.66 +"486",485,27819,-483.8,-8.52 +"487",486,27907,-482.3,-8.27 +"488",487,27993,-481.2,-8.09 +"489",488,28079,-480.1,-7.9 +"490",489,28163,-478.85,-7.69 +"491",490,28247,-477.6,-7.49 +"492",491,28331,-481.7,-8.16 +"493",492,28420,-485.7,-8.82 +"494",493,28510,-483.58,-8.47 +"495",494,28597,-481.47,-8.12 +"496",495,28683,-479.35,-7.77 +"497",496,28766,-477.23,-7.42 +"498",497,28848,-475.12,-7.07 +"499",498,28927,-473,-6.71 +"500",499,29006,-473,-6.71 +"501",500,29085,-474.62,-6.98 +"502",501,29166,-476.24,-7.25 +"503",502,29249,-477.86,-7.52 +"504",503,29332,-479.48,-7.79 +"505",504,29418,-481.1,-8.05 +"506",505,29505,-482.9,-8.35 +"507",506,29594,-483,-8.37 +"508",507,29682,-482.8,-8.33 +"509",508,29771,-484.3,-8.58 +"510",509,29861,-483.4,-8.43 +"511",510,29949,-482.6,-8.3 +"512",511,30036,-480.5,-7.95 +"513",512,30120,-475.6,-7.14 +"514",513,30201,-474.9,-7.02 +"515",514,30283,-478.5,-7.62 +"516",515,30368,-479.8,-7.83 +"517",516,30453,-479.3,-7.75 +"518",517,30538,-478.63,-7.64 +"519",518,30622,-477.95,-7.52 +"520",519,30705,-477.27,-7.41 +"521",520,30788,-476.6,-7.3 +"522",521,30871,-478.6,-7.63 +"523",522,30957,-480.5,-7.95 +"524",523,31043,-480.8,-8 +"525",524,31130,-481.1,-8.05 +"526",525,31216,-479.9,-7.85 +"527",526,31302,-478.7,-7.65 +"528",527,31387,-479.4,-7.77 +"529",528,31473,-481,-8.03 +"530",529,31560,-482,-8.2 +"531",530,31648,-480.4,-7.93 +"532",531,31733,-477.2,-7.4 +"533",532,31815,-475.6,-7.14 +"534",533,31896,-473.4,-6.77 +"535",534,31976,-473.2,-6.74 +"536",535,32056,-473.5,-6.79 +"537",536,32137,-475.3,-7.09 +"538",537,32219,-476.4,-7.27 +"539",538,32300,-472.4,-6.61 +"540",539,32380,-475.2,-7.07 +"541",540,32463,-477.7,-7.49 +"542",541,32546,-474.7,-6.99 +"543",542,32626,-472.5,-6.62 +"544",543,32705,-473,-6.71 +"545",544,32787,-477.6,-7.47 +"546",545,32871,-477.6,-7.47 +"547",546,32955,-476.5,-7.29 +"548",547,33039,-478.3,-7.59 +"549",548,33124,-478.4,-7.6 +"550",549,33209,-478.4,-7.6 +"551",550,33293,-476.8,-7.34 +"552",551,33376,-475.2,-7.07 +"553",552,33459,-477.4,-7.44 +"554",553,33544,-478,-7.54 +"555",554,33628,-476.6,-7.31 +"556",555,33711,-475.5,-7.12 +"557",556,33793,-475.8,-7.17 +"558",557,33877,-476.9,-7.36 +"559",558,33960,-475.8,-7.17 +"560",559,34041,-471.9,-6.53 +"561",560,34121,-474,-6.88 +"562",561,34202,-473.3,-6.76 +"563",562,34281,-470.2,-6.25 +"564",563,34360,-472.3,-6.59 +"565",564,34438,-469.2,-6.08 +"566",565,34515,-468.8,-6.01 +"567",566,34592,-469.6,-6.15 +"568",567,34669,-467.9,-5.87 +"569",568,34744,-466.9,-5.7 +"570",569,34818,-463.5,-5.14 +"571",570,34889,-461.6,-4.82 +"572",571,34960,-463,-5.05 +"573",572,35033,-465.8,-5.52 +"574",573,35108,-468.6,-5.98 +"575",574,35185,-468.1,-5.9 +"576",575,35261,-467.6,-5.82 +"577",576,35336,-465,-5.39 +"578",577,35409,-464.1,-5.24 +"579",578,35482,-464.9,-5.37 +"580",579,35556,-466,-5.55 +"581",580,35631,-466.6,-5.65 +"582",581,35705,-465.1,-5.41 +"583",582,35780,-466.4,-5.62 +"584",583,35855,-467,-5.72 +"585",584,35930,-467.3,-5.77 +"586",585,36007,-470,-6.22 +"587",586,36086,-471.1,-6.4 +"588",587,36166,-472.9,-6.7 +"589",588,36248,-474.9,-7.03 +"590",589,36331,-476,-7.22 +"591",590,36416,-478.9,-7.7 +"592",591,36502,-476.5,-7.3 +"593",592,36585,-472.7,-6.67 +"594",593,36666,-474.5,-6.97 +"595",594,36748,-472.6,-6.65 +"596",595,36827,-468.8,-6.02 +"597",596,36905,-470.6,-6.32 +"598",597,36985,-472.4,-6.62 +"599",598,37066,-473.25,-6.76 +"600",599,37148,-474.1,-6.9 +"601",600,37230,-474.1,-6.9 +"602",601,37313,-474.5,-6.97 +"603",602,37396,-475.9,-7.2 +"604",603,37479,-473.5,-6.8 +"605",604,37558,-468.5,-5.97 +"606",605,37637,-471,-6.38 +"607",606,37718,-474,-6.88 +"608",607,37799,-472.3,-6.6 +"609",608,37880,-471.4,-6.45 +"610",609,37959,-470.5,-6.3 +"611",610,38039,-471.3,-6.43 +"612",611,38120,-472.7,-6.66 +"613",612,38201,-473.5,-6.8 +"614",613,38284,-474.5,-6.96 +"615",614,38367,-475.3,-7.09 +"616",615,38451,-475.8,-7.18 +"617",616,38535,-475.8,-7.18 +"618",617,38619,-474.4,-6.94 +"619",618,38702,-473.1,-6.73 +"620",619,38783,-472.85,-6.69 +"621",620,38865,-472.6,-6.64 +"622",621,38946,-472.35,-6.6 +"623",622,39027,-472.1,-6.56 +"624",623,39107,-470,-6.21 +"625",624,39185,-468.3,-5.93 +"626",625,39263,-468.3,-5.93 +"627",626,39341,-469.7,-6.16 +"628",627,39420,-470.2,-6.24 +"629",628,39499,-470.2,-6.24 +"630",629,39579,-469.5,-6.13 +"631",630,39657,-469.5,-6.13 +"632",631,39735,-468.2,-5.91 +"633",632,39812,-465.6,-5.48 +"634",633,39889,-470.2,-6.24 +"635",634,39971,-474.5,-6.96 +"636",635,40054,-474.2,-6.91 +"637",636,40138,-476,-7.21 +"638",637,40223,-475.2,-7.07 +"639",638,40305,-470.6,-6.31 +"640",639,40386,-471.8,-6.51 +"641",640,40468,-474.2,-6.91 +"642",641,40551,-473,-6.71 +"643",642,40632,-472.1,-6.56 +"644",643,40714,-472.8,-6.67 +"645",644,40796,-471.5,-6.46 +"646",645,40875,-467.2,-5.74 +"647",646,40952,-467.2,-5.74 +"648",647,41031,-471,-6.37 +"649",648,41112,-472.3,-6.59 +"650",649,41191,-468.1,-5.89 +"651",650,41268,-463.9,-5.19 +"652",651,41342,-463.4,-5.11 +"653",652,41415,-462.9,-5.02 +"654",653,41489,-463.3,-5.09 +"655",654,41564,-465.7,-5.48 +"656",655,41638,-461.6,-4.8 +"657",656,41710,-460,-4.53 +"658",657,41782,-463.3,-5.08 +"659",658,41855,-461.7,-4.81 +"660",659,41927,-460.9,-4.68 +"661",660,42001,-464.5,-5.27 +"662",661,42077,-467,-5.69 +"663",662,42152,-462.8,-4.99 +"664",663,42225,-460.8,-4.65 +"665",664,42298,-464.7,-5.3 +"666",665,42374,-467.1,-5.7 +"667",666,42451,-465.3,-5.4 +"668",667,42527,-465.9,-5.49 +"669",668,42603,-465.5,-5.43 +"670",669,42679,-467.1,-5.69 +"671",670,42758,-469.8,-6.13 +"672",671,42837,-468.7,-5.95 +"673",672,42916,-468.3,-5.88 +"674",673,42994,-468.6,-5.93 +"675",674,43073,-467.8,-5.8 +"676",675,43150,-466.2,-5.53 +"677",676,43226,-466,-5.5 +"678",677,43304,-469.3,-6.04 +"679",678,43385,-471.8,-6.45 +"680",679,43464,-465.6,-5.42 +"681",680,43540,-465.9,-5.47 +"682",681,43619,-473.2,-6.68 +"683",682,43702,-472.7,-6.6 +"684",683,43785,-472,-6.48 +"685",684,43868,-474.8,-6.94 +"686",685,43952,-474.4,-6.88 +"687",686,44036,-473.5,-6.72 +"688",687,44120,-475.1,-6.99 +"689",688,44206,-476.8,-7.27 +"690",689,44292,-474.8,-6.94 +"691",690,44377,-475,-6.97 +"692",691,44463,-478.3,-7.51 +"693",692,44551,-476,-7.13 +"694",693,44634,-470.1,-6.15 +"695",694,44715,-472.5,-6.55 +"696",695,44800,-477.9,-7.44 +"697",696,44887,-475.5,-7.04 +"698",697,44972,-473.3,-6.68 +"699",698,45055,-473.6,-6.72 +"700",699,45139,-473.4,-6.69 +"701",700,45225,-477.7,-7.4 +"702",701,45315,-482.3,-8.16 +"703",702,45407,-480.8,-7.91 +"704",703,45497,-479.2,-7.64 +"705",704,45587,-481,-7.94 +"706",705,45677,-477.6,-7.38 +"707",706,45762,-472.6,-6.55 +"708",707,45846,-474.9,-6.93 +"709",708,45932,-475.4,-7.01 +"710",709,46018,-475.5,-7.02 +"711",710,46104,-477.7,-7.39 +"712",711,46193,-477.7,-7.38 +"713",712,46281,-478.2,-7.47 +"714",713,46370,-478.5,-7.51 +"715",714,46457,-476.3,-7.15 +"716",715,46543,-474.1,-6.78 +"717",716,46628,-474.8,-6.9 +"718",717,46713,-474.9,-6.91 +"719",718,46797,-472.3,-6.48 +"720",719,46881,-473.7,-6.71 +"721",720,46966,-475,-6.92 +"722",721,47050,-473.5,-6.67 +"723",722,47133,-471.2,-6.29 +"724",723,47214,-469,-5.92 +"725",724,47295,-470.5,-6.17 +"726",725,47378,-473.9,-6.73 +"727",726,47462,-472.8,-6.55 +"728",727,47546,-474.2,-6.78 +"729",728,47631,-475.5,-6.99 +"730",729,47716,-471.7,-6.36 +"731",730,47798,-471.2,-6.28 +"732",731,47881,-474,-6.74 +"733",732,47966,-474.7,-6.85 +"734",733,48050,-472.3,-6.46 +"735",734,48134,-473.5,-6.65 +"736",735,48218,-472.5,-6.49 +"737",736,48300,-469.7,-6.02 +"738",737,48381,-469.9,-6.05 +"739",738,48461,-468.4,-5.8 +"740",739,48541,-468.6,-5.83 +"741",740,48622,-471.2,-6.26 +"742",741,48704,-471.8,-6.36 +"743",742,48787,-472.5,-6.48 +"744",743,48870,-472,-6.39 +"745",744,48953,-471.1,-6.24 +"746",745,49034,-468.2,-5.76 +"747",746,49113,-468.3,-5.77 +"748",747,49193,-469,-5.89 +"749",748,49272,-466.7,-5.51 +"750",749,49350,-466.7,-5.51 +"751",750,49430,-469,-5.89 +"752",751,49510,-469.5,-5.97 +"753",752,49591,-470.1,-6.07 +"754",753,49672,-468.3,-5.78 +"755",754,49750,-465.4,-5.3 +"756",755,49828,-467.1,-5.58 +"757",756,49907,-467.2,-5.6 +"758",757,49985,-464.7,-5.18 +"759",758,50061,-463.8,-5.03 +"760",759,50138,-466.3,-5.45 +"761",760,50217,-467.8,-5.7 +"762",761,50295,-465.8,-5.37 +"763",762,50374,-466.8,-5.54 +"764",763,50452,-466.8,-5.54 +"765",764,50531,-467.5,-5.65 +"766",765,50610,-467,-5.57 +"767",766,50688,-464.7,-5.19 +"768",767,50766,-467.9,-5.72 +"769",768,50847,-470,-6.07 +"770",769,50928,-468.9,-5.89 +"771",770,51009,-468,-5.74 +"772",771,51086,-463,-4.91 +"773",772,51159,-456.1,-3.77 +"774",773,51230,-459.5,-4.34 +"775",774,51306,-465.8,-5.38 +"776",775,51384,-467.1,-5.6 +"777",776,51465,-470.8,-6.21 +"778",777,51549,-473.1,-6.6 +"779",778,51633,-472.1,-6.43 +"780",779,51715,-466.3,-5.47 +"781",780,51794,-467,-5.59 +"782",781,51874,-469.6,-6.02 +"783",782,51955,-466.8,-5.56 +"784",783,52034,-466.8,-5.56 +"785",784,52114,-468.3,-5.81 +"786",785,52195,-468.5,-5.84 +"787",786,52275,-466.7,-5.55 +"788",787,52352,-463.6,-5.03 +"789",788,52430,-467,-5.6 +"790",789,52511,-470.2,-6.13 +"791",790,52594,-470.8,-6.23 +"792",791,52679,-473.7,-6.71 +"793",792,52763,-470.3,-6.15 +"794",793,52846,-470,-6.1 +"795",794,52931,-475,-6.93 +"796",795,53019,-476.5,-7.18 +"797",796,53107,-475.8,-7.07 +"798",797,53193,-471.5,-6.36 +"799",798,53275,-467.2,-5.65 +"800",799,53355,-466.6,-5.55 +"801",800,53436,-469.6,-6.05 +"802",801,53520,-473.2,-6.65 +"803",802,53606,-473.2,-6.65 +"804",803,53692,-472.6,-6.55 +"805",804,53775,-469.5,-6.04 +"806",805,53858,-470.6,-6.22 +"807",806,53942,-472.2,-6.49 +"808",807,54026,-470.1,-6.14 +"809",808,54111,-472.85,-6.6 +"810",809,54198,-475.6,-7.06 +"811",810,54286,-475,-6.96 +"812",811,54372,-471.6,-6.4 +"813",812,54457,-472.4,-6.53 +"814",813,54544,-474,-6.8 +"815",814,54629,-470.2,-6.17 +"816",815,54713,-471.3,-6.35 +"817",816,54797,-470.9,-6.29 +"818",817,54881,-471.3,-6.36 +"819",818,54967,-473.4,-6.71 +"820",819,55052,-471,-6.31 +"821",820,55136,-470.1,-6.16 +"822",821,55218,-466.6,-5.58 +"823",822,55297,-465.1,-5.34 +"824",823,55377,-467,-5.65 +"825",824,55457,-465.6,-5.42 +"826",825,55536,-464.3,-5.21 +"827",826,55615,-465.6,-5.43 +"828",827,55694,-466.3,-5.54 +"829",828,55775,-467.9,-5.81 +"830",829,55855,-464.4,-5.23 +"831",830,55933,-461.8,-4.8 +"832",831,56009,-463.5,-5.09 +"833",832,56087,-462.7,-4.95 +"834",833,56163,-461.2,-4.71 +"835",834,56239,-462.5,-4.92 +"836",835,56317,-463.6,-5.11 +"837",836,56394,-461.5,-4.76 +"838",837,56471,-463.5,-5.09 +"839",838,56548,-463.5,-5.1 +"840",839,56624,-459,-4.35 +"841",840,56698,-459.4,-4.42 +"842",841,56774,-462.2,-4.88 +"843",842,56850,-459.7,-4.47 +"844",843,56922,-455.1,-3.71 +"845",844,56993,-454.9,-3.68 +"846",845,57065,-457.9,-4.18 +"847",846,57139,-460.1,-4.54 +"848",847,57215,-461.2,-4.73 +"849",848,57289,-456.9,-4.01 +"850",849,57362,-457.1,-4.05 +"851",850,57436,-461.9,-4.85 +"852",851,57513,-461.9,-4.85 +"853",852,57590,-462,-4.86 +"854",853,57669,-467.5,-5.78 +"855",854,57750,-465.9,-5.51 +"856",855,57828,-460.7,-4.65 +"857",856,57905,-462.7,-4.98 +"858",857,57981,-460.7,-4.65 +"859",858,58057,-460.5,-4.62 +"860",859,58133,-462.2,-4.9 +"861",860,58211,-462.6,-4.96 +"862",861,58286,-458.4,-4.27 +"863",862,58360,-458.1,-4.22 +"864",863,58436,-462.4,-4.93 +"865",864,58514,-464.1,-5.21 +"866",865,58594,-466.8,-5.66 +"867",866,58676,-468,-5.86 +"868",867,58759,-469.2,-6.06 +"869",868,58842,-468.4,-5.93 +"870",869,58925,-467.9,-5.85 +"871",870,59008,-469.1,-6.04 +"872",871,59093,-471.3,-6.41 +"873",872,59178,-470.7,-6.31 +"874",873,59262,-468,-5.86 +"875",874,59345,-467.9,-5.85 +"876",875,59428,-469,-6.03 +"877",876,59511,-468,-5.86 +"878",877,59593,-466,-5.53 +"879",878,59674,-466,-5.53 +"880",879,59755,-466,-5.53 +"881",880,59836,-467.7,-5.81 +"882",881,59921,-471.8,-6.49 +"883",882,60007,-472,-6.53 +"884",883,60093,-469.7,-6.15 +"885",884,60177,-469.5,-6.11 +"886",885,60262,-470,-6.2 +"887",886,60348,-471.5,-6.45 +"888",887,60433,-470.6,-6.3 +"889",888,60519,-470.5,-6.28 +"890",889,60605,-472,-6.53 +"891",890,60692,-472.3,-6.58 +"892",891,60779,-472.5,-6.61 +"893",892,60869,-476.7,-7.31 +"894",893,60961,-477.7,-7.48 +"895",894,61052,-474.7,-6.98 +"896",895,61141,-473.7,-6.81 +"897",896,61229,-472,-6.53 +"898",897,61317,-474.1,-6.88 +"899",898,61406,-474,-6.86 +"900",899,61496,-474.8,-7 +"901",900,61586,-476.4,-7.26 +"902",901,61677,-474,-6.86 +"903",902,61765,-471.8,-6.5 +"904",903,61852,-472.4,-6.6 +"905",904,61941,-474.8,-7 +"906",905,62031,-475.4,-7.1 +"907",906,62121,-475.1,-7.05 +"908",907,62213,-477.5,-7.44 +"909",908,62307,-479.2,-7.72 +"910",909,62401,-478.7,-7.64 +"911",910,62497,-481.4,-8.09 +"912",911,62594,-481,-8.02 +"913",912,62689,-478.9,-7.67 +"914",913,62783,-478.1,-7.54 +"915",914,62877,-477.9,-7.51 +"916",915,62970,-477.9,-7.51 +"917",916,63064,-477.9,-7.51 +"918",917,63157,-477.9,-7.51 +"919",918,63249,-475.5,-7.11 +"920",919,63338,-471.4,-6.43 +"921",920,63424,-470.4,-6.26 +"922",921,63512,-473.9,-6.84 +"923",922,63600,-472.8,-6.66 +"924",923,63688,-471.3,-6.41 +"925",924,63776,-473.8,-6.83 +"926",925,63865,-473.8,-6.82 +"927",926,63954,-473.6,-6.79 +"928",927,64043,-474.5,-6.94 +"929",928,64134,-476.5,-7.27 +"930",929,64228,-479.1,-7.7 +"931",930,64322,-478.2,-7.55 +"932",931,64416,-477.3,-7.4 +"933",932,64510,-480.4,-7.91 +"934",933,64605,-477.5,-7.43 +"935",934,64698,-477.9,-7.49 +"936",935,64793,-480.8,-7.97 +"937",936,64890,-480.5,-7.92 +"938",937,64987,-482,-8.17 +"939",938,65085,-480.9,-7.98 +"940",939,65182,-480.7,-7.95 +"941",940,65278,-479.6,-7.76 +"942",941,65371,-476.5,-7.25 +"943",942,65464,-478,-7.49 +"944",943,65559,-479.3,-7.71 +"945",944,65655,-482,-8.15 +"946",945,65756,-486.2,-8.85 +"947",946,65855,-479.6,-7.75 +"948",947,65949,-477.5,-7.4 +"949",948,66045,-482.4,-8.21 +"950",949,66144,-483,-8.31 +"951",950,66243,-481.5,-8.06 +"952",951,66338,-477.1,-7.33 +"953",952,66429,-474.4,-6.88 +"954",953,66520,-475.6,-7.07 +"955",954,66613,-479.6,-7.73 +"956",955,66708,-479.8,-7.76 +"957",956,66803,-478.5,-7.54 +"958",957,66898,-479.7,-7.73 +"959",958,66992,-478,-7.44 +"960",959,67085,-476.7,-7.22 +"961",960,67178,-478.2,-7.47 +"962",961,67272,-479.2,-7.63 +"963",962,67367,-478.6,-7.52 +"964",963,67462,-480.3,-7.8 +"965",964,67557,-479.8,-7.71 +"966",965,67653,-480.7,-7.86 +"967",966,67750,-482.5,-8.15 +"968",967,67848,-481.9,-8.04 +"969",968,67945,-481,-7.89 +"970",969,68041,-479,-7.55 +"971",970,68136,-480.5,-7.8 +"972",971,68233,-483.4,-8.27 +"973",972,68330,-479.7,-7.65 +"974",973,68424,-478.5,-7.45 +"975",974,68520,-481.9,-8.01 +"976",975,68617,-481.5,-7.94 +"977",976,68715,-483.1,-8.2 +"978",977,68811,-479.5,-7.59 +"979",978,68902,-472.1,-6.36 +"980",979,68987,-468.8,-5.81 +"981",980,69071,-470.7,-6.12 +"982",981,69155,-467.7,-5.62 +"983",982,69238,-468.5,-5.75 +"984",983,69324,-474.2,-6.69 +"985",984,69413,-475.6,-6.92 +"986",985,69506,-479.4,-7.54 +"987",986,69599,-478.1,-7.33 +"988",987,69691,-476,-6.97 +"989",988,69780,-473.5,-6.55 +"990",989,69869,-474.7,-6.75 +"991",990,69959,-478.1,-7.31 +"992",991,70054,-481.3,-7.84 +"993",992,70149,-480.6,-7.72 +"994",993,70243,-476.6,-7.05 +"995",994,70334,-476.8,-7.08 +"996",995,70425,-477.9,-7.26 +"997",996,70515,-473.5,-6.52 +"998",997,70600,-468.4,-5.67 +"999",998,70683,-468.4,-5.67 +"1000",999,70766,-468.4,-5.67 +"1001",1000,70848,-468.4,-5.66 +"1002",1001,70931,-468.4,-5.66 +"1003",1002,71013,-468.7,-5.7 +"1004",1003,71096,-469,-5.75 +"1005",1004,71180,-470.1,-5.93 +"1006",1005,71264,-470.5,-5.99 +"1007",1006,71347,-467.2,-5.44 +"1008",1007,71427,-465.5,-5.15 +"1009",1008,71506,-462.2,-4.6 +"1010",1009,71584,-466.4,-5.3 +"1011",1010,71664,-465.8,-5.2 +"1012",1011,71743,-463.5,-4.81 +"1013",1012,71822,-466.8,-5.36 +"1014",1013,71905,-471.5,-6.13 +"1015",1014,71989,-468,-5.55 +"1016",1015,72070,-467,-5.38 +"1017",1016,72152,-468.9,-5.69 +"1018",1017,72235,-469.6,-5.81 +"1019",1018,72318,-469.7,-5.82 +"1020",1019,72403,-472.5,-6.28 +"1021",1020,72489,-474,-6.53 +"1022",1021,72578,-476.2,-6.89 +"1023",1022,72666,-473.2,-6.39 +"1024",1023,72753,-474.7,-6.64 +"1025",1024,72840,-470.7,-5.97 +"1026",1025,72922,-466.6,-5.29 +"1027",1026,73003,-469.5,-5.77 +"1028",1027,73087,-470.9,-6 +"1029",1028,73172,-472.8,-6.31 +"1030",1029,73258,-473.6,-6.44 +"1031",1030,73347,-477.6,-7.1 +"1032",1031,73440,-481.9,-7.81 +"1033",1032,73533,-476.8,-6.96 +"1034",1033,73620,-471.6,-6.1 +"1035",1034,73706,-474.7,-6.61 +"1036",1035,73795,-477.8,-7.12 +"1037",1036,73885,-476.2,-6.85 +"1038",1037,73973,-473.8,-6.45 +"1039",1038,74060,-474.5,-6.56 +"1040",1039,74150,-478.2,-7.17 +"1041",1040,74238,-473,-6.31 +"1042",1041,74322,-470.6,-5.91 +"1043",1042,74405,-468.9,-5.62 +"1044",1043,74484,-463.6,-4.74 +"1045",1044,74565,-471.4,-6.03 +"1046",1045,74651,-476.8,-6.92 +"1047",1046,74738,-470.5,-5.87 +"1048",1047,74821,-470.4,-5.85 +"1049",1048,74903,-469.4,-5.68 +"1050",1049,74985,-469,-5.61 +"1051",1050,75066,-467.8,-5.41 +"1052",1051,75147,-469.7,-5.72 +"1053",1052,75229,-467.9,-5.42 +"1054",1053,75308,-466.1,-5.12 +"1055",1054,75388,-467.3,-5.32 +"1056",1055,75468,-467.9,-5.41 +"1057",1056,75547,-466.2,-5.13 +"1058",1057,75625,-463.4,-4.66 +"1059",1058,75701,-462.6,-4.53 +"1060",1059,75776,-461.8,-4.39 +"1061",1060,75850,-461.6,-4.35 +"1062",1061,75928,-468,-5.41 +"1063",1062,76007,-465.5,-5 +"1064",1063,76084,-464.5,-4.83 +"1065",1064,76162,-466.9,-5.23 +"1066",1065,76239,-461.7,-4.37 +"1067",1066,76313,-459.8,-4.05 +"1068",1067,76388,-464.3,-4.8 +"1069",1068,76465,-466,-5.08 +"1070",1069,76543,-466.5,-5.16 +"1071",1070,76622,-466.9,-5.22 +"1072",1071,76700,-465.1,-4.92 +"1073",1072,76777,-463.6,-4.67 +"1074",1073,76854,-466.1,-5.09 +"1075",1074,76933,-468.6,-5.5 +"1076",1075,77014,-468.4,-5.47 +"1077",1076,77094,-468.1,-5.42 +"1078",1077,77175,-471,-5.9 +"1079",1078,77259,-473.6,-6.33 +"1080",1079,77345,-475.9,-6.71 +"1081",1080,77433,-478.5,-7.14 +"1082",1081,77521,-475.2,-6.59 +"1083",1082,77606,-470.5,-5.81 +"1084",1083,77687,-470.2,-5.76 +"1085",1084,77769,-470.5,-5.81 +"1086",1085,77853,-474.4,-6.45 +"1087",1086,77938,-474.8,-6.52 +"1088",1087,78025,-475.4,-6.62 +"1089",1088,78113,-479.4,-7.28 +"1090",1089,78200,-472,-6.06 +"1091",1090,78277,-458.5,-3.82 +"1092",1091,78353,-469.9,-5.71 +"1093",1092,78437,-476.4,-6.79 +"1094",1093,78522,-472.4,-6.12 +"1095",1094,78606,-473.6,-6.32 +"1096",1095,78690,-472,-6.06 +"1097",1096,78772,-470.3,-5.78 +"1098",1097,78854,-470.9,-5.87 +"1099",1098,78937,-473.1,-6.24 +"1100",1099,79020,-471.1,-5.91 +"1101",1100,79098,-464.4,-4.8 +"1102",1101,79174,-464.4,-4.8 +"1103",1102,79251,-465.6,-5 +"1104",1103,79327,-464.2,-4.76 +"1105",1104,79402,-461.6,-4.33 +"1106",1105,79478,-468.2,-5.43 +"1107",1106,79557,-468.6,-5.5 +"1108",1107,79636,-467,-5.23 +"1109",1108,79714,-465.2,-4.93 +"1110",1109,79791,-467.3,-5.28 +"1111",1110,79870,-468.1,-5.41 +"1112",1111,79947,-465.3,-4.95 +"1113",1112,80020,-457.5,-3.66 +"1114",1113,80093,-464.8,-4.87 +"1115",1114,80173,-473.9,-6.38 +"1116",1115,80257,-472.3,-6.11 +"1117",1116,80341,-474,-6.39 +"1118",1117,80422,-468.1,-5.41 +"1119",1118,80498,-462.3,-4.45 +"1120",1119,80572,-461.1,-4.25 +"1121",1120,80645,-462,-4.4 +"1122",1121,80719,-464.1,-4.75 +"1123",1122,80794,-464.1,-4.75 +"1124",1123,80869,-462.6,-4.5 +"1125",1124,80943,-463.6,-4.67 +"1126",1125,81019,-465.2,-4.93 +"1127",1126,81096,-466.8,-5.2 +"1128",1127,81170,-459.8,-4.04 +"1129",1128,81240,-455.3,-3.29 +"1130",1129,81309,-458.8,-3.87 +"1131",1130,81381,-462.3,-4.45 +"1132",1131,81453,-458.9,-3.89 +"1133",1132,81523,-455.5,-3.33 +"1134",1133,81592,-458.3,-3.79 +"1135",1134,81662,-458.3,-3.79 +"1136",1135,81732,-458.4,-3.81 +"1137",1136,81802,-458,-3.74 +"1138",1137,81872,-457.9,-3.73 +"1139",1138,81942,-458.5,-3.83 +"1140",1139,82012,-456.4,-3.48 +"1141",1140,82080,-456.9,-3.56 +"1142",1141,82148,-453.6,-3.01 +"1143",1142,82213,-450.7,-2.54 +"1144",1143,82280,-457.4,-3.65 +"1145",1144,82352,-464.6,-4.85 +"1146",1145,82427,-463,-4.59 +"1147",1146,82500,-461.3,-4.31 +"1148",1147,82573,-462.6,-4.53 +"1149",1148,82647,-463.9,-4.75 +"1150",1149,82721,-461,-4.27 +"1151",1150,82792,-458,-3.78 +"1152",1151,82860,-453.9,-3.1 +"1153",1152,82925,-449.8,-2.42 +"1154",1153,82990,-453.1,-2.98 +"1155",1154,83055,-450.7,-2.58 +"1156",1155,83121,-456,-3.46 +"1157",1156,83190,-458.7,-3.92 +"1158",1157,83261,-458.8,-3.94 +"1159",1158,83331,-458.8,-3.94 +"1160",1159,83401,... [truncated message content] |
From: <be...@us...> - 2012-05-25 14:49:59
|
Revision: 10521 http://octave.svn.sourceforge.net/octave/?rev=10521&view=rev Author: benjf5 Date: 2012-05-25 14:49:45 +0000 (Fri, 25 May 2012) Log Message: ----------- Fixed lssa filenames, blatant error in lsreal. Added Paths: ----------- trunk/octave-forge/extra/lssa/lscorrcoeff.m trunk/octave-forge/extra/lssa/lsreal.m trunk/octave-forge/extra/lssa/lswaveletcoeff.m Removed Paths: ------------- trunk/octave-forge/extra/lssa/nucorrcoeff.m trunk/octave-forge/extra/lssa/nureal.m trunk/octave-forge/extra/lssa/nuwaveletcoeff.m Copied: trunk/octave-forge/extra/lssa/lscorrcoeff.m (from rev 10520, trunk/octave-forge/extra/lssa/nucorrcoeff.m) =================================================================== --- trunk/octave-forge/extra/lssa/lscorrcoeff.m (rev 0) +++ trunk/octave-forge/extra/lssa/lscorrcoeff.m 2012-05-25 14:49:45 UTC (rev 10521) @@ -0,0 +1,67 @@ +## 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 3 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 -*- +## @deftypefn {Function File} {c =} nucorrcoeff (abc1, ord1, abc2, ord2, time, freq) +## @deftypefnx {Function File} {c =} nucorrcoeff (abc1, ord1, abc2, ord2, time, freq, window) +## @deftypefnx {Function File} {c =} nucorrcoeff (abc1, ord1, abc2, ord2, time, freq, window, winradius) +## +## Return the coefficient of the wavelet correlation of time +## series (@var{abc1}, @var{ord1}) and (@var{abc2}, @var{ord2}). +## @var{window} is used to apply a windowing function, its +## default is cubicwgt if left blank, and its radius is 1, +## as defined as the default for @var{winradius}. +## +## @end deftypefn + +## Demo with sin, cos as Nir suggested. +%!demo +%! x = 1:10; +%! y = sin(x); +%! z = cos(x); +%! a = nucorrcoeff(x,y,x,z,0.5,0.9) +%! ## This generates the correlation coefficient at time 0.5 and circular freq. 0.9 + + +## nucorrcoeff, computes a coefficient of the wavelet correlation of two time series + +function coeff = nucorrcoeff(x1, y1, x2, y2, t, o, wgt = @cubicwgt, wgtrad = 1) + so = 0.05 * o; + ## This code can only, as of currently, work on vectors; I haven't figured out a way to make it work on a matrix. + if( ( ndims(x1) == 2 ) && ! ( rows(x1) == 1 ) ) + x1 = reshape(x1,1,length(x1)); + y1 = reshape(y1,1,length(y1)); + x2 = reshape(x2,1,length(x2)); + y2 = reshape(y2,1,length(y2)); + endif + ## The first solution that comes to mind is admittedly slightly ugly and has a data footprint of O(2n) + ## but it is vectorised. + mask = ( abs( x1 - t ) * so ) < wgtrad; + mask = mask .* [ 1 : length(mask) ]; + rx1 = x1(mask); ## I've kept the variable names from the R function here + ry1 = y1(mask); ## Needs to have a noisy error if length(y1) != length(x1) -- add this! + mask = ( abs( x2 - t ) * so ) < wgtrad; + mask = mask .* [ 1 : length(mask) ]; + rx2 = x2(mask); + ry2 = y2(mask); + ## I've used the same mask for all of these as it's an otherwise unimportant variable ... can this leak memory? + lnength(rx1) ##printing this length is probably used as a warning if 0 is returned; I inculded it + ## in particular to maintain an exact duplicate of the R function. + s = sum( wgt( ( rx1 - t ) .* so ) ) * sum( wgt( ( rx2 - t ) .* so ) ); + coeff = ifelse( s != 0 , ( sum( wgt( ( rx1 - t ) .* so ) .* exp( i .* o .* rx1 ) .* ry1 ) + * sum( wgt( ( rx2 - t ) .* so ) .* exp( i .* o .* rx2 ) .* ry2 ) ) / s, 0 ); + + +endfunction \ No newline at end of file Copied: trunk/octave-forge/extra/lssa/lsreal.m (from rev 10520, trunk/octave-forge/extra/lssa/nureal.m) =================================================================== --- trunk/octave-forge/extra/lssa/lsreal.m (rev 0) +++ trunk/octave-forge/extra/lssa/lsreal.m 2012-05-25 14:49:45 UTC (rev 10521) @@ -0,0 +1,60 @@ +## Copyright (C) 2012 Benjamin Lewis +## +## 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 -*- +## @deftypefn {Function File} {transform =} nureal ( time, mag, maxfreq, numcoeff, numoctaves) +## +## Return the real least-squares transform of the time series +## defined, based on the maximal frequency @var{maxfreq}, the +## number of coefficients @var{numcoeff}, and the number of +## octaves @var{numoctaves}. It works only for vectors currently. +## +## @end deftypefn + +function transform = nureal( t, x, omegamax, ncoeff, noctave) + ## the R function runs the following command: + ## nureal( double X, double Y, int min(X,Y), int ncoeff, int noctave, double omegamax, complex rp) + ## this means that in the C, *tptr is X and *xptr is Y. Yes, I know. I think I'll rename them. + ## n is the min of X and Y ... (as is k) and ncoeff is ... ncoeff, while noctave is noctave and + ## o is omegamax. + ## where rp = complex(noctave*ncoeff) so ... I can just store that as noctave*ncoeff and have no + ## problems, I guess. + ## Possibly throw an error if ncoeff <= 0. + k = n = min(length(x),length(t)); ## THIS IS VECTOR-ONLY. I'd need to add another bit of code to + ## make it array-safe, and that's not knowing right now what else will be necessary. + transform = zeros(1,(noctave * ncoeff)); ## In the C code, this is rendered as a Complex, but Octave doesn't care. + od = 2 ^ ( - 1 / ncoeff ); ## this will cause a crash if ncoeff=0; prefer error & quit? + o = omegamax; + ## ot is just defined as a Real here, I'm leaving it until it needs to be called. + n1 = 1 / n; ## written n_1 in the C, but I'd prefer to not get into underscores here. + ## zeta and iota are defined as Complex here, leaving them until they need to be defined. + ## I'm not convinced I won't want ncoeff again, so ... + ncoeffp = ncoeff; + ncoeffp *= noctave; + for iter = 1:ncoeffp + ## This method is an application of Eq. 8 on page 6 of the text, as well as Eq. 7 + ot = o .* t; + zeta = sum( ( cos(ot) .* x ) - ( sin(ot) .* x .* i ) ); + ot = ot .* 2; + iota = sum( cos(ot) - ( sin(ot) .* i ) ); + zeta = zeta .* n1; + iota = iota .* n1; + transform(iter) = 2 / ( 1 - ( real(iota) ^ 2 ) - ( imag(iota) ^ 2 ) ) * ( conj(zeta) - (conj(iota) * zeta )); + o = o .* od; + endfor + + ## transform = rp; + +endfunction \ No newline at end of file Copied: trunk/octave-forge/extra/lssa/lswaveletcoeff.m (from rev 10520, trunk/octave-forge/extra/lssa/nuwaveletcoeff.m) =================================================================== --- trunk/octave-forge/extra/lssa/lswaveletcoeff.m (rev 0) +++ trunk/octave-forge/extra/lssa/lswaveletcoeff.m 2012-05-25 14:49:45 UTC (rev 10521) @@ -0,0 +1,55 @@ +## 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 -*- +## @deftypefn {Function File} {c =} nuwaveletcoeff (abc, ord, time, freq) +## @deftypefnx {Function File} {c =} nuwaveletcoeff (abc, ord, time, freq, window) +## @deftypefnx {Function File} {c =} nuwaveletcoeff (abc, ord, time, freq, window, winradius) +## +## Return the coefficient of the wavelet transform of the +## time series (@var{abc}, @var{ord}) at time @var{time} +## and frequency @var{freq}; optional variable @var{window} +## provides a windowing function and defaults to cubicwgt, +## while @var{winradius} is the windowing radius, and defaults +## to 1 (the radius of cubicwgt.) +## +## @end deftypefn + +%!demo +%! x = 1:10; +%! y = sin(x); +%! xt = x'; +%! yt = y'; +%! a = nuwaveletcoeff(x,y,0.5,0.9) +%! b = nuwaveletcoeff(xt,yt,0.5,0.9) +%! ## Generates the wavelet transform coefficient for time 0.5 and circ. freq. 0.9, for row & column vectors. + + +function coeff = nuwaveletcoeff( x , y , t , o , wgt = @cubicwgt , wgtrad = 1 ) + so = 0.05 .* o; + if ( ( ndims(x) == 2 ) && ! ( rows(x) == 1 ) ) + x = reshape(x,1,length(x)); + y = reshape(y,1,length(y)); + endif + mask = abs( x - t ) * so < wgtrad; + mask = mask .* [ 1 : length(mask) ]; + rx = x(mask); + ## This was the fastest way to extract a matching subset that I could think of, but it has a complexity O(2n). + ry = y(mask); + ## Going by the R code, this can use the same mask. + s = sum( wgt( ( x - t ) .* so ) ); + coeff = ifelse( s != 0 , sum( wgt( ( rx - t ) .* so) .* exp( i .* o .* ( rx - t ) ) .* ry ) ./ s , 0 ); + +endfunction \ No newline at end of file Deleted: trunk/octave-forge/extra/lssa/nucorrcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/nucorrcoeff.m 2012-05-24 20:41:47 UTC (rev 10520) +++ trunk/octave-forge/extra/lssa/nucorrcoeff.m 2012-05-25 14:49:45 UTC (rev 10521) @@ -1,67 +0,0 @@ -## 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 3 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 -*- -## @deftypefn {Function File} {c =} nucorrcoeff (abc1, ord1, abc2, ord2, time, freq) -## @deftypefnx {Function File} {c =} nucorrcoeff (abc1, ord1, abc2, ord2, time, freq, window) -## @deftypefnx {Function File} {c =} nucorrcoeff (abc1, ord1, abc2, ord2, time, freq, window, winradius) -## -## Return the coefficient of the wavelet correlation of time -## series (@var{abc1}, @var{ord1}) and (@var{abc2}, @var{ord2}). -## @var{window} is used to apply a windowing function, its -## default is cubicwgt if left blank, and its radius is 1, -## as defined as the default for @var{winradius}. -## -## @end deftypefn - -## Demo with sin, cos as Nir suggested. -%!demo -%! x = 1:10; -%! y = sin(x); -%! z = cos(x); -%! a = nucorrcoeff(x,y,x,z,0.5,0.9) -%! ## This generates the correlation coefficient at time 0.5 and circular freq. 0.9 - - -## nucorrcoeff, computes a coefficient of the wavelet correlation of two time series - -function coeff = nucorrcoeff(x1, y1, x2, y2, t, o, wgt = @cubicwgt, wgtrad = 1) - so = 0.05 * o; - ## This code can only, as of currently, work on vectors; I haven't figured out a way to make it work on a matrix. - if( ( ndims(x1) == 2 ) && ! ( rows(x1) == 1 ) ) - x1 = reshape(x1,1,length(x1)); - y1 = reshape(y1,1,length(y1)); - x2 = reshape(x2,1,length(x2)); - y2 = reshape(y2,1,length(y2)); - endif - ## The first solution that comes to mind is admittedly slightly ugly and has a data footprint of O(2n) - ## but it is vectorised. - mask = ( abs( x1 - t ) * so ) < wgtrad; - mask = mask .* [ 1 : length(mask) ]; - rx1 = x1(mask); ## I've kept the variable names from the R function here - ry1 = y1(mask); ## Needs to have a noisy error if length(y1) != length(x1) -- add this! - mask = ( abs( x2 - t ) * so ) < wgtrad; - mask = mask .* [ 1 : length(mask) ]; - rx2 = x2(mask); - ry2 = y2(mask); - ## I've used the same mask for all of these as it's an otherwise unimportant variable ... can this leak memory? - lnength(rx1) ##printing this length is probably used as a warning if 0 is returned; I inculded it - ## in particular to maintain an exact duplicate of the R function. - s = sum( wgt( ( rx1 - t ) .* so ) ) * sum( wgt( ( rx2 - t ) .* so ) ); - coeff = ifelse( s != 0 , ( sum( wgt( ( rx1 - t ) .* so ) .* exp( i .* o .* rx1 ) .* ry1 ) - * sum( wgt( ( rx2 - t ) .* so ) .* exp( i .* o .* rx2 ) .* ry2 ) ) / s, 0 ); - - -endfunction \ No newline at end of file Deleted: trunk/octave-forge/extra/lssa/nureal.m =================================================================== --- trunk/octave-forge/extra/lssa/nureal.m 2012-05-24 20:41:47 UTC (rev 10520) +++ trunk/octave-forge/extra/lssa/nureal.m 2012-05-25 14:49:45 UTC (rev 10521) @@ -1,72 +0,0 @@ -## Copyright (C) 2012 Benjamin Lewis -## -## 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 -*- -## @deftypefn {Function File} {transform =} nureal ( mag, time, maxfreq, numcoeff, numoctaves) -## -## Return the real least-squares transform of the time series -## defined, based on the maximal frequency @var{maxfreq}, the -## number of coefficients @var{numcoeff}, and the number of -## octaves @var{numoctaves}. It works only for vectors currently. -## -## @end deftypefn - -function transform = nureal( x, t, omegamax, ncoeff, noctave) - ## the R function runs the following command: - ## nureal( double X, double Y, int min(X,Y), int ncoeff, int noctave, double omegamax, complex rp) - ## this means that in the C, *tptr is X and *xptr is Y. Yes, I know. I think I'll rename them. - ## n is the min of X and Y ... (as is k) and ncoeff is ... ncoeff, while noctave is noctave and - ## o is omegamax. - ## where rp = complex(noctave*ncoeff) so ... I can just store that as noctave*ncoeff and have no - ## problems, I guess. - ## Possibly throw an error if ncoeff <= 0. - k = n = min ( min ( x , t ) ); ## THIS IS VECTOR-ONLY. I'd need to add another bit of code to - ## make it array-safe, and that's not knowing right now what else will be necessary. - rp = zeros(1,(noctave * ncoeff)); ## In the C code, this is rendered as a Complex, but Octave doesn't care. - od = 2 ^ ( - 1 / ncoeff ); ## this will cause a crash if ncoeff=0; prefer error & quit? - o = omegamax; - ## ot is just defined as a Real here, I'm leaving it until it needs to be called. - n1 = 1 / n; ## written n_1 in the C, but I'd prefer to not get into underscores here. - ## zeta and iota are defined as Complex here, leaving them until they need to be defined. - ## I'm not convinced I won't want ncoeff again, so ... - ncoeffp = ncoeff; - for ( ncoeffp *= noctave , iter = 1 ; sign(ncoeffp--) ; o *= od ) - #{ - zeta = iota = 0; - for ( SRCFIRST ; SRCAVAIL ; SRCNEXT ) ##This is going to be vectorised shortly. - ## This code can't run yet ... I'm going to work out what SRCFIRST, SRCAVAIL, SRCNEXT are and - ## replace them with what they should be in this context. I've kept them as reminders. - ot = o * SRCT; ## Same with SRCT ... I think it means what was originally set as Y. Macros? - zeta += cos(ot) * SRCX; - zeta -= sin(ot) * SRCX * i; ## More sure now. I don't think I can vectorise this ... who am I kidding? - ot *= 2; - iota += cos(ot); - iota -= sin(ot) * i; - endfor - }# - ## Commented out the converted-from-C code because it's replaced by the four lines below. - ## This method is an application of Eq. 8 on page 6 of the text, as well as Eq. 7 - ot = o .* t; - zeta = sum( ( cos(ot) .* x ) - ( sin(ot) .* x .* i ) ); - ot = ot .* 2; - iota = sum( cos(ot) - ( sin(ot) .* i ) ); - zeta *= n1; - iota *= n1; - rp(iter++) = 2 / ( 1 - ( real(iota) ^ 2 ) - ( imag(iota) ^ 2 ) ) * ( conj(zeta) - (conj(iota) * zeta )); - endfor - - transform = rp; - -endfunction \ No newline at end of file Deleted: trunk/octave-forge/extra/lssa/nuwaveletcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/nuwaveletcoeff.m 2012-05-24 20:41:47 UTC (rev 10520) +++ trunk/octave-forge/extra/lssa/nuwaveletcoeff.m 2012-05-25 14:49:45 UTC (rev 10521) @@ -1,55 +0,0 @@ -## 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 -*- -## @deftypefn {Function File} {c =} nuwaveletcoeff (abc, ord, time, freq) -## @deftypefnx {Function File} {c =} nuwaveletcoeff (abc, ord, time, freq, window) -## @deftypefnx {Function File} {c =} nuwaveletcoeff (abc, ord, time, freq, window, winradius) -## -## Return the coefficient of the wavelet transform of the -## time series (@var{abc}, @var{ord}) at time @var{time} -## and frequency @var{freq}; optional variable @var{window} -## provides a windowing function and defaults to cubicwgt, -## while @var{winradius} is the windowing radius, and defaults -## to 1 (the radius of cubicwgt.) -## -## @end deftypefn - -%!demo -%! x = 1:10; -%! y = sin(x); -%! xt = x'; -%! yt = y'; -%! a = nuwaveletcoeff(x,y,0.5,0.9) -%! b = nuwaveletcoeff(xt,yt,0.5,0.9) -%! ## Generates the wavelet transform coefficient for time 0.5 and circ. freq. 0.9, for row & column vectors. - - -function coeff = nuwaveletcoeff( x , y , t , o , wgt = @cubicwgt , wgtrad = 1 ) - so = 0.05 .* o; - if ( ( ndims(x) == 2 ) && ! ( rows(x) == 1 ) ) - x = reshape(x,1,length(x)); - y = reshape(y,1,length(y)); - endif - mask = abs( x - t ) * so < wgtrad; - mask = mask .* [ 1 : length(mask) ]; - rx = x(mask); - ## This was the fastest way to extract a matching subset that I could think of, but it has a complexity O(2n). - ry = y(mask); - ## Going by the R code, this can use the same mask. - s = sum( wgt( ( x - t ) .* so ) ); - coeff = ifelse( s != 0 , sum( wgt( ( rx - t ) .* so) .* exp( i .* o .* ( rx - t ) ) .* ry ) ./ s , 0 ); - -endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <be...@us...> - 2012-05-26 01:07:14
|
Revision: 10523 http://octave.svn.sourceforge.net/octave/?rev=10523&view=rev Author: benjf5 Date: 2012-05-26 01:07:07 +0000 (Sat, 26 May 2012) Log Message: ----------- Written complex function, updated others for lssa. Modified Paths: -------------- trunk/octave-forge/extra/lssa/lscorrcoeff.m trunk/octave-forge/extra/lssa/lsreal.m trunk/octave-forge/extra/lssa/lswaveletcoeff.m Added Paths: ----------- trunk/octave-forge/extra/lssa/lscomplex.m Added: trunk/octave-forge/extra/lssa/lscomplex.m =================================================================== --- trunk/octave-forge/extra/lssa/lscomplex.m (rev 0) +++ trunk/octave-forge/extra/lssa/lscomplex.m 2012-05-26 01:07:07 UTC (rev 10523) @@ -0,0 +1,39 @@ +## 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 -*- +## @deftypefn {Function File} {t =} lscomplex ( time, mag, maxfreq, numcoeff, numoctaves) +## +## Return the complex least-squares transform of the (@var{time},@var{mag}) +## series, considering frequencies up to @var{maxfreq}, over @var{numoctaves} +## octaves and @var{numcoeff} coefficients. +## +## @end deftypefn + + +function transform = lscomplex( t , x , omegamax , ncoeff , noctave ) + n = length(t); ## VECTOR ONLY, and since t and x have the same number of entries, there's no problem. + n1 = 1 / n; + transform = zeros(1,ncoeff*noctave); + o = omegamax; + omul = 2 ^ ( - 1 / ncoeff ); + for iter = 1:ncoeff*noctave + ot = o .* t; + transform(iter) = sum( ( cos(ot) .- ( sin(ot) .* i ) ) .* x ); ## See the paper for the expression + o *= omul; ## To advance the transform to the next coefficient in the octave + endfor + transform .* n1; + +endfunction \ No newline at end of file Modified: trunk/octave-forge/extra/lssa/lscorrcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/lscorrcoeff.m 2012-05-25 23:14:13 UTC (rev 10522) +++ trunk/octave-forge/extra/lssa/lscorrcoeff.m 2012-05-26 01:07:07 UTC (rev 10523) @@ -14,9 +14,9 @@ ## this program; if not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {c =} nucorrcoeff (abc1, ord1, abc2, ord2, time, freq) -## @deftypefnx {Function File} {c =} nucorrcoeff (abc1, ord1, abc2, ord2, time, freq, window) -## @deftypefnx {Function File} {c =} nucorrcoeff (abc1, ord1, abc2, ord2, time, freq, window, winradius) +## @deftypefn {Function File} {c =} lscorrcoeff (abc1, ord1, abc2, ord2, time, freq) +## @deftypefnx {Function File} {c =} lscorrcoeff (abc1, ord1, abc2, ord2, time, freq, window) +## @deftypefnx {Function File} {c =} lscorrcoeff (abc1, ord1, abc2, ord2, time, freq, window, winradius) ## ## Return the coefficient of the wavelet correlation of time ## series (@var{abc1}, @var{ord1}) and (@var{abc2}, @var{ord2}). @@ -31,13 +31,13 @@ %! x = 1:10; %! y = sin(x); %! z = cos(x); -%! a = nucorrcoeff(x,y,x,z,0.5,0.9) +%! a = lscorrcoeff(x,y,x,z,0.5,0.9) %! ## This generates the correlation coefficient at time 0.5 and circular freq. 0.9 ## nucorrcoeff, computes a coefficient of the wavelet correlation of two time series -function coeff = nucorrcoeff(x1, y1, x2, y2, t, o, wgt = @cubicwgt, wgtrad = 1) +function coeff = lscorrcoeff(x1, y1, x2, y2, t, o, wgt = @cubicwgt, wgtrad = 1) so = 0.05 * o; ## This code can only, as of currently, work on vectors; I haven't figured out a way to make it work on a matrix. if( ( ndims(x1) == 2 ) && ! ( rows(x1) == 1 ) ) Modified: trunk/octave-forge/extra/lssa/lsreal.m =================================================================== --- trunk/octave-forge/extra/lssa/lsreal.m 2012-05-25 23:14:13 UTC (rev 10522) +++ trunk/octave-forge/extra/lssa/lsreal.m 2012-05-26 01:07:07 UTC (rev 10523) @@ -23,7 +23,7 @@ ## ## @end deftypefn -function transform = nureal( t, x, omegamax, ncoeff, noctave) +function transform = lsreal( t, x, omegamax, ncoeff, noctave) ## the R function runs the following command: ## nureal( double X, double Y, int min(X,Y), int ncoeff, int noctave, double omegamax, complex rp) ## this means that in the C, *tptr is X and *xptr is Y. Yes, I know. I think I'll rename them. Modified: trunk/octave-forge/extra/lssa/lswaveletcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/lswaveletcoeff.m 2012-05-25 23:14:13 UTC (rev 10522) +++ trunk/octave-forge/extra/lssa/lswaveletcoeff.m 2012-05-26 01:07:07 UTC (rev 10523) @@ -14,9 +14,9 @@ ## this program; if not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {c =} nuwaveletcoeff (abc, ord, time, freq) -## @deftypefnx {Function File} {c =} nuwaveletcoeff (abc, ord, time, freq, window) -## @deftypefnx {Function File} {c =} nuwaveletcoeff (abc, ord, time, freq, window, winradius) +## @deftypefn {Function File} {c =} lswaveletcoeff (abc, ord, time, freq) +## @deftypefnx {Function File} {c =} lswaveletcoeff (abc, ord, time, freq, window) +## @deftypefnx {Function File} {c =} lswaveletcoeff (abc, ord, time, freq, window, winradius) ## ## Return the coefficient of the wavelet transform of the ## time series (@var{abc}, @var{ord}) at time @var{time} @@ -32,12 +32,12 @@ %! y = sin(x); %! xt = x'; %! yt = y'; -%! a = nuwaveletcoeff(x,y,0.5,0.9) -%! b = nuwaveletcoeff(xt,yt,0.5,0.9) +%! a = lswaveletcoeff(x,y,0.5,0.9) +%! b = lswaveletcoeff(xt,yt,0.5,0.9) %! ## Generates the wavelet transform coefficient for time 0.5 and circ. freq. 0.9, for row & column vectors. -function coeff = nuwaveletcoeff( x , y , t , o , wgt = @cubicwgt , wgtrad = 1 ) +function coeff = lswaveletcoeff( x , y , t , o , wgt = @cubicwgt , wgtrad = 1 ) so = 0.05 .* o; if ( ( ndims(x) == 2 ) && ! ( rows(x) == 1 ) ) x = reshape(x,1,length(x)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <be...@us...> - 2012-05-29 19:26:07
|
Revision: 10533 http://octave.svn.sourceforge.net/octave/?rev=10533&view=rev Author: benjf5 Date: 2012-05-29 19:26:00 +0000 (Tue, 29 May 2012) Log Message: ----------- Fixed a typo, switched a demo to a test, added fastlscomplex.c. Don't recommend running it. Modified Paths: -------------- trunk/octave-forge/extra/lssa/cubicwgt.m trunk/octave-forge/extra/lssa/lscomplex.m trunk/octave-forge/extra/lssa/lscorrcoeff.m Added Paths: ----------- trunk/octave-forge/extra/lssa/fastlscomplex.c Modified: trunk/octave-forge/extra/lssa/cubicwgt.m =================================================================== --- trunk/octave-forge/extra/lssa/cubicwgt.m 2012-05-29 15:51:05 UTC (rev 10532) +++ trunk/octave-forge/extra/lssa/cubicwgt.m 2012-05-29 19:26:00 UTC (rev 10533) @@ -19,15 +19,12 @@ ## 1 + ( x ^ 2 * ( 2 x - 3 ) ), assuming x is in [-1,1]. ## @end deftypefn -%!demo -%! h = 2; -%! hcw = cubicwgt(h) -%! m = 0.01; -%! mcw = cubicwgt(m) +%!shared h, m, k +%! h = 2; m = 0.01; %! k = [ 0 , 3 , 1.5, -1, -0.5, -0.25, 0.75 ]; -%! kcw = cubicwgt(k) -%! kt = k'; -%! ktcw = cubicwgt(kt); +%!assert( cubicwgt(h), 0 ); +%!assert( cubicwgt(m), 1 + m ^ 2 * ( 2 * m - 3 )); +%!assert( cubicwgt(k), [ 1.00000 0.00000 0.00000 0.00000 0.50000 0.84375 0.15625], 1E-6); %! ## Tests cubicwgt on two scalars and two vectors; cubicwgt will work on any array input. Added: trunk/octave-forge/extra/lssa/fastlscomplex.c =================================================================== --- trunk/octave-forge/extra/lssa/fastlscomplex.c (rev 0) +++ trunk/octave-forge/extra/lssa/fastlscomplex.c 2012-05-29 19:26:00 UTC (rev 10533) @@ -0,0 +1,243 @@ +// fastlscomplex, implemented for Octave + + +#include <octave/oct.h> +#ifdef __cplusplus +extern "C" +{ +#endif +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include <complex.h> +#ifdef __cplusplus +} +#endif + +#define MAXCOLUMN 8 + +/* We use the ISO C99 complex facility as implemented by GCC, but only in two places */ + +typedef _Complex double Complex; +typedef double Real; + +#define RE(x_) (__real__ x_) +#define IM(x_) (__imag__ x_) +#define CSET(x_, r_, i_) (RE(x_) = (r_), IM(x_) = (i_)) +#define PHISET(x_, p_) CSET(x_, cos(tmp=p_), sin(tmp)) +#define SCALEPHISET(x_, f_, p_) CSET(x_, f_ cos(tmp=p_), f_ sin(tmp)) + +// Here the Data structure is included, but it's only ever a feature of the +// #STANDALONE cases, which we're not dealing with here. + +typedef struct +{ Real x, t; +} XTElem; + +inline double sqr(double x) +{ return x*x; } + +/* PNUM has to match the definition of EXP_IOT_SERIES! */ +#define PNUM 12 +#define SETXT(p_, op_, x_, t_) (p_)->x op_ x_; (p_++)->t op_ t_; +#define SETT(p_, op_, x_, t_) *p_++ op_ t_; +#define SETX(p_, op_, x_, t_) *p_++ op_ x_; +/* h is a complex aux. variable; it is used for assignment times I everywhere */ +#define SETIX(p_, op_, x_, t_) h = x_; RE(*(p_)) op_ -IM(h); IM(*(p_)) op_ RE(h); p_++; + + /* Macro that sums up the power series terms into the power series + * element record pointed to by p_. + * By using = and += for op_, initial setting and accumulation can be selected. + * t_ is the expression specifying the abscissa value. set_ can be either + * SETXT to set the x and t fields of an XTElem record, or SETT/SETX to set + * the elements of a Real array representing alternately real and imaginary + * values. + */ + // -10 points, comments don't match method. +#define EXP_IOT_SERIES(p_, el_, t_, op_, setr_, seti_) \ +{ Real t = t_, tt; p_ = el_; setr_(p_, op_, x, 1) \ + tt = -t; seti_(p_, op_, x*tt, tt) \ + tt *= t*(1.0/2.0); setr_(p_, op_, x*tt, tt) \ + tt *= t*(-1.0/3.0); seti_(p_, op_, x*tt, tt) \ + tt *= t*(1.0/4.0); setr_(p_, op_, x*tt, tt) \ + tt *= t*(-1.0/5.0); seti_(p_, op_, x*tt, tt) \ + tt *= t*(1.0/6.0); setr_(p_, op_, x*tt, tt) \ + tt *= t*(-1.0/7.0); seti_(p_, op_, x*tt, tt) \ + tt *= t*(1.0/8.0); setr_(p_, op_, x*tt, tt) \ + tt *= t*(-1.0/9.0); seti_(p_, op_, x*tt, tt) \ + tt *= t*(1.0/10.0); setr_(p_, op_, x*tt, tt) \ + tt *= t*(-1.0/11.0); seti_(p_, op_, x*tt, tt) \ +} + +/* same as the above, but without alternating signs */ +#define EXPIOT_SERIES(p_, el_, t_, op_, setr_, seti_) \ +{ Real t = t_, tt; p_ = el_; setr_(p_, op_, x, 1) \ + seti_(p_, op_, x*t, t ) \ + tt = t*t*(1.0/2.0); setr_(p_, op_, x*tt, tt) \ + tt *= t*(1.0/3.0); seti_(p_, op_, x*tt, tt) \ + tt *= t*(1.0/4.0); setr_(p_, op_, x*tt, tt) \ + tt *= t*(1.0/5.0); seti_(p_, op_, x*tt, tt) \ + tt *= t*(1.0/6.0); setr_(p_, op_, x*tt, tt) \ + tt *= t*(1.0/7.0); seti_(p_, op_, x*tt, tt) \ + tt *= t*(1.0/8.0); setr_(p_, op_, x*tt, tt) \ + tt *= t*(1.0/9.0); seti_(p_, op_, x*tt, tt) \ + tt *= t*(1.0/10.0); setr_(p_, op_, x*tt, tt) \ + tt *= t*(1.0/11.0); seti_(p_, op_, x*tt, tt) \ +} + +# define SRCARG Real *tptr, Real *xptr, int n, double *lengthptr +# define SRCVAR int k; Real length = *lengthptr; +# define SRCT tptr[k] +# define SRCX xptr[k] +# define SRCFIRST k = 0 +# define SRCAVAIL (k<n) + + + +DEFUN_DLD (fastlscomplex, args, nargout, "Computes a rapid complex least squares transform.") +{ + int nargs = args.length(); + if ( nargs != 7 ) print_usage(); + else { + const RowVector tvals = args(0).row_vector_value(); + const ComplexRowVector xvals = args(1).complex_row_vector_value(); + const int nval = args(2).int_value(); + const int lenval = args(3).int_value(); + const int ncoeffval = args(4).int_value(); + const int noctaveval = args(5).int_value(); + const int omegamaxval = args(6).int_value(); + if ( !error_value ) { + ComplexRowVector ret_series ( ( ncoeffval * noctaveval ) , 0.0 ); + octave_idx_type numt = tvals.numel(), numx = xvals.numel(), + numret = ret_series.numel(); + } + } + +} + +void print_usage() { + octave_stdout << "Prints the usage string for fastlscomplex, " + << "once I get around to it.\n"; + // Really, I'll replace this soon. + +} + +void fastlscomplex(Real *tptr, Complex *xptr, int *nptr, double *lengthptr, int *ncoeffptr, int *noctaveptr, Real *omegamaxptr, Complex *rp) +{ + int k, n = *nptr, ncoeff = *ncoeffptr, noctave = *noctaveptr; + Real length = *lengthptr, omegamax = *omegamaxptr; + + struct SumVec /* Precomputation record */ + { struct SumVec *next; /* A singly linked list */ + Complex elems[PNUM]; /* the summed power series elements */ + int cnt; /* number of samples for which the power series elements were added */ + } + *shead, *stail, *sp, *sq; /* power series element lists */ + Real dtelems[PNUM], /* power series elements of exp(-i dtau) */ + *dte, *r, /* Pointers into dtelems */ + x, /* abscissa and ordinate value, p-th power of t */ + tau, tau0, te, /* Precomputation range centers and range end */ + tau0d, /* tau_h of first summand range at level d */ + dtau = (0.5*M_PI)/omegamax,/* initial precomputation interval radius */ + dtaud, /* precomputation interval radius at d'th merging step */ + n_1 = 1.0/n, /* reciprocal of sample count */ + ooct, o, omul, /* omega/mu for octave's top omega and per band, mult. factor */ + omegaoct, omega, /* Max. frequency of octave and current frequency */ + on_1, /* n_1*(omega/mu)^p, n_1*(2*omega/mu)^p */ + mu = (0.5*M_PI)/length, /* Frequency shift: a quarter period of exp(i mu t) on length */ + tmp; + Complex zeta, zz, /* Accumulators for spectral coefficients */ + e, emul, /* summation factor exp(-i o tau_h) */ + h, eoelems[PNUM], oeelems[PNUM], + *eop, *oep, + *ep, *op, /* Pointer into the current choice of eoelems and oeelems */ + *p, *q, *pe; + int i, j; /* Coefficient and octave counter */ + + /* Subdivision and Precomputation */ + SRCFIRST; + tau = SRCT+dtau; te = tau+dtau; + tau0 = tau; + shead = stail = sp = alloca(sizeof(*sp)); sp->next = 0; + for(te = SRCT+2*dtau; ; ) + { x = SRCX; + EXP_IOT_SERIES(p, sp->elems, mu*(SRCT-tau), =, SETX, SETIX); sp->cnt = 1; + for(SRCNEXT; SRCAVAIL && SRCT<te; SRCNEXT) + { x = SRCX; + EXP_IOT_SERIES(p, sp->elems, mu*(SRCT-tau), +=, SETX, SETIX); sp->cnt++; + } + if(!SRCAVAIL) break; + tau = te+dtau; te = tau+dtau; + sp = alloca(sizeof(*sp)); stail->next = sp; stail = sp; sp->next = 0; sp->cnt = 0; + } + + ooct = omegamax/mu; + omul = exp(-M_LN2/ncoeff); + omegaoct = omegamax; + tau0d = tau0; + dtaud = dtau; + /*** Loop over Octaves ***/ + for(j = noctave; ; ooct *= 0.5, omegaoct *= 0.5, tau0d += dtaud, dtaud *= 2) + { /*** Results per frequency ***/ + for(i = ncoeff, o = ooct, omega = omegaoct; i--; o *= omul, omega *= omul) + { PHISET(e, -omega*tau0d); + PHISET(emul, -2*omega*dtaud); + for(zeta = 0, sp = shead; sp; sp = sp->next, e *= emul) + if(sp->cnt) + { for(zz = 0, p = sp->elems, pe = p+PNUM, on_1 = n_1; p < pe; ) + { zz += *p++ * on_1; on_1 *= o; } + zeta += e * zz; + } + *rp++ = zeta; + } + if(--j<=0) break; /* avoid unnecessary merging at the end */ + /* Merging of the s_h; + * 4 different possibilities, depending on which of the merged ranges actually contain data. + * The computation is described in the paper; The result of a merger is stored in the + * left precomputation record (sp). Before one power series element is stored, the + * sum and difference of the original values *p and *q are stored in eoelems and oeelems, + * respectively. The result is then stored in *p. + */ + EXPIOT_SERIES(r, dtelems, mu*dtaud, =, SETT, SETT); + for(sp = shead; sp; sp = sp->next) + { if(!(sq = sp->next) || !sq->cnt) + { if(sp->cnt) + for(p = sp->elems, eop = eoelems, dte = dtelems+1, pe = p+PNUM; p < pe; p++, dte++) + { ep = eop; *eop++ = *p; + for(r = dtelems, *p = *ep * *r; ; ) + { if(++r>=dte) break; --ep; h = *ep * *r; RE(*p) -= IM(h); IM(*p) += RE(h); + if(++r>=dte) break; --ep; *p -= *ep * *r; + if(++r>=dte) break; --ep; h = -*ep * *r; RE(*p) -= IM(h); IM(*p) += RE(h); + if(++r>=dte) break; --ep; *p += *ep * *r; + } + } + if(!sq) break; /* reached the last precomputation range */ + } + else + if(sp->cnt) + for(p = sp->elems, q = sq->elems, eop = eoelems, oep = oeelems, dte = dtelems+1, pe = p+PNUM; + p < pe; p++, q++, dte++) + { ep = eop; *eop++ = *p+*q; *oep++ = *p-*q; op = oep; + for(r = dtelems, *p = *ep * *r; ; ) + { if(++r>=dte) break; op -= 2; h = *op * *r; RE(*p) -= IM(h); IM(*p) += RE(h); + if(++r>=dte) break; ep -= 2; *p -= *ep * *r; + if(++r>=dte) break; op -= 2; h = -*op * *r; RE(*p) -= IM(h); IM(*p) += RE(h); + if(++r>=dte) break; ep -= 2; *p += *ep * *r; + } + } + else + for(q = sq->elems, eop = eoelems, oep = oeelems, dte = dtelems+1, pe = q+PNUM; q<pe; q++, dte++) + { ep = eop; *eop++ = *q; + for(r = dtelems, *q = *ep * *r; ; ) + { if(++r>=dte) break; --ep; h = *ep * *r; RE(*q) -= IM(h); IM(*q) += RE(h); + if(++r>=dte) break; --ep; *p -= *ep * *r; + if(++r>=dte) break; --ep; h = -*ep * *r; RE(*q) -= IM(h); IM(*q) += RE(h); + if(++r>=dte) break; --ep; *q += *ep * *r; + } + } + + sp->cnt += sq->cnt; sp->next = sq->next; /* free(sq) if malloc'ed */ + } + } +} Modified: trunk/octave-forge/extra/lssa/lscomplex.m =================================================================== --- trunk/octave-forge/extra/lssa/lscomplex.m 2012-05-29 15:51:05 UTC (rev 10532) +++ trunk/octave-forge/extra/lssa/lscomplex.m 2012-05-29 19:26:00 UTC (rev 10533) @@ -20,6 +20,7 @@ ## series, considering frequencies up to @var{maxfreq}, over @var{numoctaves} ## octaves and @var{numcoeff} coefficients. ## +## @seealso{lsreal} ## @end deftypefn Modified: trunk/octave-forge/extra/lssa/lscorrcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/lscorrcoeff.m 2012-05-29 15:51:05 UTC (rev 10532) +++ trunk/octave-forge/extra/lssa/lscorrcoeff.m 2012-05-29 19:26:00 UTC (rev 10533) @@ -57,7 +57,7 @@ rx2 = x2(mask); ry2 = y2(mask); ## I've used the same mask for all of these as it's an otherwise unimportant variable ... can this leak memory? - lnength(rx1) ##printing this length is probably used as a warning if 0 is returned; I inculded it + length(rx1) ##printing this length is probably used as a warning if 0 is returned; I included it ## in particular to maintain an exact duplicate of the R function. s = sum( wgt( ( rx1 - t ) .* so ) ) * sum( wgt( ( rx2 - t ) .* so ) ); coeff = ifelse( s != 0 , ( sum( wgt( ( rx1 - t ) .* so ) .* exp( i .* o .* rx1 ) .* ry1 ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <be...@us...> - 2012-05-31 06:05:06
|
Revision: 10545 http://octave.svn.sourceforge.net/octave/?rev=10545&view=rev Author: benjf5 Date: 2012-05-31 06:04:54 +0000 (Thu, 31 May 2012) Log Message: ----------- Assembled the first solid steps towards a fastlscomplex C++ function. Don't recommend compiling it. Added Paths: ----------- trunk/octave-forge/extra/lssa/fastlscomplex.cpp Removed Paths: ------------- trunk/octave-forge/extra/lssa/fastlscomplex.c Deleted: trunk/octave-forge/extra/lssa/fastlscomplex.c =================================================================== --- trunk/octave-forge/extra/lssa/fastlscomplex.c 2012-05-30 18:38:57 UTC (rev 10544) +++ trunk/octave-forge/extra/lssa/fastlscomplex.c 2012-05-31 06:04:54 UTC (rev 10545) @@ -1,243 +0,0 @@ -// fastlscomplex, implemented for Octave - - -#include <octave/oct.h> -#ifdef __cplusplus -extern "C" -{ -#endif -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> -#include <complex.h> -#ifdef __cplusplus -} -#endif - -#define MAXCOLUMN 8 - -/* We use the ISO C99 complex facility as implemented by GCC, but only in two places */ - -typedef _Complex double Complex; -typedef double Real; - -#define RE(x_) (__real__ x_) -#define IM(x_) (__imag__ x_) -#define CSET(x_, r_, i_) (RE(x_) = (r_), IM(x_) = (i_)) -#define PHISET(x_, p_) CSET(x_, cos(tmp=p_), sin(tmp)) -#define SCALEPHISET(x_, f_, p_) CSET(x_, f_ cos(tmp=p_), f_ sin(tmp)) - -// Here the Data structure is included, but it's only ever a feature of the -// #STANDALONE cases, which we're not dealing with here. - -typedef struct -{ Real x, t; -} XTElem; - -inline double sqr(double x) -{ return x*x; } - -/* PNUM has to match the definition of EXP_IOT_SERIES! */ -#define PNUM 12 -#define SETXT(p_, op_, x_, t_) (p_)->x op_ x_; (p_++)->t op_ t_; -#define SETT(p_, op_, x_, t_) *p_++ op_ t_; -#define SETX(p_, op_, x_, t_) *p_++ op_ x_; -/* h is a complex aux. variable; it is used for assignment times I everywhere */ -#define SETIX(p_, op_, x_, t_) h = x_; RE(*(p_)) op_ -IM(h); IM(*(p_)) op_ RE(h); p_++; - - /* Macro that sums up the power series terms into the power series - * element record pointed to by p_. - * By using = and += for op_, initial setting and accumulation can be selected. - * t_ is the expression specifying the abscissa value. set_ can be either - * SETXT to set the x and t fields of an XTElem record, or SETT/SETX to set - * the elements of a Real array representing alternately real and imaginary - * values. - */ - // -10 points, comments don't match method. -#define EXP_IOT_SERIES(p_, el_, t_, op_, setr_, seti_) \ -{ Real t = t_, tt; p_ = el_; setr_(p_, op_, x, 1) \ - tt = -t; seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/2.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(-1.0/3.0); seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/4.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(-1.0/5.0); seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/6.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(-1.0/7.0); seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/8.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(-1.0/9.0); seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/10.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(-1.0/11.0); seti_(p_, op_, x*tt, tt) \ -} - -/* same as the above, but without alternating signs */ -#define EXPIOT_SERIES(p_, el_, t_, op_, setr_, seti_) \ -{ Real t = t_, tt; p_ = el_; setr_(p_, op_, x, 1) \ - seti_(p_, op_, x*t, t ) \ - tt = t*t*(1.0/2.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/3.0); seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/4.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/5.0); seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/6.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/7.0); seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/8.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/9.0); seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/10.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/11.0); seti_(p_, op_, x*tt, tt) \ -} - -# define SRCARG Real *tptr, Real *xptr, int n, double *lengthptr -# define SRCVAR int k; Real length = *lengthptr; -# define SRCT tptr[k] -# define SRCX xptr[k] -# define SRCFIRST k = 0 -# define SRCAVAIL (k<n) - - - -DEFUN_DLD (fastlscomplex, args, nargout, "Computes a rapid complex least squares transform.") -{ - int nargs = args.length(); - if ( nargs != 7 ) print_usage(); - else { - const RowVector tvals = args(0).row_vector_value(); - const ComplexRowVector xvals = args(1).complex_row_vector_value(); - const int nval = args(2).int_value(); - const int lenval = args(3).int_value(); - const int ncoeffval = args(4).int_value(); - const int noctaveval = args(5).int_value(); - const int omegamaxval = args(6).int_value(); - if ( !error_value ) { - ComplexRowVector ret_series ( ( ncoeffval * noctaveval ) , 0.0 ); - octave_idx_type numt = tvals.numel(), numx = xvals.numel(), - numret = ret_series.numel(); - } - } - -} - -void print_usage() { - octave_stdout << "Prints the usage string for fastlscomplex, " - << "once I get around to it.\n"; - // Really, I'll replace this soon. - -} - -void fastlscomplex(Real *tptr, Complex *xptr, int *nptr, double *lengthptr, int *ncoeffptr, int *noctaveptr, Real *omegamaxptr, Complex *rp) -{ - int k, n = *nptr, ncoeff = *ncoeffptr, noctave = *noctaveptr; - Real length = *lengthptr, omegamax = *omegamaxptr; - - struct SumVec /* Precomputation record */ - { struct SumVec *next; /* A singly linked list */ - Complex elems[PNUM]; /* the summed power series elements */ - int cnt; /* number of samples for which the power series elements were added */ - } - *shead, *stail, *sp, *sq; /* power series element lists */ - Real dtelems[PNUM], /* power series elements of exp(-i dtau) */ - *dte, *r, /* Pointers into dtelems */ - x, /* abscissa and ordinate value, p-th power of t */ - tau, tau0, te, /* Precomputation range centers and range end */ - tau0d, /* tau_h of first summand range at level d */ - dtau = (0.5*M_PI)/omegamax,/* initial precomputation interval radius */ - dtaud, /* precomputation interval radius at d'th merging step */ - n_1 = 1.0/n, /* reciprocal of sample count */ - ooct, o, omul, /* omega/mu for octave's top omega and per band, mult. factor */ - omegaoct, omega, /* Max. frequency of octave and current frequency */ - on_1, /* n_1*(omega/mu)^p, n_1*(2*omega/mu)^p */ - mu = (0.5*M_PI)/length, /* Frequency shift: a quarter period of exp(i mu t) on length */ - tmp; - Complex zeta, zz, /* Accumulators for spectral coefficients */ - e, emul, /* summation factor exp(-i o tau_h) */ - h, eoelems[PNUM], oeelems[PNUM], - *eop, *oep, - *ep, *op, /* Pointer into the current choice of eoelems and oeelems */ - *p, *q, *pe; - int i, j; /* Coefficient and octave counter */ - - /* Subdivision and Precomputation */ - SRCFIRST; - tau = SRCT+dtau; te = tau+dtau; - tau0 = tau; - shead = stail = sp = alloca(sizeof(*sp)); sp->next = 0; - for(te = SRCT+2*dtau; ; ) - { x = SRCX; - EXP_IOT_SERIES(p, sp->elems, mu*(SRCT-tau), =, SETX, SETIX); sp->cnt = 1; - for(SRCNEXT; SRCAVAIL && SRCT<te; SRCNEXT) - { x = SRCX; - EXP_IOT_SERIES(p, sp->elems, mu*(SRCT-tau), +=, SETX, SETIX); sp->cnt++; - } - if(!SRCAVAIL) break; - tau = te+dtau; te = tau+dtau; - sp = alloca(sizeof(*sp)); stail->next = sp; stail = sp; sp->next = 0; sp->cnt = 0; - } - - ooct = omegamax/mu; - omul = exp(-M_LN2/ncoeff); - omegaoct = omegamax; - tau0d = tau0; - dtaud = dtau; - /*** Loop over Octaves ***/ - for(j = noctave; ; ooct *= 0.5, omegaoct *= 0.5, tau0d += dtaud, dtaud *= 2) - { /*** Results per frequency ***/ - for(i = ncoeff, o = ooct, omega = omegaoct; i--; o *= omul, omega *= omul) - { PHISET(e, -omega*tau0d); - PHISET(emul, -2*omega*dtaud); - for(zeta = 0, sp = shead; sp; sp = sp->next, e *= emul) - if(sp->cnt) - { for(zz = 0, p = sp->elems, pe = p+PNUM, on_1 = n_1; p < pe; ) - { zz += *p++ * on_1; on_1 *= o; } - zeta += e * zz; - } - *rp++ = zeta; - } - if(--j<=0) break; /* avoid unnecessary merging at the end */ - /* Merging of the s_h; - * 4 different possibilities, depending on which of the merged ranges actually contain data. - * The computation is described in the paper; The result of a merger is stored in the - * left precomputation record (sp). Before one power series element is stored, the - * sum and difference of the original values *p and *q are stored in eoelems and oeelems, - * respectively. The result is then stored in *p. - */ - EXPIOT_SERIES(r, dtelems, mu*dtaud, =, SETT, SETT); - for(sp = shead; sp; sp = sp->next) - { if(!(sq = sp->next) || !sq->cnt) - { if(sp->cnt) - for(p = sp->elems, eop = eoelems, dte = dtelems+1, pe = p+PNUM; p < pe; p++, dte++) - { ep = eop; *eop++ = *p; - for(r = dtelems, *p = *ep * *r; ; ) - { if(++r>=dte) break; --ep; h = *ep * *r; RE(*p) -= IM(h); IM(*p) += RE(h); - if(++r>=dte) break; --ep; *p -= *ep * *r; - if(++r>=dte) break; --ep; h = -*ep * *r; RE(*p) -= IM(h); IM(*p) += RE(h); - if(++r>=dte) break; --ep; *p += *ep * *r; - } - } - if(!sq) break; /* reached the last precomputation range */ - } - else - if(sp->cnt) - for(p = sp->elems, q = sq->elems, eop = eoelems, oep = oeelems, dte = dtelems+1, pe = p+PNUM; - p < pe; p++, q++, dte++) - { ep = eop; *eop++ = *p+*q; *oep++ = *p-*q; op = oep; - for(r = dtelems, *p = *ep * *r; ; ) - { if(++r>=dte) break; op -= 2; h = *op * *r; RE(*p) -= IM(h); IM(*p) += RE(h); - if(++r>=dte) break; ep -= 2; *p -= *ep * *r; - if(++r>=dte) break; op -= 2; h = -*op * *r; RE(*p) -= IM(h); IM(*p) += RE(h); - if(++r>=dte) break; ep -= 2; *p += *ep * *r; - } - } - else - for(q = sq->elems, eop = eoelems, oep = oeelems, dte = dtelems+1, pe = q+PNUM; q<pe; q++, dte++) - { ep = eop; *eop++ = *q; - for(r = dtelems, *q = *ep * *r; ; ) - { if(++r>=dte) break; --ep; h = *ep * *r; RE(*q) -= IM(h); IM(*q) += RE(h); - if(++r>=dte) break; --ep; *p -= *ep * *r; - if(++r>=dte) break; --ep; h = -*ep * *r; RE(*q) -= IM(h); IM(*q) += RE(h); - if(++r>=dte) break; --ep; *q += *ep * *r; - } - } - - sp->cnt += sq->cnt; sp->next = sq->next; /* free(sq) if malloc'ed */ - } - } -} Added: trunk/octave-forge/extra/lssa/fastlscomplex.cpp =================================================================== --- trunk/octave-forge/extra/lssa/fastlscomplex.cpp (rev 0) +++ trunk/octave-forge/extra/lssa/fastlscomplex.cpp 2012-05-31 06:04:54 UTC (rev 10545) @@ -0,0 +1,161 @@ +/* Copyright (C) 2012 Benjamin Lewis <be...@gm...> + * fastlscomplex.cpp, compiles to fastlscomplex.oct + * 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 + * 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/>. + */ + +#include <octave/oct.h> +#include <complex> +#include <string> +#include <stdio> + +#define PNUM 12; + +// In order to reduce memory overhead, fastlscomplex will use a reference as the last input. + +void fastlscomplex ( RowVector tvals, ComplexRowVector xvals, int n, + double length, int ncoeff, int noctaves, double omegamax, + ComplexRowVector& result ) { + /* Singly-linked list which contains each precomputation record + * count stores the number of samples for which power series elements + * were added. This will be useful for accelerating computation by ignoring + * unused entries. + */ + struct SumVec { + struct SumVec *next; + Complex<double> elements[PNUM]; + int count; } + *shead, *stail, *sp, *sq; //Names have been kept from the C, may change if I want to. + double dtelems[PNUM], /* power series elements of exp(-i dtau) */ + *dte, *r, /* Pointers into dtelems */ + x, /* abscissa and ordinate value, p-th power of t */ + tau, tau0, te, /* Precomputation range centers and range end */ + tau0d, /* tau_h of first summand range at level d */ + dtau = (0.5*M_PI)/omegamax,/* initial precomputation interval radius */ + dtaud, /* precomputation interval radius at d'th merging step */ + n_1 = 1.0/n, /* reciprocal of sample count */ + ooct, o, omul, /* omega/mu for octave's top omega and per band, mult. factor */ + omegaoct, omega, /* Max. frequency of octave and current frequency */ + on_1, /* n_1*(omega/mu)^p, n_1*(2*omega/mu)^p */ + mu = (0.5*M_PI)/length, /* Frequency shift: a quarter period of exp(i mu t) on length */ + tmp; + std::complex<double> zeta, zz, // Accumulators for spectral coefficients to place in Complex<double> + e, emul, + h, eoelems[PNUM], oeelems[PNUM], + *eop, *oep, + *ep, *op, + *p, *q, *pe; + + + int i , j; // Counters; coefficient and octave, respectively. + // probable doubles: zetar, zetai, zzr, zzi, er, ei, emulr, emuli, + // eoelemsr[PNUM] eoelemsi[PNUM], etc. (since I want to use Complex<double> + // as little as possible.) + + octave_idx_type k = 0; + + // Subdivision and precomputation, reinvisioned in an OOWorld. + tau = tvals(k) + dtau; + te = tau + dtau; + tau0 = tau; + shead = stail = sp = alloca(sizeof(*sp)); + sp->next = 0; + { te = tvals(k) + ( 2 * dtau ); + while ( k < n ) { //THIS makes no sense, n is the wrong type. Will need to fix that. + EXP_IOT_SERIES(p, sp->elems, mu*(tvals(k)-tau), =, SETX, SETIX); + sp->count = 1; + //Sum terms and show that there has been at least one precomputation. + // I will probably replace the macro with a better explanation. + for(SRCNEXT; SRCAVAIL && tvals(k) < te; SRCNEXT) { + x = xvals(k); + EXP_IOT_SERIES(p,sp->elems,mu*(tvals(k)-tau), +=, SETX, SETIX); + sp->count++; + } + if ( k >= n ) break; + tau = te + dtau; + te = tau + dtau; + sp = alloca(sizeof(*sp)); + stail->next = sp; + stail = sp; + sp->next = 0; + sp->count = 0; + } } + // Now isn't that just a nicer representation of much the same control structure as that ugly for-loop? + // Defining starting values for the loops over octaves: + ooct = omegamax / mu; + omul = exp(-M_LN2/ncoeff); + omegaoct = omegamax; + tau0d = tau0; + dtaud = dtau; + // Looping over octaves + for ( j = noctave ; ; ooct *= 0.5 , omegaoct *= 0.5 , tau0d += dtaud , dtaud *= 2 ) { + // Looping over&results per frequency + for ( i = ncoeff, o = ooct, omega = omegaoct; i-- ; o *= omul, omega *= omul ) { + e.real() = cos( - ( omega * tau0d ) ); e.imag() = sin( - ( omega * tau0d ) ); + // sets real, imag parts of e + emul.real() = cos( - 2 * ( omega * dtaud ) ); emul.imag() = sin( - 2 * ( omega * dtaud ) ); + // sets real, imag parts of emul + for( zeta = 0 , sp = shead; sp; sp = sp->next, e *= emul ) { + if ( sp->count ) { + for ( zz = std::complex<double>(0.0,0.0) , p = sp->elems , pe = p + PNUM , on_1 = n_1 ; p < pe ; ) { + zz += *p++ * on_1; + on_1 *= 0; + } + zeta += e * zz; + } + *rp++ = zeta; + } + if ( --j <= 0 ) break; //Avoids excess merging + + EXPIOT_SERIES(r, dtelems, mu*dtaud, =, SETT, SETT); + for(sp = shead; sp; sp = sp->next){ + if(!(sq = sp->next) || !sq->count ) { + for(p = sp->elems, eop = eoelems, dte = dtelems+1, pe = p+PNUM; p < pe; p++, dte++) + { ep = eop; *eop++ = *p; + for(r = dtelems, *p = *ep * *r; ; ) + { if(++r>=dte) break; --ep; h = *ep * *r; RE(*p) -= IM(h); IM(*p) += RE(h); + if(++r>=dte) break; --ep; *p -= *ep * *r; + if(++r>=dte) break; --ep; h = -*ep * *r; RE(*p) -= IM(h); IM(*p) += RE(h); + if(++r>=dte) break; --ep; *p += *ep * *r; + } + } + if(!sq) break; /* reached the last precomputation range */ + } + else + if(sp->cnt) + for(p = sp->elems, q = sq->elems, eop = eoelems, oep = oeelems, dte = dtelems+1, pe = p+PNUM; + p < pe; p++, q++, dte++) + { ep = eop; *eop++ = *p+*q; *oep++ = *p-*q; op = oep; + for(r = dtelems, *p = *ep * *r; ; ) + { if(++r>=dte) break; op -= 2; h = *op * *r; RE(*p) -= IM(h); IM(*p) += RE(h); + if(++r>=dte) break; ep -= 2; *p -= *ep * *r; + if(++r>=dte) break; op -= 2; h = -*op * *r; RE(*p) -= IM(h); IM(*p) += RE(h); + if(++r>=dte) break; ep -= 2; *p += *ep * *r; + } + } + else + for(q = sq->elems, eop = eoelems, oep = oeelems, dte = dtelems+1, pe = q+PNUM; q<pe; q++, dte++) + { ep = eop; *eop++ = *q; + for(r = dtelems, *q = *ep * *r; ; ) + { if(++r>=dte) break; --ep; h = *ep * *r; RE(*q) -= IM(h); IM(*q) += RE(h); + if(++r>=dte) break; --ep; *p -= *ep * *r; + if(++r>=dte) break; --ep; h = -*ep * *r; RE(*q) -= IM(h); IM(*q) += RE(h); + if(++r>=dte) break; --ep; *q += *ep * *r; + } + } + + sp->cnt += sq->cnt; sp->next = sq->next; /* free(sq) if malloc'ed */ + } + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <be...@us...> - 2012-06-19 20:23:54
|
Revision: 10641 http://octave.svn.sourceforge.net/octave/?rev=10641&view=rev Author: benjf5 Date: 2012-06-19 20:23:47 +0000 (Tue, 19 Jun 2012) Log Message: ----------- Fixed some variables in lombnormcoeff, added fastlsreal. Modified Paths: -------------- trunk/octave-forge/extra/lssa/lombnormcoeff.m Added Paths: ----------- trunk/octave-forge/extra/lssa/fastlsreal.cc Added: trunk/octave-forge/extra/lssa/fastlsreal.cc =================================================================== --- trunk/octave-forge/extra/lssa/fastlsreal.cc (rev 0) +++ trunk/octave-forge/extra/lssa/fastlsreal.cc 2012-06-19 20:23:47 UTC (rev 10641) @@ -0,0 +1,320 @@ +/* Copyright (C) 2012 Benjamin Lewis <be...@gm...> + * Licensed under the GNU GPLv2 + */ + + +#include <octave/oct.h> +#include <octave/unwind-prot.h> +#include <complex> +#include <string> +#include <math.h> +#include <iostream> +#include <exception> + +ComplexRowVector flsreal( RowVector tvec , ComplexRowVector xvec , + double maxfreq , int octaves , int coefficients); + + +DEFUN_DLD(fastlsreal,args,nargout, "fastlsreal(time,magnitude,maximum_frequency,octaves,coefficients)") { + if ( args.length() != 5 ) { + print_usage(); + return octave_value_list (); + } + RowVector tvals = args(0).row_vector_value(); + ComplexRowVector xvals = args(1).complex_row_vector_value(); + double omegamax = args(2).double_value(); + int noctaves = args(3).int_value(); + int ncoeff = args(4).int_value(); + if ( tvals.numel() != xvals.numel() ){ + if ( tvals.numel() > xvals.numel() ) { + error("More time values than magnitude values."); + } else { + error("More magnitude values than time values."); + } + } + if ( ncoeff == 0 ) error("No coefficients to compute."); + if ( noctaves == 0 ) error("No octaves to compute over."); + if ( omegamax == 0 ) error("No difference between minimal and maximal frequency."); + octave_value_list retval; + if ( !error_state) { + ComplexRowVector results = flscomplex(tvals,xvals,omegamax,noctaves,ncoeff); + retval(0) = octave_value(results); + } else { + return octave_value_list (); + } + return retval; + +} + +ComplexRowVector flsreal( RowVector tvec , ComplexRowVector xvec , + double maxfreq, int octaves, int coefficients ) { + struct Precomputation_Record { + Precomputation_Record *next; + std::complex<double> power_series[12]; // I'm using 12 as a matter of compatibility, only. + bool stored_data; + }; + + ComplexRowVector results = ComplexRowVector (coefficients * octaves ); + + double tau, delta_tau, tau_0, tau_h, n_inv, mu, + omega_oct, omega_multiplier, octavemax, omega_working, + loop_tau_0, loop_delta_tau; + double length = ( tvec((tvec.numel()-1)) - tvec( octave_idx_type (0))); + int octave_iter, coeff_iter; + std::complex<double> zeta, z_accumulator, exp_term, exp_multiplier, alpha, + iota, i_accumulator; + octave_idx_type n = tvec.numel(); + std::complex<double> temp_array[12]; + for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { + temp_array[array_iter] = std::complex<double> ( 0 , 0 ); + } + int factorial_array[12]; + factorial_array[0] = 1; + for ( int i = 1 ; i < 12 ; i++ ) { + factorial_array[i] = factorial_array[i-1] * i; + } + n_inv = 1.0 / n; + mu = (0.5 * M_PI)/length; // Per the article; this is in place to improve numerical accuracy if desired. + /* Viz. the paper, in which Dtau = c / omega_max, and c is stated as pi/2 for floating point processors, + * In the case of this computation, I'll go by the recommendation. + */ + delta_tau = M_PI / ( 2 * maxfreq ); + tau_0 = tvec(0) + delta_tau; + tau_h = tau_0; + size_t precomp_subset_count = (size_t) ceil( ( tvec(tvec.numel()-1) - tvec(0) ) / ( 2 * delta_tau ) ); + // I've used size_t because it will work for my purposes without threatening undefined behaviour. + const std::complex<double> im = std::complex<double> ( 0 , 1 ); //I seriously prefer C99's complex numbers. + + octave_idx_type k ( 0 ); // Iterator for accessing xvec, tvec. + + Precomputation_Record * complex_precomp_records_head, *complex_record_current, + *complex_record_tail, *complex_record_ref, *complex_record_next, *iota_precomp_records_head, + *iota_record_current, *iota_record_tail, *iota_record_ref, *iota_record_next; + complex_record_current = complex_precomp_records_head = new Precomputation_Record; + iota_record_current = iota_precomp_records_head = new Precomputation_Record; + for ( size_t p_r_iter = 1 ; p_r_iter < precomp_subset_count ; p_r_iter++ ) { + complex_record_current->next = new Precomputation_Record; + iota_record_current->next = new Precomputation_Record; + complex_record_current = complex_record_current->next; + iota_record_current = iota_record_current->next; + } + complex_record_tail = complex_record_current; + iota_record_tail = iota_record_current; + complex_record_current = complex_precomp_records_head; + iota_record_current = iota_precomp_records_head; + complex_record_tail->next = 0; + iota_record_tail->next = 0; + /* A test needs to be included for if there was a failure, but since + * precomp_subset_count is of type size_t, it should be okay. */ + for( ; complex_record_current != 0 ; complex_record_current = complex_record_current->next ) { + for ( int j = 0 ; j < 12 ; j++ ) { + complex_record_current->power_series[j] = std::complex<double> ( 0 , 0 ); + } // To avoid any trouble down the line, although it is an annoyance. + // Error is traced this far. Time to see if it's in this loop. + while ( (k < n) && (abs(tvec(k)-tau_h) <= delta_tau) ) { + double p; + for ( int j = 0 ; j < 12 ; j++ ) { + alpha.real() = xvec(k).real(); + alpha.imag() = xvec(k).imag(); + if ( !( j % 2 ) ) { + if ( ! ( j % 4 ) ) { + alpha.real() = xvec(k).real() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; + alpha.imag() = xvec(k).imag() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; + } else { + alpha.real() = -1 * xvec(k).real() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; + alpha.imag() = -1 * xvec(k).imag() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; + } + } else { + if ( ! ( j % 3 ) ) { + alpha.real() = -1 * xvec(k).imag() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; + alpha.imag() = -1 * xvec(k).real() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; + } else { + alpha.real() = xvec(k).imag() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; + alpha.imag() = xvec(k).real() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; + } + } + complex_record_current->power_series[j].real() += alpha.real(); + complex_record_current->power_series[j].imag() += alpha.imag(); + } + // Computes each next step of the power series for the given power series element. + // j was reused since it was a handy inner-loop variable, even though I used it twice here. + complex_record_current->stored_data = true; + k++; + } + tau_h += ( 2 * delta_tau ); + } + // At this point all precomputation records have been + // exhausted for complex records. Short-circuit is abused + // to avoid overflow errors. + // Reset k, tau_h to reset the process. I may rewrite + // these loops to be one, since running twice as long to + // do the same thing is painful. May also move to a switch + // in the previous section too. + k = 0; + tau_h = tau_0; + for( ; iota_record_current != 0 ; iota_record_current = iota_record_current->next ) { + for ( int j = 0 ; j < 12 ; j++ ) { + complex_record_current->power_series[j] = std::complex<double> ( 0 , 0 ); + } + while( ( k < n ) && (abs(tvec(k)-tau_h) <= delta_tau) ) { + double comps[12]; + iota_record_current->power_series[0].real() = 1; + comps[0] = 1; + for ( int j = 1 ; j < 12 ; j++ ) { + comps[j] = comps[j-1] * mu * (tvec(k)-tau_h); + switch ( j % 4 ) { + case 0 : + iota_record_current->power_series[j].real() += comps[j] / factorial_array[j] ; + break; + case 1: + iota_record_current->power_series[j].imag() += comps[j] / factorial_array[j] ; + break; + case 2: + iota_record_current->power_series[j].real() -= comps[j] / factorial_array[j] ; + break; + case 3: + iota_record_current->power_series[j].imag() -= comps[j] / factorial_array[j] ; + break; + } + } + iota_record_current->stored_data = true; + k++; + } + tau_h += ( 2 * delta_tau ); + } + + + /* Summation of coefficients for each frequency. As we have ncoeffs * noctaves elements, + * it makes sense to work from the top down, as we have omega_max by default (maxfreq) + */ + + omega_oct = maxfreq / mu; + omega_multiplier = exp(-log(2)/coefficients); + octavemax = maxfreq; + loop_tau_0 = tau_0; + loop_delta_tau = delta_tau; + + octave_idx_type iter ( 0 ); + + double real_part = 0, imag_part = 0, real_part_accumulator = 0, imag_part_accumulator = 0; + + // Loops need to first travel over octaves, then coefficients; + + for ( octave_iter = octaves ; ; omega_oct *= 0.5 , octavemax *= 0.5 , loop_tau_0 += loop_delta_tau , loop_delta_tau *= 2 ) { + omega_working = omega_oct; + exp_term = std::complex<double> ( cos ( - omega_working * loop_tau_0 ) , + sin ( - omega_working * loop_tau_0 ) ); + exp_multiplier = std::complex<double> ( cos ( - 2 * omega_working * loop_delta_tau ) , + sin ( - 2 * omega_working * loop_delta_tau ) ); + iota_exp_term = std::complex<double> ( cos ( - 2 * omega_working * loop_tau_0 ) , + sin ( - 2 * omega_working * loop_tau_0 ) ); + iota_exp_multiplier = std::complex<double> ( cos ( - 2 * omega_working * loop_delta_tau ) , + sin ( - 2 * omega_working * loop_delta_tau ) ); + for ( coeff_iter = 0 ; coeff_iter < coefficients ; coeff_iter++, omega_working *= omega_multiplier){ + real_part_accumulator = 0; + imag_part_accumulator = 0; + real_part = 0; + imag_part = 0; + for ( complex_record_current = complex_precomp_records_head ; complex_record_current ; + complex_record_current = complex_record_current->next, exp_term *= exp_multiplier ) { + for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { + z_accumulator = ( pow(omega_working,array_iter) * complex_record_current->power_series[array_iter] ); + real_part_accumulator += z_accumulator.real(); + imag_part_accumulator += z_accumulator.imag(); + } + real_part = real_part + ( exp_term.real() * real_part_accumulator - ( exp_term.imag() * imag_part_accumulator ) ); + imag_part = imag_part + ( exp_term.imag() * real_part_accumulator + exp_term.real() * imag_part_accumulator ); + } + for ( iota_record_current = iota_precomp_records_head; iota_record_current ; + iota_record_current = iota_record_current->next, iota_exp_term = iota_exp_term_multiplier ) { + + } + results(iter) = std::complex<double> ( n_inv * real_part , n_inv * imag_part ); + iter++; + } + if ( !(--octave_iter) ) break; + /* If we've already reached the lowest value, stop. + * Otherwise, merge with the next computation range. + */ + double exp_power_series_elements[12]; + exp_power_series_elements[0] = 1; + for ( int r_iter = 1 ; r_iter < 12 ; r_iter++ ) { + exp_power_series_elements[r_iter] = exp_power_series_elements[r_iter-1] + * ( mu * loop_delta_tau) * ( 1.0 / ( (double) r_iter ) ); + } + try{ + for ( complex_record_current = complex_precomp_records_head ; complex_record_current ; + complex_record_current = complex_record_current->next ) { + if ( ! ( complex_record_ref = complex_record_current->next ) || ! complex_record_ref->stored_data ) { + if ( complex_record_current->stored_data ) { + std::complex<double> temp[12]; + for( int array_init = 0 ; array_init < 12 ; array_init++ ) { temp[array_init] = std::complex<double>(0,0); } + for( int p = 0 ; p < 12 ; p ++ ) { + double step_floor_r = floor( ( (double) p ) / 2.0 ); + double step_floor_i = floor( ( (double) ( p - 1 ) ) / 2.0 ); + for( int q = 0 ; q < step_floor_r ; q++ ) { + temp[p] += exp_power_series_elements[2*q] * pow((double)-1,q) * complex_record_current->power_series[p - ( 2 * q )]; + } + for( int q = 0 ; q <= step_floor_i ; q++ ) { + temp[p] += im * exp_power_series_elements[2 * q + 1] * pow((double)-1,q) * complex_record_current->power_series[p - ( 2 * q ) - 1]; + } + } + for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { + complex_record_current->power_series[array_iter].real() = temp[array_iter].real(); + complex_record_current->power_series[array_iter].imag() = temp[array_iter].imag(); + } + if ( ! complex_record_ref ) break; // Last record was reached + } + else { + complex_record_next = complex_record_ref; + if ( complex_record_current->stored_data ) { + std::complex<double> temp[12]; + for( int array_init = 0 ; array_init < 12 ; array_init++ ) { temp[array_init] = std::complex<double>(0,0); } + for( int p = 0 ; p < 12 ; p ++ ) { + double step_floor_r = floor( ( (double) p ) / 2.0 ); + double step_floor_i = floor( ( (double) ( p - 1 ) ) / 2.0 ); + for( int q = 0 ; q < step_floor_r ; q++ ) { + temp[p] += exp_power_series_elements[2*q] * pow((double)-1,q) * ( complex_record_current->power_series[p - ( 2 * q )] - complex_record_next->power_series[p - (2*q)] ); + } + for( int q = 0 ; q <= step_floor_i ; q++ ) { + temp[p] += im * exp_power_series_elements[2 * q + 1] * pow((double)-1,q) * ( complex_record_current->power_series[p - ( 2 * q ) - 1] - complex_record_next->power_series[p - ( 2 * q ) - 1 ] ); + } + } + for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { + complex_record_current->power_series[array_iter].real() = temp[array_iter].real(); + complex_record_current->power_series[array_iter].imag() = temp[array_iter].imag(); + } + } else { + std::complex<double> temp[12]; + for( int array_init = 0 ; array_init < 12 ; array_init++ ) { temp[array_init] = std::complex<double>(0,0); } + for( int p = 0 ; p < 12 ; p ++ ) { + double step_floor_r = floor( ( (double) p ) / 2.0 ); + double step_floor_i = floor( ( (double) ( p - 1 ) ) / 2.0 ); + for( int q = 0 ; q < step_floor_r ; q++ ) { + temp[p] += exp_power_series_elements[2*q] * pow((double)-1,q) * complex_record_next->power_series[p - ( 2 * q )]; + } + for( int q = 0 ; q <= step_floor_i ; q++ ) { + temp[p] += im * exp_power_series_elements[2 * q + 1] * pow((double)-1,(q+1)) * complex_record_next->power_series[p - ( 2 * q ) - 1]; + } + } + for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { + complex_record_current->power_series[array_iter].real() = temp[array_iter].real(); + complex_record_current->power_series[array_iter].imag() = temp[array_iter].imag(); + } + } + complex_record_current->stored_data = true; + complex_record_ref = complex_record_next; + complex_record_current->next = complex_record_ref->next; + delete complex_record_ref; + } + } + } + } catch (std::exception& e) { //This section was part of my debugging, and may be removed. + std::cout << "Exception thrown: " << e.what() << std::endl; + ComplexRowVector exception_result (1); + exception_result(0) = std::complex<double> ( 0,0); + return exception_result; + } + } + return results; +} Modified: trunk/octave-forge/extra/lssa/lombnormcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/lombnormcoeff.m 2012-06-19 11:41:05 UTC (rev 10640) +++ trunk/octave-forge/extra/lssa/lombnormcoeff.m 2012-06-19 20:23:47 UTC (rev 10641) @@ -1,9 +1,28 @@ ## 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, see <http://www.gnu.org/licenses/>. -function coeff = lombnormcoeff(X,Y,omega) -tau = atan2( sum( sin( 2.*omega.*X)), sum(cos(2.*omega.*X))) / 2; -coeff = ( ( sum ( Y .* cos( omega .* X - tau ) ) .^ 2 ./ sum ( cos ( omega .* X - tau ) .^ 2 ) - + sum ( Y .* sin ( omega .* X - tau ) ) .^ 2 / sum ( sin ( omega .* X - tau ) .^ 2 ) ) - / ( 2 * var(Y) ) ); +## -*-texinfo-*- +## @deftypefn {Function File} {c =} lombnormcoeff (time, mag, freq) +## +## Return the coefficient of the Lomb Normalised Periodogram at the +## specified @var{frequency} of the periodogram applied to the +## (@var{time}, @var{mag}) series. + +function coeff = lombnormcoeff(T,X,omega) +tau = atan2( sum( sin( 2.*omega.*T)), sum(cos(2.*omega.*T))) / 2; +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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <be...@us...> - 2012-06-25 16:41:41
|
Revision: 10693 http://octave.svn.sourceforge.net/octave/?rev=10693&view=rev Author: benjf5 Date: 2012-06-25 16:41:32 +0000 (Mon, 25 Jun 2012) Log Message: ----------- The fast methods run, still need to correlate their results with the reference. Modified Paths: -------------- trunk/octave-forge/extra/lssa/fastlscomplex.cc trunk/octave-forge/extra/lssa/fastlsreal.cc trunk/octave-forge/extra/lssa/lombnormcoeff.m Modified: trunk/octave-forge/extra/lssa/fastlscomplex.cc =================================================================== --- trunk/octave-forge/extra/lssa/fastlscomplex.cc 2012-06-25 16:27:17 UTC (rev 10692) +++ trunk/octave-forge/extra/lssa/fastlscomplex.cc 2012-06-25 16:41:32 UTC (rev 10693) @@ -15,7 +15,18 @@ double maxfreq , int octaves , int coefficients); -DEFUN_DLD(fastlscomplex,args,nargout, "fastlscomplex(time,magnitude,maximum_frequency,octaves,coefficients)") { +DEFUN_DLD(fastlscomplex,args,nargout, + "-*- texinfo -*-\n" +"@deftypefn {Function File} { C = } fastlscomplex" + "(@var{time},@var{magnitude},@var{maximum_frequency},@var{octaves},@var{coefficients})\n" +"\n" +"Return the complex least squares transform of the (@var{time},@var{magnitude}) series\n\ +supplied, using the fast algorithm.\n" +"\n" +"@seealso{lscomplex}\n" +"@seealso{fastlsreal}\n" +"\n" +"@end deftypefn") { if ( args.length() != 5 ) { print_usage(); return octave_value_list (); Modified: trunk/octave-forge/extra/lssa/fastlsreal.cc =================================================================== --- trunk/octave-forge/extra/lssa/fastlsreal.cc 2012-06-25 16:27:17 UTC (rev 10692) +++ trunk/octave-forge/extra/lssa/fastlsreal.cc 2012-06-25 16:41:32 UTC (rev 10693) @@ -107,6 +107,7 @@ complex_record_current = complex_record_current->next; iota_record_current = iota_record_current->next; } + // Error's past this point complex_record_tail = complex_record_current; iota_record_tail = iota_record_current; complex_record_current = complex_precomp_records_head; @@ -119,7 +120,6 @@ for ( int j = 0 ; j < 12 ; j++ ) { complex_record_current->power_series[j] = std::complex<double> ( 0 , 0 ); } // To avoid any trouble down the line, although it is an annoyance. - // Error is traced this far. Time to see if it's in this loop. while ( (k < n) && (abs(tvec(k)-tau_h) <= delta_tau) ) { double p; for ( int j = 0 ; j < 12 ; j++ ) { @@ -164,7 +164,7 @@ tau_h = tau_0; for( ; iota_record_current != 0 ; iota_record_current = iota_record_current->next ) { for ( int j = 0 ; j < 12 ; j++ ) { - complex_record_current->power_series[j] = std::complex<double> ( 0 , 0 ); + iota_record_current->power_series[j] = std::complex<double> ( 0 , 0 ); } while( ( k < n ) && (abs(tvec(k)-tau_h) <= delta_tau) ) { double comps[12]; @@ -188,6 +188,7 @@ } } iota_record_current->stored_data = true; + std::cout << "Precomputed " << iota_record_current << std::endl; k++; } tau_h += ( 2 * delta_tau ); @@ -237,7 +238,7 @@ zeta_imag_part = zeta_imag_part + ( zeta_exp_term.imag() * zeta_real_part_accumulator + zeta_exp_term.real() * zeta_imag_part_accumulator ); } for ( iota_record_current = iota_precomp_records_head; iota_record_current ; - iota_record_current = iota_record_current->next, iota_exp_term = iota_exp_multiplier ) { + iota_record_current = iota_record_current->next, iota_exp_term *= iota_exp_multiplier ) { for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { i_accumulator = ( pow(omega_working,array_iter) * iota_record_current->power_series[array_iter] ); iota_real_part_accumulator += i_accumulator.real(); Modified: trunk/octave-forge/extra/lssa/lombnormcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/lombnormcoeff.m 2012-06-25 16:27:17 UTC (rev 10692) +++ trunk/octave-forge/extra/lssa/lombnormcoeff.m 2012-06-25 16:41:32 UTC (rev 10693) @@ -13,12 +13,14 @@ ## 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-*- +## -*- texinfo -*- ## @deftypefn {Function File} {c =} lombnormcoeff (time, mag, freq) ## ## Return the coefficient of the Lomb Normalised Periodogram at the ## specified @var{frequency} of the periodogram applied to the ## (@var{time}, @var{mag}) series. +## +## @end deftypefn function coeff = lombnormcoeff(T,X,omega) tau = atan2( sum( sin( 2.*omega.*T)), sum(cos(2.*omega.*T))) / 2; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <be...@us...> - 2012-06-30 18:46:10
|
Revision: 10709 http://octave.svn.sourceforge.net/octave/?rev=10709&view=rev Author: benjf5 Date: 2012-06-30 18:46:04 +0000 (Sat, 30 Jun 2012) Log Message: ----------- Added lombcoeff, going to add tests to functions and clean up documentation shortly. Modified Paths: -------------- trunk/octave-forge/extra/lssa/fastlsreal.cc trunk/octave-forge/extra/lssa/lscomplex.m Added Paths: ----------- trunk/octave-forge/extra/lssa/lombcoeff.m Modified: trunk/octave-forge/extra/lssa/fastlsreal.cc =================================================================== --- trunk/octave-forge/extra/lssa/fastlsreal.cc 2012-06-29 16:40:57 UTC (rev 10708) +++ trunk/octave-forge/extra/lssa/fastlsreal.cc 2012-06-30 18:46:04 UTC (rev 10709) @@ -188,7 +188,6 @@ } } iota_record_current->stored_data = true; - std::cout << "Precomputed " << iota_record_current << std::endl; k++; } tau_h += ( 2 * delta_tau ); Added: trunk/octave-forge/extra/lssa/lombcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/lombcoeff.m (rev 0) +++ trunk/octave-forge/extra/lssa/lombcoeff.m 2012-06-30 18:46:04 UTC (rev 10709) @@ -0,0 +1,31 @@ +## 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 -*- +## @deftypefn {Function File} {c =} lombcoeff (time, mag, freq) +## +## Return the coefficient of the Lomb periodogram (unnormalized) for the +## (@var{time},@var{mag}) series for the @var{freq} provided. +## +## @seealso{lombnormcoeff} +## @end deftypefn + + +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 - tau))**2)/(sum(cos(o.*T-tau).**2)) + + ( sum(X .* sin(o .* T - tau))**2)/(sum(sin(o.*T-tau).**2)); +end function + Modified: trunk/octave-forge/extra/lssa/lscomplex.m =================================================================== --- trunk/octave-forge/extra/lssa/lscomplex.m 2012-06-29 16:40:57 UTC (rev 10708) +++ trunk/octave-forge/extra/lssa/lscomplex.m 2012-06-30 18:46:04 UTC (rev 10709) @@ -26,15 +26,13 @@ function transform = lscomplex( t , x , omegamax , ncoeff , noctave ) n = length(t); ## VECTOR ONLY, and since t and x have the same number of entries, there's no problem. - n1 = 1 / n; transform = zeros(1,ncoeff*noctave); o = omegamax; omul = 2 ^ ( - 1 / ncoeff ); for iter = 1:ncoeff*noctave ot = o .* t; - transform(iter) = sum( ( cos(ot) .- ( sin(ot) .* i ) ) .* x ); ## See the paper for the expression + transform(iter) = sum( ( cos(ot) - ( sin(ot) .* i ) ) .* x ) / n; ## See the paper for the expression o *= omul; ## To advance the transform to the next coefficient in the octave endfor - transform ./ n; endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <be...@us...> - 2012-07-05 14:12:08
|
Revision: 10732 http://octave.svn.sourceforge.net/octave/?rev=10732&view=rev Author: benjf5 Date: 2012-07-05 14:11:58 +0000 (Thu, 05 Jul 2012) Log Message: ----------- Working on tests; they are all works in progress. Modified Paths: -------------- trunk/octave-forge/extra/lssa/lombcoeff.m trunk/octave-forge/extra/lssa/lscomplex.m trunk/octave-forge/extra/lssa/lsreal.m Modified: trunk/octave-forge/extra/lssa/lombcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/lombcoeff.m 2012-07-05 13:51:57 UTC (rev 10731) +++ trunk/octave-forge/extra/lssa/lombcoeff.m 2012-07-05 14:11:58 UTC (rev 10732) @@ -22,7 +22,16 @@ ## @seealso{lombnormcoeff} ## @end deftypefn +%!shared t, x, o, maxfreq +%! maxfreq = 4 / ( 2 * pi ); +%! t = linspace(0,8); x = ( 2.*sin(maxfreq.*t) + 3.*sin((3/4)*maxfreq.*t) +%! - 0.5 .* sin((1/4)*maxfreq.*t) - 0.2 .* cos(maxfreq .* t) +%! + cos((1/4)*maxfreq.*t)); o = [ maxfreq , 3 / 4 * maxfreq , 1 / 4 * maxfreq ]; +%! assert( lombcoeff(t,x,o(1)) = ); +%! assert( lombcoeff(t,x,o(2)) = ); +%! assert( lombcoeff(t,x,o(3)) = ); + 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 - tau))**2)/(sum(cos(o.*T-tau).**2)) + Modified: trunk/octave-forge/extra/lssa/lscomplex.m =================================================================== --- trunk/octave-forge/extra/lssa/lscomplex.m 2012-07-05 13:51:57 UTC (rev 10731) +++ trunk/octave-forge/extra/lssa/lscomplex.m 2012-07-05 14:11:58 UTC (rev 10732) @@ -23,7 +23,13 @@ ## @seealso{lsreal} ## @end deftypefn +%!test +%! shared t, x, o, maxfreq +%! maxfreq = 4 / ( 2 * pi ); t = [0:0.008:8]; x = ( 2.*sin(maxfreq.*t) + 3.*sin((3/4)*maxfreq.*t)- 0.5 .* sin((1/4)*maxfreq.*t) - 0.2 .* cos(maxfreq .* t) + cos((1/4)*maxfreq.*t)); o = [ maxfreq , 3 / 4 * maxfreq , 1 / 4 * maxfreq ]; +%! assert( lscomplex(t,x,maxfreq,2,2), [-0.40075 - 2.36687i , 1.22666 - 2.24390i , 1.93643 - 1.51554i , 2.12505 - 0.95410i ] ); + + function transform = lscomplex( t , x , omegamax , ncoeff , noctave ) n = length(t); ## VECTOR ONLY, and since t and x have the same number of entries, there's no problem. transform = zeros(1,ncoeff*noctave); Modified: trunk/octave-forge/extra/lssa/lsreal.m =================================================================== --- trunk/octave-forge/extra/lssa/lsreal.m 2012-07-05 13:51:57 UTC (rev 10731) +++ trunk/octave-forge/extra/lssa/lsreal.m 2012-07-05 14:11:58 UTC (rev 10732) @@ -23,6 +23,12 @@ ## ## @end deftypefn +%!shared t, x, o, maxfreq +%! maxfreq = 4 / ( 2 * pi ); +%! t = linspace(0,8); x = ( 2.*sin(maxfreq.*t) + 3.*sin((3/4)*maxfreq.*t) +%! - 0.5 .* sin((1/4)*maxfreq.*t) - 0.2 .* cos(maxfreq .* t) +%! + cos((1/4)*maxfreq.*t)); o = [ maxfreq , 3 / 4 * maxfreq , 1 / 4 * maxfreq ]; + function transform = lsreal( t, x, omegamax, ncoeff, noctave) ## the R function runs the following command: ## nureal( double X, double Y, int min(X,Y), int ncoeff, int noctave, double omegamax, complex rp) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <be...@us...> - 2012-07-12 05:03:42
|
Revision: 10742 http://octave.svn.sourceforge.net/octave/?rev=10742&view=rev Author: benjf5 Date: 2012-07-12 05:03:35 +0000 (Thu, 12 Jul 2012) Log Message: ----------- Fixed o18.csv (had the wrong data before) and added the beginning of a demonstration script. Modified Paths: -------------- trunk/octave-forge/extra/lssa/data/o18.csv trunk/octave-forge/extra/lssa/lombcoeff.m trunk/octave-forge/extra/lssa/lscomplex.m trunk/octave-forge/extra/lssa/lsreal.m Added Paths: ----------- trunk/octave-forge/extra/lssa/SampleScriptWithVostokData Added: trunk/octave-forge/extra/lssa/SampleScriptWithVostokData =================================================================== --- trunk/octave-forge/extra/lssa/SampleScriptWithVostokData (rev 0) +++ trunk/octave-forge/extra/lssa/SampleScriptWithVostokData 2012-07-12 05:03:35 UTC (rev 10742) @@ -0,0 +1,53 @@ +## Copyright (C) 2012 Benjamin Lewis +## Licensed under the GNU GPL v2 + +## This is just a sample script to introduce the purpose and usage of +## the Lomb-Scargle Least Squares method with experimental data, here +## using the Vostok ice core data collected and measured by J.R. Petit +## et. al. and published in Nature; also available from the NOAA's +## Paleoclimatology pages here: +## <http://www.ncdc.noaa.gov/paleo/icecore/antarctica/vostok/vostok_data.html>. + +co2 = csvread("./data/co2.csv")(2:end,2:end); +ch4 = csvread("./data/ch4.csv")(2:end,2:end); +o18 = csvread("./data/o18.csv")(2:end,2:end); +deut = csvread("./data/deut.csv")(2:end,2:end); +dust = csvread("./data/dust.csv")(2:end,2:end); +## The limited ranges are to deal with artifacts from the extraction of +## the R data, notably that it leaves an extra column on the front of 0s +## and the first row is text that Octave refuses to process. + +## Columns in co2 are Depth, Ice Age, Gas Age, and CO2 Concentration. +## Columns in ch4 are Depth, Ice Age, Gas Age, and CH4 Concentration. +## Columns in o18 are Depth, Ice Age, Gas Age, and Atmospheric O18. +## Columns in dust are Depth, Ice Age, Dust Concentration. +## Columns in deut are Depth, Ice Age, D concentration, and DeltaTS. + +co2_fig = figure("visible","off","name","CO2"); +ch4_fig = figure("visible","off","name","CH4"); +o18_fig = figure("visible","off","name","O18"); +deut_fig = figure("visible","off","name","Deuterium"); +dust_fig = figure("visible","off","name","Dust"); +## Generates figures and attaches handles to them for easy access. + +## Now we need some data to display; I'll run a few functions. +ls_complex_co2_ice_age = lscomplex(co2(:,2),co2(:,4),1,100,20); +ls_complex_co2_gas_age = lscomplex(co2(:,3),co2(:,4),1,100,20); +ls_real_co2_ice_age = lsreal(co2(:,2),co2(:,4),1,100,20); +ls_real_co2_gas_age = lsreal(co2(:,3),co2(:,4),1,100,20); + +figure(co2_fig); +subplot(4,2,1); +plot(-(co2(:,2)),co2(:,4)); +title("Gas levels over ice age"); +subplot(4,2,2); +plot(-(co2(:,3),co2(:,4)); +title("Gas levels over gas age"); +subplot(4,2,3); + + +## to implement: +## - displays of all the data and flaws in trying to model with just + ## using L-S data +## - correlations of every data set with every other data set +## - Comparing ls* results to periodogram results \ No newline at end of file Modified: trunk/octave-forge/extra/lssa/data/o18.csv =================================================================== --- trunk/octave-forge/extra/lssa/data/o18.csv 2012-07-10 14:20:31 UTC (rev 10741) +++ trunk/octave-forge/extra/lssa/data/o18.csv 2012-07-12 05:03:35 UTC (rev 10742) @@ -1,523 +1,319 @@ -"","depth.corrected","Ice.age..GT4.","Dust.Conc..ppm." -"1",124,4509,0.025 -"2",125,4552,0.018 -"3",128,4690,0.015 -"4",140,5259,0.033 -"5",149,5674,0.028 -"6",166,6486,0.013 -"7",174,6874,0.02 -"8",175,6924,0.018 -"9",182,7267,0.038 -"10",191,7697,0.023 -"11",192,7745,0.065 -"12",199,8091,0.038 -"13",220,9107,0.04 -"14",224,9298,0.05 -"15",244,10265,0.018 -"16",249,10515,0.03 -"17",256,10861,0.033 -"18",260,11053,0.045 -"19",274,11749,0.05 -"20",278,11973,0.025 -"21",288,12569,0.075 -"22",296,13055,0.075 -"23",299,13237,0.04 -"24",309,13828,0.033 -"25",319,14404,0.085 -"26",324,14713,0.163 -"27",325,14775,0.18 -"28",329,15032,0.17 -"29",349,16426,0.638 -"30",350,16502,0.773 -"31",352,16653,0.32 -"32",363,17544,1.098 -"33",374,18446,0.22 -"34",379,18870,1.21 -"35",399,20528,0.973 -"36",402,20777,0.71 -"37",403,20859,1.735 -"38",417,22023,0.733 -"39",424,22629,1.213 -"40",433,23412,1.745 -"41",447,24619,1.573 -"42",449,24781,0.668 -"43",451,24941,0.45 -"44",460,25697,0.968 -"45",474,26849,1.48 -"46",475,26933,1.353 -"47",492,28420,0.51 -"48",499,29006,0.415 -"49",500,29085,0.365 -"50",502,29249,0.783 -"51",524,31130,0.708 -"52",549,33209,0.495 -"53",574,35185,0.09 -"54",575,35261,0.113 -"55",598,37066,0.49 -"56",599,37148,0.603 -"57",601,37313,0.293 -"58",624,39185,0.203 -"59",625,39263,0.22 -"60",649,41191,0.188 -"61",650,41268,0.21 -"62",674,43073,0.238 -"63",675,43150,0.185 -"64",698,45055,0.19 -"65",699,45139,0.468 -"66",700,45225,0.375 -"67",724,47295,0.28 -"68",749,49350,0.128 -"69",750,49430,0.208 -"70",774,51306,0.073 -"71",775,51384,0.15 -"72",777,51549,0.295 -"73",799,53355,0.19 -"74",800,53436,0.165 -"75",802,53606,0.155 -"76",823,55377,0.278 -"77",824,55457,0.205 -"78",848,57289,0.21 -"79",849,57362,0.145 -"80",873,59262,0.833 -"81",874,59345,0.468 -"82",898,61406,0.475 -"83",899,61496,0.378 -"84",923,63688,0.98 -"85",924,63776,0.708 -"86",948,66045,1.1 -"87",949,66144,0.748 -"88",955,66708,0.425 -"89",973,68424,1.285 -"90",974,68520,0.86 -"91",984,69413,0.328 -"92",993,70243,0.305 -"93",998,70683,0.16 -"94",999,70766,0.063 -"95",1005,71264,0.085 -"96",1015,72070,0.098 -"97",1023,72753,0.155 -"98",1024,72840,0.053 -"99",1034,73706,0.19 -"100",1041,74322,0.205 -"101",1048,74903,0.063 -"102",1049,74985,0.103 -"103",1073,76854,0.073 -"104",1074,76933,0.075 -"105",1098,78937,0.178 -"106",1099,79020,0.233 -"107",1123,80869,0.28 -"108",1124,80943,0.193 -"109",1144,82352,0.078 -"110",1148,82647,0.188 -"111",1149,82721,0.223 -"112",1173,84378,0.068 -"113",1174,84448,0.058 -"114",1198,86016,0.065 -"115",1199,86083,0.078 -"116",1223,87766,0.09 -"117",1224,87837,0.09 -"118",1248,89597,0.19 -"119",1249,89672,0.208 -"120",1273,91480,0.113 -"121",1274,91547,0.12 -"122",1298,93254,0.27 -"123",1299,93325,0.238 -"124",1323,95000,0.07 -"125",1324,95070,0.103 -"126",1348,96722,0.048 -"127",1349,96791,0.043 -"128",1350,96861,0.053 -"129",1373,98505,0.075 -"130",1374,98572,0.068 -"131",1375,98640,0.005 -"132",1398,100232,0.17 -"133",1399,100301,0.14 -"134",1423,101868,0.133 -"135",1424,101930,0.11 -"136",1448,103481,0.248 -"137",1449,103553,0.18 -"138",1450,103625,0.315 -"139",1451,103697,0.258 -"140",1473,105271,0.058 -"141",1474,105342,0.058 -"142",1475,105413,0.058 -"143",1498,107048,0.128 -"144",1499,107121,0.098 -"145",1500,107194,0.085 -"146",1523,109121,0.093 -"147",1524,109206,0.05 -"148",1525,109292,0.065 -"149",1548,111159,0.07 -"150",1549,111239,0.043 -"151",1550,111319,0.01 -"152",1573,113195,0.05 -"153",1574,113272,0.078 -"154",1575,113348,0.043 -"155",1582,113891,0.068 -"156",1591,114562,0.058 -"157",1598,115077,0.035 -"158",1599,115150,0.08 -"159",1606,115617,0.028 -"160",1616,116296,0.048 -"161",1623,116762,0.033 -"162",1624,116827,0.028 -"163",1625,116891,0.073 -"164",1632,117326,0.068 -"165",1635,117514,0.015 -"166",1643,118012,0.035 -"167",1648,118314,0.038 -"168",1649,118376,0.058 -"169",1655,118735,0.11 -"170",1665,119345,0.045 -"171",1673,119831,0.04 -"172",1674,119894,0.038 -"173",1675,119955,0.073 -"174",1682,120379,0.053 -"175",1692,120959,0.085 -"176",1698,121314,0.02 -"177",1699,121373,0.013 -"178",1709,121951,0.018 -"179",1716,122345,0.213 -"180",1723,122742,0.055 -"181",1724,122801,0.053 -"182",1732,123268,0.06 -"183",1739,123658,0.04 -"184",1749,124209,0.12 -"185",1756,124599,0.048 -"186",1761,124877,0.043 -"187",1768,125271,0.028 -"188",1783,126103,0.078 -"189",1798,126904,0.048 -"190",1799,126955,0.06 -"191",1800,127006,0.26 -"192",1816,127810,0.043 -"193",1823,128161,0.028 -"194",1824,128210,0.038 -"195",1825,128259,0.045 -"196",1830,128501,0.018 -"197",1848,129428,0.135 -"198",1849,129486,0.115 -"199",1850,129545,0.02 -"200",1866,130410,0.035 -"201",1872,130759,0.015 -"202",1873,130819,0.113 -"203",1874,130880,0.038 -"204",1875,130942,0.14 -"205",1879,131190,0.045 -"206",1883,131439,0.033 -"207",1886,131641,0.023 -"208",1890,131908,0.02 -"209",1895,132264,0.03 -"210",1898,132477,0.048 -"211",1899,132548,0.045 -"212",1900,132619,0.078 -"213",1901,132691,0.055 -"214",1902,132763,0.038 -"215",1903,132836,0.055 -"216",1906,133065,0.025 -"217",1907,133142,0.06 -"218",1912,133528,0.06 -"219",1919,134091,0.105 -"220",1921,134266,0.095 -"221",1923,134447,0.5 -"222",1924,134538,0.12 -"223",1932,135308,0.298 -"224",1933,135408,0.095 -"225",1934,135507,0.105 -"226",1940,136103,0.16 -"227",1943,136411,0.123 -"228",1945,136614,0.245 -"229",1948,136923,0.883 -"230",1949,137026,0.86 -"231",1953,137446,0.158 -"232",1954,137549,0.183 -"233",1963,138532,0.288 -"234",1964,138644,0.235 -"235",1966,138868,0.553 -"236",1970,139308,0.338 -"237",1973,139643,0.848 -"238",1974,139756,0.498 -"239",1979,140319,0.405 -"240",1981,140542,0.553 -"241",1984,140876,0.688 -"242",1989,141434,0.245 -"243",1990,141547,0.438 -"244",1991,141661,0.303 -"245",1996,142218,0.565 -"246",1998,142440,1.01 -"247",1999,142551,0.753 -"248",2004,143117,0.625 -"249",2009,143675,0.74 -"250",2014,144237,0.46 -"251",2023,145226,0.973 -"252",2024,145337,0.673 -"253",2025,145449,0.738 -"254",2032,146242,0.528 -"255",2043,147459,0.423 -"256",2049,148141,0.77 -"257",2052,148471,0.158 -"258",2063,149679,0.265 -"259",2069,150333,0.55 -"260",2074,150868,0.418 -"261",2080,151502,0.325 -"262",2081,151611,0.318 -"263",2089,152513,0.313 -"264",2098,153523,0.871 -"265",2103,154094,0.305 -"266",2111,155029,1.177 -"267",2119,155983,1.228 -"268",2128,157080,0.671 -"269",2135,157909,0.715 -"270",2143,158815,0.426 -"271",2151,159651,0.13 -"272",2160,160626,0.237 -"273",2168,161545,0.728 -"274",2176,162440,0.238 -"275",2184,163318,0.22 -"276",2191,164136,0.36 -"277",2199,165148,0.618 -"278",2202,165522,0.092 -"279",2208,166284,0.271 -"280",2217,167414,0.115 -"281",2225,168391,0.154 -"282",2232,169201,0.073 -"283",2241,170221,0.151 -"284",2248,171040,0.284 -"285",2256,172004,0.307 -"286",2264,173027,0.025 -"287",2272,173988,0.105 -"288",2280,174920,0.142 -"289",2287,175746,0.232 -"290",2294,176630,0.391 -"291",2308,178417,0.341 -"292",2325,180546,0.202 -"293",2325,180546,0.067 -"294",2333,181502,0.138 -"295",2342,182694,0.236 -"296",2348,183525,0.561 -"297",2356,184641,0.715 -"298",2364,185788,0.761 -"299",2373,187067,0.274 -"300",2387,189030,0.147 -"301",2398,190469,0.05 -"302",2400,190705,0.055 -"303",2404,191156,0.016 -"304",2410,191895,0.114 -"305",2414,192382,0.067 -"306",2420,193152,0.142 -"307",2425,193816,0.141 -"308",2430,194444,0.052 -"309",2434,194926,0.104 -"310",2440,195676,0.113 -"311",2444,196202,0.221 -"312",2451,197086,0.067 -"313",2454,197462,0.111 -"314",2459,198075,0.114 -"315",2462,198426,0.074 -"316",2471,199452,0.047 -"317",2473,199682,0.052 -"318",2475,199904,0.063 -"319",2477,200124,0.048 -"320",2479,200345,0.021 -"321",2491,201635,0.03 -"322",2502,202826,0.029 -"323",2505,203155,0.024 -"324",2505.41,203200,0.024 -"325",2508.41,203527,0.023 -"326",2509,203592,0.021 -"327",2512.41,203980,0.02 -"328",2515,204278,0.029 -"329",2515.41,204325,0.028 -"330",2521,204973,0.022 -"331",2524.41,205386,0.032 -"332",2525,205458,0.024 -"333",2527.41,205760,0.032 -"334",2531,206232,0.025 -"335",2531.41,206287,0.028 -"336",2534.41,206681,0.031 -"337",2537.41,207072,0.042 -"338",2540.41,207463,0.041 -"339",2543.41,207857,0.023 -"340",2545,208061,0.029 -"341",2546.41,208244,0.023 -"342",2549.41,208623,0.031 -"343",2555.41,209364,0.028 -"344",2559.41,209864,0.021 -"345",2564.41,210466,0.023 -"346",2568.41,210941,0.032 -"347",2569.41,211057,0.015 -"348",2574.41,211651,0.022 -"349",2576.41,211892,0.04 -"350",2579.41,212237,0.029 -"351",2583.41,212700,0.03 -"352",2585.41,212928,0.022 -"353",2597.41,214297,0.031 -"354",2600.41,214639,0.018 -"355",2603.41,214978,0.06 -"356",2607.41,215432,0.022 -"357",2612.41,216003,0.036 -"358",2612.41,216003,0.054 -"359",2615.41,216369,0.029 -"360",2619.41,216839,0.032 -"361",2629.41,217989,0.022 -"362",2634.41,218602,0.035 -"363",2637.41,219000,0.082 -"364",2640.41,219393,0.041 -"365",2642.41,219660,0.053 -"366",2646.41,220226,0.093 -"367",2651.41,220967,0.077 -"368",2653.41,221272,0.069 -"369",2660.41,222426,0.119 -"370",2664.41,223135,0.138 -"371",2667.41,223681,0.194 -"372",2670.41,224240,0.158 -"373",2674.41,224959,0.029 -"374",2677.41,225469,0.085 -"375",2680.41,225971,0.069 -"376",2684.41,226653,0.036 -"377",2691.41,227958,0.076 -"378",2694.41,228488,0.07 -"379",2697.41,229052,0.045 -"380",2701.41,229802,0.073 -"381",2703.41,230161,0.031 -"382",2706.41,230691,0.076 -"383",2715.41,232206,0.036 -"384",2715.41,232206,0.043 -"385",2718.41,232682,0.039 -"386",2719.41,232838,0.007 -"387",2721.41,233146,0.033 -"388",2721.41,233146,0.055 -"389",2723.41,233453,0.056 -"390",2733.41,234896,0.096 -"391",2736.41,235329,0.038 -"392",2748.41,236970,0.058 -"393",2751.41,237338,0.033 -"394",2754.41,237690,0.083 -"395",2756.41,237912,0.079 -"396",2762.41,238578,0.012 -"397",2765.41,238932,0.015 -"398",2768.41,239298,0.014 -"399",2771.41,239698,0.011 -"400",2774.41,240141,0.029 -"401",2777.41,240614,0.014 -"402",2780.41,241118,0.06 -"403",2780.41,241118,0.067 -"404",2783.41,241674,0.029 -"405",2786.41,242267,0.083 -"406",2789.41,242850,0.039 -"407",2792.41,243406,0.023 -"408",2795.41,243999,0.06 -"409",2797.41,244424,0.131 -"410",2797.41,244424,0.052 -"411",2798.41,244639,0.156 -"412",2801.41,245283,0.104 -"413",2807.41,246574,0.378 -"414",2816.41,248545,0.191 -"415",2819.41,249219,0.116 -"416",2825.41,250501,0.078 -"417",2828.41,251104,0.169 -"418",2834.41,252422,0.208 -"419",2837.41,253075,0.12 -"420",2840.41,253763,0.115 -"421",2846.41,255056,0.219 -"422",2849.41,255711,0.053 -"423",2852.41,256387,0.223 -"424",2858.41,257827,0.439 -"425",2864.41,259340,1.012 -"426",2868.41,260380,0.64 -"427",2871.41,261179,0.942 -"428",2874.41,261973,0.167 -"429",2878.41,263043,0.554 -"430",2883.41,264383,0.791 -"431",2888.41,265707,0.558 -"432",2897.41,268050,0.093 -"433",2903.41,269532,0.168 -"434",2907.41,270507,0.077 -"435",2913.41,271920,0.017 -"436",2918.41,273037,0.085 -"437",2922.41,273918,0.123 -"438",2928.41,275216,0.086 -"439",2937.41,277120,0.045 -"440",2943.41,278456,0.08 -"441",2948.41,279632,0.146 -"442",2954.41,281175,0.184 -"443",2958.41,282253,0.14 -"444",2968.41,284925,0.204 -"445",2974.41,286639,0.041 -"446",2978.41,287726,0.059 -"447",2981.41,288530,0.059 -"448",2987.41,290214,0.066 -"449",2993.41,291830,0.054 -"450",2998.41,293076,0.042 -"451",3001.41,293893,0.063 -"452",3005.41,295035,0.045 -"453",3008.41,295862,0.09 -"454",3017.41,298327,0.257 -"455",3021.41,299383,0.097 -"456",3025.41,300397,0.078 -"457",3028.41,301156,0.053 -"458",3031.41,301917,0.032 -"459",3034.41,302691,0.013 -"460",3035.41,302937,0.029 -"461",3038.41,303657,0.022 -"462",3044.41,305288,0.021 -"463",3047.41,306200,0.111 -"464",3050.41,307131,0.102 -"465",3053.41,308031,0.026 -"466",3056.41,308907,0.02 -"467",3058.41,309483,0.009 -"468",3061.41,310330,0.036 -"469",3065.41,311411,0.022 -"470",3068.41,312208,0.019 -"471",3077.41,314543,0.021 -"472",3080.41,315297,0.045 -"473",3085.41,316524,0.02 -"474",3086.41,316765,0.027 -"475",3088.41,317255,0.044 -"476",3091.41,317999,0.037 -"477",3098.41,319708,0.019 -"478",3107.41,321875,0.032 -"479",3110.41,322513,0.014 -"480",3118.41,324218,0.008 -"481",3124.41,325629,0.012 -"482",3128.41,326761,0.01 -"483",3131.41,327730,0.046 -"484",3137.41,329848,0.117 -"485",3140.41,331050,0.142 -"486",3147.41,334306,0.586 -"487",3148.41,334805,1.035 -"488",3152.41,336766,0.395 -"489",3155.41,338233,0.366 -"490",3158.41,339706,0.439 -"491",3161.41,341187,0.164 -"492",3164.41,342594,0.034 -"493",3172.41,346523,0.277 -"494",3178.41,349620,0.401 -"495",3188.41,355187,0.38 -"496",3194.41,358466,0.24 -"497",3197.41,360071,0.155 -"498",3205.41,364333,0.076 -"499",3208.41,365962,0.268 -"500",3211.41,367507,0.058 -"501",3214.41,369034,0.091 -"502",3218.41,371188,0.224 -"503",3221.41,372991,0.208 -"504",3224.41,374711,0.071 -"505",3227.41,376381,0.085 -"506",3233.41,379524,0.019 -"507",3236.41,381227,0.125 -"508",3238.41,382318,0.033 -"509",3248.41,388065,0.122 -"510",3254.41,391928,0.114 -"511",3257.41,393908,0.157 -"512",3260.41,395792,0.023 -"513",3263.41,397482,0.023 -"514",3266.41,399134,0.019 -"515",3268.41,400228,0.021 -"516",3274.41,403501,0.033 -"517",3278.41,405617,0.016 -"518",3287.41,410200,0.018 -"519",3288.41,410683,0.012 -"520",3300.41,417095,0.013 -"521",3306.41,420527,0.015 -"522",3308.41,421761,0.012 +"","Depth.corrected","Ice.age..GT4.","gas.age..GT4.","Atm.O18" +"1",114.8,4095,724,-0.06 +"2",116.3,4168,813,0.03 +"3",120.3,4352,987,-0.06 +"4",125.2,4561,1184,-0.02 +"5",130.1,4791,1418,0.08 +"6",135.3,5039,1675,0.04 +"7",139.7,5245,1932,-0.05 +"8",139.8,5250,1935,0.14 +"9",143.7,5429,2108,-0.09 +"10",149.6,5702,2370,-0.05 +"11",152.8,5854,2541,-0.09 +"12",156.9,6048,2745,-0.08 +"13",161.8,6279,3041,-0.11 +"14",165.1,6441,3214,-0.13 +"15",166.8,6526,3306,-0.05 +"16",169.7,6665,3453,-0.15 +"17",174.2,6884,3679,0.06 +"18",174.6,6905,3695,-0.14 +"19",177.1,7028,3814,0.04 +"20",184.3,7379,4262,0.15 +"21",184.9,7408,4299,-0.19 +"22",205.6,8403,5207,-0.18 +"23",213.1,8768,5529,-0.13 +"24",213.8,8801,5559,-0.2 +"25",224,9298,6009,-0.24 +"26",230,9589,6278,-0.05 +"27",230.4,9608,6293,-0.11 +"28",250,10564,7313,0.1 +"29",252.9,10711,7475,-0.21 +"30",270.8,11579,8285,0.04 +"31",271.3,11606,8318,0.06 +"32",280.2,12099,8808,0.04 +"33",280.9,12139,8856,-0.11 +"34",281.3,12161,8879,-0.38 +"35",290.4,12719,9443,0.24 +"36",291.3,12773,9503,0.33 +"37",294.5,12964,9655,0.25 +"38",298.5,13208,9898,0.29 +"39",299.5,13267,9952,0.24 +"40",311.1,13944,10544,0.58 +"41",311.6,13971,10570,0.32 +"42",322.6,14627,11066,0.88 +"43",322.8,14639,11073,0.93 +"44",330.5,15133,11288,0.9 +"45",336.7,15549,11499,0.72 +"46",345.8,16185,11909,0.87 +"47",355.9,16962,12609,1.11 +"48",363.9,17618,13299,1.02 +"49",372,18283,13850,1.21 +"50",372.1,18291,13853,0.97 +"51",383,19199,14302,1.06 +"52",396.1,20286,14927,1.23 +"53",400.2,20628,15123,0.91 +"54",410.2,21459,15615,0.92 +"55",422.3,22483,16185,1.16 +"56",422.4,22491,16189,1.33 +"57",431.4,23270,16719,0.97 +"58",446.5,24579,17937,0.98 +"59",456.5,25402,18797,0.89 +"60",467.6,26310,19661,0.74 +"61",476.7,27079,20435,0.98 +"62",486.7,27969,21288,0.82 +"63",495.8,28752,21999,0.67 +"64",496.8,28832,22076,0.76 +"65",502.4,29282,22590,0.9 +"66",511.9,30114,23561,0.49 +"67",515.5,30411,23928,1.02 +"68",528,31473,25057,0.44 +"69",537.1,32227,25812,0.44 +"70",547.1,33047,26477,0.41 +"71",562,34281,27904,0.37 +"72",571.9,35024,28784,0.33 +"73",576.4,35366,29056,0.47 +"74",576.5,35374,29062,0.52 +"75",597.8,37049,30942,0.35 +"76",615.8,38518,32740,0.64 +"77",627.8,39483,34133,0.58 +"78",631.5,39774,34495,0.58 +"79",636.8,40205,34893,0.57 +"80",637.8,40291,34947,0.29 +"81",645.7,40930,35449,0.49 +"82",659.7,41977,36237,0.46 +"83",671.7,42892,37241,0.49 +"84",677.7,43359,37752,0.57 +"85",686.6,44086,38599,0.52 +"86",696.6,44939,39582,0.43 +"87",709.6,46070,41011,0.57 +"88",721.5,47092,41928,0.65 +"89",734.5,48176,42711,0.46 +"90",747.5,49233,43509,0.5 +"91",759.4,50169,44336,0.43 +"92",771.4,51117,45279,0.43 +"93",784.4,52146,46655,0.29 +"94",796.3,53133,47826,0.18 +"95",809.3,54224,49156,0.31 +"96",821.3,55243,50188,0.56 +"97",834.2,56254,51152,0.37 +"98",846.2,57154,51881,0.33 +"99",859.2,58148,52763,0.22 +"100",871.1,59101,53867,0.3 +"101",884.1,60185,55442,0.26 +"102",892.2,60887,56257,0.6 +"103",897.1,61326,56713,0.31 +"104",909,62401,57529,0.77 +"105",921,63512,58373,0.71 +"106",934,64698,59346,0.8 +"107",945.9,65847,60229,0.72 +"108",959.9,67169,61370,0.77 +"109",970.9,68222,62301,0.67 +"110",983.8,69393,63515,0.83 +"111",1020.5,72532,66581,0.77 +"112",1032.6,73589,67850,0.78 +"113",1045.6,74703,69299,0.71 +"114",1056.7,75602,70607,0.65 +"115",1069.8,76605,71543,0.56 +"116",1082.8,77674,72407,0.58 +"117",1095.9,78766,73689,0.42 +"118",1108,79714,74974,0.35 +"119",1121,80719,75937,0.31 +"120",1133.1,81599,76634,0.37 +"121",1146.2,82515,77505,0.14 +"122",1158.3,83352,78596,0.07 +"123",1171.3,84259,79753,0.02 +"124",1183.4,85062,80841,-0.05 +"125",1196.5,85915,81826,-0.03 +"126",1209.5,86812,82827,-0.25 +"127",1221.6,87666,83681,-0.21 +"128",1233.7,88548,84668,0.21 +"129",1234.7,88623,84733,0.13 +"130",1245.6,89419,85433,0.37 +"131",1246.8,89512,85498,0.05 +"132",1258.8,90423,86174,0.31 +"133",1284,92259,87755,0.26 +"134",1297,93180,88597,0.37 +"135",1309.1,94033,89355,0.23 +"136",1322.2,94946,90430,0.33 +"137",1334.2,95775,91475,0.43 +"138",1347.3,96673,92352,0.47 +"139",1358.4,97469,93181,0.56 +"140",1384.5,99310,95132,0.48 +"141",1408.7,100949,96632,0.41 +"142",1432.8,102476,98365,0.02 +"143",1444.9,103266,99254,-0.11 +"144",1459,104266,100462,-0.07 +"145",1473,105271,101636,-0.11 +"146",1485.1,106121,102314,-0.01 +"147",1496.2,106917,102869,-0.14 +"148",1507.2,107784,103548,-0.14 +"149",1512.3,108224,104017,0.06 +"150",1520.3,108897,104686,0.14 +"151",1529.3,109650,105444,0.33 +"152",1539.4,110459,106102,0.46 +"153",1551.5,111439,106686,0.44 +"154",1566.2,112644,107470,0.59 +"155",1592,114639,109824,0.73 +"156",1636.3,117593,113370,0.73 +"157",1656.1,118802,115226,0.39 +"158",1683.3,120457,117267,0.28 +"159",1693.1,121024,117891,-0.07 +"160",1716.7,122384,119319,-0.21 +"161",1732.7,123308,120424,-0.19 +"162",1757,124654,121904,-0.25 +"163",1784.3,126177,123521,-0.34 +"164",1823.5,128186,125622,-0.22 +"165",1831.9,128592,126162,-0.21 +"166",1845.2,129284,127030,0.17 +"167",1858,129971,127752,0.27 +"168",1868.5,130554,128325,0.65 +"169",1882.3,131393,128995,1 +"170",1883.4,131465,129069,0.9 +"171",1907.6,133188,130379,1.13 +"172",1934.5,135557,131959,1.23 +"173",1954.6,137611,133340,1.21 +"174",1955.8,137733,133418,1.12 +"175",1965.5,138812,133941,1.16 +"176",1982.3,140689,135202,1.03 +"177",1990.8,141637,135994,0.86 +"178",2016.4,144496,138408,0.91 +"179",2058.8,149220,143362,0.59 +"180",2092.1,152863,147205,0.6 +"181",2104,154207,148765,0.74 +"182",2112.1,155163,149816,0.82 +"183",2132.2,157583,151981,0.98 +"184",2142,158702,153069,0.89 +"185",2161.1,160751,154894,0.88 +"186",2170,161776,156102,0.8 +"187",2191,164136,159270,0.87 +"188",2201.1,165412,160281,0.79 +"189",2222.4,168089,162810,0.66 +"190",2236.1,169649,163928,0.38 +"191",2254.1,171772,166309,0.09 +"192",2281.1,175045,169989,0.11 +"193",2293,176501,171357,-0.13 +"194",2301,177517,172412,-0.1 +"195",2312.2,178992,174181,0.04 +"196",2332,181382,176144,-0.01 +"197",2341.1,182570,177430,0.24 +"198",2353.1,184243,179606,0.47 +"199",2372.1,186941,181627,0.88 +"200",2391.1,189582,184076,0.87 +"201",2404.5,191213,185778,0.72 +"202",2415.4,192560,187408,0.53 +"203",2425.6,193893,189454,0.47 +"204",2435.6,195126,190962,0.38 +"205",2444.1,196215,191858,0.12 +"206",2455.2,197612,193211,-0.11 +"207",2465.2,198790,194611,-0.03 +"208",2472.2,199590,195320,-0.11 +"209",2492.2,201763,198189,-0.14 +"210",2502.4,202870,199497,-0.06 +"211",2509,203592,200370,-0.15 +"212",2512.4,203979,200759,0.04 +"213",2514.8,204256,201104,-0.02 +"214",2520.4,204903,201707,0.2 +"215",2520.8,204948,201751,0.03 +"216",2530.7,206189,202917,0.39 +"217",2531.7,206327,203049,0.15 +"218",2536.8,206995,203585,0.39 +"219",2546.4,208243,204656,0.66 +"220",2549.7,208659,204934,0.52 +"221",2554.8,209293,205426,0.51 +"222",2572.7,211450,207759,0.47 +"223",2586.7,213077,209691,0.35 +"224",2595.7,214103,210894,0.26 +"225",2607.7,215464,212419,0.06 +"226",2616.7,216523,213539,-0.06 +"227",2625.7,217550,214611,-0.12 +"228",2634.7,218639,215622,-0.14 +"229",2644.7,219976,217045,0 +"230",2649.7,220719,217606,0.13 +"231",2658.7,222130,218640,0.05 +"232",2667.2,223642,219735,0.08 +"233",2677.2,225433,221031,0.14 +"234",2686.2,226975,222104,0.44 +"235",2692.2,228100,223181,0.51 +"236",2699.2,229392,224894,0.77 +"237",2706.2,230654,225994,0.84 +"238",2712.2,231682,226779,0.68 +"239",2718.2,232649,227928,0.65 +"240",2734.2,235013,231061,0.37 +"241",2736.2,235299,231478,0.27 +"242",2739.2,235722,232087,0.24 +"243",2743.2,236277,232849,0.09 +"244",2745.2,236545,233199,-0.01 +"245",2763.9,238752,235990,0.03 +"246",2772.9,239913,237741,0.48 +"247",2778.9,240859,238490,0.76 +"248",2787.9,242559,239486,0.75 +"249",2796.9,244313,240495,0.62 +"250",2802.9,245599,241301,0.63 +"251",2811.9,247548,243128,0.84 +"252",2820.9,249542,244726,0.75 +"253",2828.9,251206,246382,0.63 +"254",2835.9,252757,247944,0.51 +"255",2844.9,254756,250337,0.45 +"256",2853.9,256735,252048,0.37 +"257",2859.9,258202,253691,0.47 +"258",2869.9,260776,255933,0.59 +"259",2877.9,262907,257646,0.69 +"260",2885.9,265028,259567,0.66 +"261",2891.9,266614,261142,0.66 +"262",2900.9,268897,263563,0.73 +"263",2909.9,271097,266106,0.56 +"264",2918.9,273148,268568,0.4 +"265",2924.9,274459,270247,0.2 +"266",2933.9,276388,272620,0 +"267",2942.9,278337,274784,-0.15 +"268",2948.9,279752,276308,-0.09 +"269",2957.9,282123,278250,0 +"270",2965.9,284181,279851,-0.03 +"271",2971.9,285948,281656,0.09 +"272",2980.9,288387,283752,0.53 +"273",2989.9,290913,286629,0.6 +"274",2995.9,292475,288134,0.59 +"275",3004.9,294900,291089,0.45 +"276",3013.9,297367,293273,0.25 +"277",3019.9,298989,295052,-0.02 +"278",3028.9,301282,297568,0.02 +"279",3037.9,303533,300215,0.19 +"280",3043.9,305141,301918,0.26 +"281",3052.9,307880,304243,0.57 +"282",3061.9,310471,306589,0.59 +"283",3067.9,312072,308551,0.56 +"284",3076.9,314415,311344,0.38 +"285",3085.9,316647,313862,0.18 +"286",3091.9,318123,315533,-0.03 +"287",3100.9,320329,317837,-0.21 +"288",3109.9,322409,319956,-0.16 +"289",3115.9,323676,321706,0.03 +"290",3124.9,325754,323802,0.77 +"291",3130.9,327565,325218,1.02 +"292",3142.9,332112,328540,1.12 +"293",3147.9,334555,330355,1.19 +"294",3154.9,337989,332841,1.21 +"295",3160.9,340942,336045,1.05 +"296",3163.9,342356,337494,0.92 +"297",3172.9,346772,342238,0.7 +"298",3178.9,349884,345278,0.67 +"299",3184.9,353220,348373,0.68 +"300",3190.9,356559,351525,0.67 +"301",3196.9,359819,355044,0.63 +"302",3199.9,361384,356764,0.41 +"303",3208.9,366230,361967,0.07 +"304",3211.9,367764,363534,0.11 +"305",3220.9,372699,368878,0.23 +"306",3226.9,376115,371710,0.33 +"307",3232.9,379228,375539,0.15 +"308",3238.9,382590,378831,0.39 +"309",3244.9,385814,382627,0.35 +"310",3250.9,389631,385590,0.65 +"311",3259.9,395516,391478,0.52 +"312",3268.9,400502,397554,0.55 +"313",3274.9,403775,401044,0.38 +"314",3277.9,405354,402666,0.24 +"315",3284.9,408947,406607,0.02 +"316",3290.9,411959,409860,-0.08 +"317",3296.9,415188,412938,0.02 +"318",3299.9,416824,414603,-0.06 Modified: trunk/octave-forge/extra/lssa/lombcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/lombcoeff.m 2012-07-10 14:20:31 UTC (rev 10741) +++ trunk/octave-forge/extra/lssa/lombcoeff.m 2012-07-12 05:03:35 UTC (rev 10742) @@ -22,19 +22,19 @@ ## @seealso{lombnormcoeff} ## @end deftypefn -%!shared t, x, o, maxfreq +%!test +%! shared t, x, o, maxfreq %! maxfreq = 4 / ( 2 * pi ); %! t = linspace(0,8); x = ( 2.*sin(maxfreq.*t) + 3.*sin((3/4)*maxfreq.*t) %! - 0.5 .* sin((1/4)*maxfreq.*t) - 0.2 .* cos(maxfreq .* t) %! + cos((1/4)*maxfreq.*t)); o = [ maxfreq , 3 / 4 * maxfreq , 1 / 4 * maxfreq ]; -%! assert( lombcoeff(t,x,o(1)) = ); -%! assert( lombcoeff(t,x,o(2)) = ); -%! assert( lombcoeff(t,x,o(3)) = ); +%!assert( lombcoeff(t,x,o(1)),10788.9848389923,5e-10 ); +%!assert( lombcoeff(t,x,o(2)),12352.6413413457,5e-10 ); +%!assert( lombcoeff(t,x,o(3)),13673.4098969780,5e-10 ); 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 - tau))**2)/(sum(cos(o.*T-tau).**2)) + - ( sum(X .* sin(o .* T - tau))**2)/(sum(sin(o.*T-tau).**2)); + 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 Modified: trunk/octave-forge/extra/lssa/lscomplex.m =================================================================== --- trunk/octave-forge/extra/lssa/lscomplex.m 2012-07-10 14:20:31 UTC (rev 10741) +++ trunk/octave-forge/extra/lssa/lscomplex.m 2012-07-12 05:03:35 UTC (rev 10742) @@ -26,7 +26,7 @@ %!test %! shared t, x, o, maxfreq %! maxfreq = 4 / ( 2 * pi ); t = [0:0.008:8]; x = ( 2.*sin(maxfreq.*t) + 3.*sin((3/4)*maxfreq.*t)- 0.5 .* sin((1/4)*maxfreq.*t) - 0.2 .* cos(maxfreq .* t) + cos((1/4)*maxfreq.*t)); o = [ maxfreq , 3 / 4 * maxfreq , 1 / 4 * maxfreq ]; -%! assert( lscomplex(t,x,maxfreq,2,2), [-0.40075 - 2.36687i , 1.22666 - 2.24390i , 1.93643 - 1.51554i , 2.12505 - 0.95410i ] ); +%! assert( lscomplex(t,x,maxfreq,2,2), [-0.400754376933531 - 2.366871097665244i, 1.226663545950135 - 2.243899314661490i, 1.936433327880238 - 1.515538553198501i, 2.125045509991203 - 0.954100898917708i ], 6e-14 ); Modified: trunk/octave-forge/extra/lssa/lsreal.m =================================================================== --- trunk/octave-forge/extra/lssa/lsreal.m 2012-07-10 14:20:31 UTC (rev 10741) +++ trunk/octave-forge/extra/lssa/lsreal.m 2012-07-12 05:03:35 UTC (rev 10742) @@ -25,9 +25,10 @@ %!shared t, x, o, maxfreq %! maxfreq = 4 / ( 2 * pi ); -%! t = linspace(0,8); x = ( 2.*sin(maxfreq.*t) + 3.*sin((3/4)*maxfreq.*t) -%! - 0.5 .* sin((1/4)*maxfreq.*t) - 0.2 .* cos(maxfreq .* t) -%! + cos((1/4)*maxfreq.*t)); o = [ maxfreq , 3 / 4 * maxfreq , 1 / 4 * maxfreq ]; +%! t = linspace(0,8); +%! x = ( 2.*sin(maxfreq.*t) + 3.*sin((3/4)*maxfreq.*t) - 0.5 .* sin((1/4)*maxfreq.*t) - 0.2 .* cos(maxfreq .* t) + cos((1/4)*maxfreq.*t)); +%! assert(lsreal(t,x,maxfreq,2,2),[-1.68275915310663 + 4.70126183846743i, 1.93821553170889 + 4.95660209883437i, 4.38145452686697 + 2.14403733658600i, 5.27425332281147 - 0.73933440226597i],6e-14) +%! #In the assert here, I've got an error bound large enough to catch individual system errors which would present no real issue. function transform = lsreal( t, x, omegamax, ncoeff, noctave) ## the R function runs the following command: @@ -38,7 +39,7 @@ ## where rp = complex(noctave*ncoeff) so ... I can just store that as noctave*ncoeff and have no ## problems, I guess. ## Possibly throw an error if ncoeff <= 0. - k = n = min(length(x),length(t)); ## THIS IS VECTOR-ONLY. I'd need to add another bit of code to + k = n = length(t); ## THIS IS VECTOR-ONLY. I'd need to add another bit of code to ## make it array-safe, and that's not knowing right now what else will be necessary. transform = zeros(1,(noctave * ncoeff)); ## In the C code, this is rendered as a Complex, but Octave doesn't care. od = 2 ^ ( - 1 / ncoeff ); ## this will cause a crash if ncoeff=0; prefer error & quit? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <be...@us...> - 2012-07-17 00:18:12
|
Revision: 10744 http://octave.svn.sourceforge.net/octave/?rev=10744&view=rev Author: benjf5 Date: 2012-07-17 00:18:06 +0000 (Tue, 17 Jul 2012) Log Message: ----------- fastlscomplex has been mostly rewritten, and has problems with rounding errors (but generates some correct results!). Modified Paths: -------------- trunk/octave-forge/extra/lssa/SampleScriptWithVostokData trunk/octave-forge/extra/lssa/fastlscomplex.cc Modified: trunk/octave-forge/extra/lssa/SampleScriptWithVostokData =================================================================== --- trunk/octave-forge/extra/lssa/SampleScriptWithVostokData 2012-07-15 20:13:22 UTC (rev 10743) +++ trunk/octave-forge/extra/lssa/SampleScriptWithVostokData 2012-07-17 00:18:06 UTC (rev 10744) @@ -35,17 +35,190 @@ ls_complex_co2_gas_age = lscomplex(co2(:,3),co2(:,4),1,100,20); ls_real_co2_ice_age = lsreal(co2(:,2),co2(:,4),1,100,20); ls_real_co2_gas_age = lsreal(co2(:,3),co2(:,4),1,100,20); +ls_complex_ch4_ice_age = lscomplex(ch4(:,2),ch4(:,4),1,100,20); +ls_complex_ch4_gas_age = lscomplex(ch4(:,3),ch4(:,4),1,100,20); +ls_real_ch4_ice_age = lsreal(ch4(:,2),ch4(:,4),1,100,20); +ls_real_ch4_gas_age = lsreal(ch4(:,3),ch4(:,4),1,100,20); +ls_complex_o18_ice_age = lscomplex(o18(:,2),o18(:,4),1,100,20); +ls_complex_o18_gas_age = lscomplex(o18(:,3),o18(:,4),1,100,20); +ls_real_o18_ice_age = lsreal(o18(:,2),o18(:,4),1,100,20); +ls_real_o18_gas_age = lsreal(o18(:,3),o18(:,4),1,100,20); +ls_complex_deut = lscomplex(deut(:,2),deut(:,3),1,100,20); +ls_real_deut = lsreal(deut(:,2),deut(:,3),1,100,20); +ls_complex_dust = lscomplex(dust(:,2),dust(:,3),1,100,20); +ls_real_dust = lsreal(dust(:,2),dust(:,3),1,100,20); +x_data_axis_vector = [ -430000, 0 ]; +## Useful because all of the data extends over 430 000 years up to the +## present. + +## Setting up the CO2 plots: figure(co2_fig); subplot(4,2,1); +axis(x_data_axis_vector); plot(-(co2(:,2)),co2(:,4)); title("Gas levels over ice age"); subplot(4,2,2); +axis(x_data_axis_vector); plot(-(co2(:,3),co2(:,4)); title("Gas levels over gas age"); subplot(4,2,3); +plot(real(ls_complex_co2_ice_age)); +hold on; +plot(imag(ls_complex_co2_ice_age),'r'); +title("Complex L-S transform of Gas/ice age data"); +legend("Real part","Imaginary part"); +subplot(4,2,4); +plot(real(ls_complex_co2_gas_age)); +hold on; +plot(imag(ls_complex_co2_gas_age),'r'); +title("Complex L-S transform of Gas/gas age data"); +legend("Real part","Imaginary part"); +subplot(4,2,5); +plot(real(ls_real_co2_ice_age)); +hold on; +plot(imag(ls_real_co2_ice_age),'r'); +title("Real L-S transform of Gas/ice age data"); +legend("Real part","Imaginary part"); +subplot(4,2,6); +plot(real(ls_real_co2_gas_age)); +hold on; +plot(imag(ls_real_co2_gas_age)); +title("Real L-S transform of Gas/gas age data"); +legend("Real part","Imaginary part"); +## At this point, we have transforms of both datasets, real and complex, +## and just need to figure out what cool thing to do with the remaining slot. +## Setting up the CH4 plots +figure(ch4_fig); +subplot(4,2,1); +axis(x_data_axis_vector); +plot(-(ch4(:,2)),ch4(:,4)); +title("Gas levels over ice age"); +subplot(4,2,2); +axis(x_data_axis_vector); +plot(-(ch4(:,3),ch4(:,4)); +title("Gas levels over gas age"); +subplot(4,2,3); +plot(real(ls_complex_ch4_ice_age)); +hold on; +plot(imag(ls_complex_ch4_ice_age),'r'); +title("Complex L-S transform of Gas/ice age data"); +legend("Real part","Imaginary part"); +subplot(4,2,4); +plot(real(ls_complex_ch4_gas_age)); +hold on; +plot(imag(ls_complex_ch4_gas_age),'r'); +title("Complex L-S transform of Gas/gas age data"); +legend("Real part","Imaginary part"); +subplot(4,2,5); +plot(real(ls_real_ch4_ice_age)); +hold on; +plot(imag(ls_real_ch4_ice_age),'r'); +title("Real L-S transform of Gas/ice age data"); +legend("Real part","Imaginary part"); +subplot(4,2,6); +plot(real(ls_real_ch4_gas_age)); +hold on; +plot(imag(ls_real_ch4_gas_age)); +title("Real L-S transform of Gas/gas age data"); +legend("Real part","Imaginary part"); +## Setting up the O18 plots: +figure(o18_fig); +subplot(4,2,1); +axis(x_data_axis_vector); +plot(-(o18(:,2)),o18(:,4)); +title("Gas levels over ice age"); +subplot(4,2,2); +axis(x_data_axis_vector); +plot(-(o18(:,3),o18(:,4)); +title("Gas levels over gas age"); +subplot(4,2,3); +plot(real(ls_complex_o18_ice_age)); +hold on; +plot(imag(ls_complex_o18_ice_age),'r'); +title("Complex L-S transform of Gas/ice age data"); +legend("Real part","Imaginary part"); +subplot(4,2,4); +plot(real(ls_complex_o18_gas_age)); +hold on; +plot(imag(ls_complex_o18_gas_age),'r'); +title("Complex L-S transform of Gas/gas age data"); +legend("Real part","Imaginary part"); +subplot(4,2,5); +plot(real(ls_real_o18_ice_age)); +hold on; +plot(imag(ls_real_o18_ice_age),'r'); +title("Real L-S transform of Gas/ice age data"); +legend("Real part","Imaginary part"); +subplot(4,2,6); +plot(real(ls_real_o18_gas_age)); +hold on; +plot(imag(ls_real_o18_gas_age)); +title("Real L-S transform of Gas/gas age data"); +legend("Real part","Imaginary part"); + +## Setting up Dust plots: +figure(dust_fig); +subplot(4,1,1); +axis(x_data_axis_vector); +plot(-(dust(:,2)),dust(:,3)); +title("Dust levels over ice age"); +subplot(4,1,2); +plot(real(ls_complex_dust_ice_age)); +hold on; +plot(imag(ls_complex_dust_ice_age),'r'); +title("Complex L-S transform of Dust/ice age data"); +legend("Real part","Imaginary part"); +subplot(4,1,3); +plot(real(ls_real_dust_ice_age)); +hold on; +plot(imag(ls_real_dust_ice_age),'r'); +title("Real L-S transform of Dust/ice age data"); +legend("Real part","Imaginary part"); + +## Setting up Deuterium plots: +figure(deut_fig); +subplot(4,1,1); +axis(x_data_axis_vector); +plot(-(deut(:,2)),deut(:,3)); +title("Deuterium levels over ice age"); +subplot(4,1,2); +plot(real(ls_complex_deut_ice_age)); +hold on; +plot(imag(ls_complex_deut_ice_age),'r'); +title("Complex L-S transform of Deuterium/ice age data"); +legend("Real part","Imaginary part"); +subplot(4,1,3); +plot(real(ls_real_deut_ice_age)); +hold on; +plot(imag(ls_real_deut_ice_age),'r'); +title("Real L-S transform of Deuterium/ice age data"); +legend("Real part","Imaginary part"); + +co2_ch4_comparison_figure = figure("visible","off","name","CO2/CH4 +comparison"); +subplot(4,1,1); +axes(x_data_axis_vector); +plot(-(co2(:,2)),co2(:,4)); +hold on; +plot(-(ch4(:,2)),ch4(:,4),'g'); +title("CO2 and CH4 data"); +legend("CO2","CH4"); + +subplot(4,1,2); +plot(abs(ls_complex_co2_ice_age)); +hold on; +plot(abs(ls_complex_ch4_gas_age),'g'); +title("Abs. values of CO2 and CH4 L-S complex transforms"); +legend("CO2,CH4"); + + + + + + ## to implement: ## - displays of all the data and flaws in trying to model with just ## using L-S data Modified: trunk/octave-forge/extra/lssa/fastlscomplex.cc =================================================================== --- trunk/octave-forge/extra/lssa/fastlscomplex.cc 2012-07-15 20:13:22 UTC (rev 10743) +++ trunk/octave-forge/extra/lssa/fastlscomplex.cc 2012-07-17 00:18:06 UTC (rev 10744) @@ -11,6 +11,8 @@ #include <iostream> #include <exception> + + ComplexRowVector flscomplex( RowVector tvec , ComplexRowVector xvec , double maxfreq , int octaves , int coefficients); @@ -67,14 +69,13 @@ ComplexRowVector results = ComplexRowVector (coefficients * octaves ); - double tau, delta_tau, tau_0, tau_h, n_inv, mu, + double tau, delta_tau, tau_0, tau_h, n_inv, mu, te, omega_oct, omega_multiplier, octavemax, omega_working, - loop_tau_0, loop_delta_tau; + loop_tau_0, loop_delta_tau, on_1, n_1, o; double length = ( tvec((tvec.numel()-1)) - tvec( octave_idx_type (0))); int octave_iter, coeff_iter; - std::complex<double> zeta, z_accumulator, exp_term, exp_multiplier, alpha; + std::complex<double> zeta, zz, z_accumulator, exp_term, exp_multiplier, alpha, h, *tpra, *temp_ptr_alpha, temp_alpha[12], *tprb, *temp_ptr_beta, temp_beta[12], temp_array[12], *p, x; octave_idx_type n = tvec.numel(); - std::complex<double> temp_array[12]; for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { temp_array[array_iter] = std::complex<double> ( 0 , 0 ); } @@ -83,7 +84,7 @@ for ( int i = 1 ; i < 12 ; i++ ) { factorial_array[i] = factorial_array[i-1] * i; } - n_inv = 1.0 / n; + n_1 = n_inv = 1.0 / n; mu = (0.5 * M_PI)/length; // Per the article; this is in place to improve numerical accuracy if desired. /* Viz. the paper, in which Dtau = c / omega_max, and c is stated as pi/2 for floating point processors, * In the case of this computation, I'll go by the recommendation. @@ -91,64 +92,118 @@ delta_tau = M_PI / ( 2 * maxfreq ); tau_0 = tvec(0) + delta_tau; tau_h = tau_0; - size_t precomp_subset_count = (size_t) ceil( ( tvec(tvec.numel()-1) - tvec(0) ) / ( 2 * delta_tau ) ); - // I've used size_t because it will work for my purposes without threatening undefined behaviour. - const std::complex<double> im = std::complex<double> ( 0 , 1 ); + te = tau_h + delta_tau; octave_idx_type k ( 0 ); // Iterator for accessing xvec, tvec. Precomputation_Record * precomp_records_head, *record_current, *record_tail, *record_ref, *record_next; record_current = precomp_records_head = new Precomputation_Record; - for ( size_t p_r_iter = 1 ; p_r_iter < precomp_subset_count ; p_r_iter++ ) { + for ( te = tvec(k) + (2 * delta_tau) ; ; ) { + x = std::complex<double>(xvec(k)); + { + double t = mu*(tvec(k)-tau_h), tt; + p = record_current->power_series; + // p = 0 + *p++ = std::complex<double>(x); + // p = 1 + tt = -t; + h = x * tt; + *p++ = std::complex<double>(-h.imag(),h.real()); + // p = 2 + tt *= t*(1.0/2.0); + *p++ = x*tt; + // p = 3 + tt *= t*(-1.0/3.0); + h = x * tt; + *p++ = std::complex<double>(-h.imag(),h.real()); + // p = 4 + tt *= t*(1.0/4.0); + *p++ = x*tt; + // p = 5 + tt *= t*(-1.0/5.0); + h = x * tt; + *p++ = std::complex<double>(-h.imag(),h.real()); + // p = 6 + tt *= t*(1.0/6.0); + *p++ = x*tt; + // p = 7 + tt *= t*(-1.0/7.0); + h = x * tt; + *p++ = std::complex<double>(-h.imag(),h.real()); + // p = 8 + tt *= t*(1.0/8.0); + *p++ = x*tt; + // p = 9 + tt *= t*(-1.0/9.0); + h = x * tt; + *p++ = std::complex<double>(-h.imag(),h.real()); + // p = 10 + tt *= t*(1.0/10.0); + *p++ = x*tt; + // p = 11 + tt *= t*(-1.0/11.0); + h = x * tt; + *p++ = std::complex<double>(-h.imag(),h.real()); + } + record_current->stored_data = true; + for(k++; ( k < n ) && tvec(k) < te ; k++ ) { + x = std::complex<double>(xvec(k)); + { + double t = mu*(tvec(k)-tau_h), tt; + p = record_current->power_series; + // p = 0 + *p++ += std::complex<double>(x); + // p = 1 + tt = -t; + h = x * tt; + *p++ += std::complex<double>(- h.imag(), h.real()); + // p = 2 + tt *= t*(1.0/2.0); + *p++ += x*tt; + // p = 3 + tt *= t*(-1.0/3.0); + h = x * tt; + *p++ += std::complex<double>(-h.imag(),h.real()); + // p = 4 + tt *= t*(1.0/4.0); + *p++ += x*tt; + // p = 5 + tt *= t*(-1.0/5.0); + h = x * tt; + *p++ += std::complex<double>(-h.imag(),h.real()); + // p = 6 + tt *= t*(1.0/6.0); + *p++ += x*tt; + // p = 7 + tt *= t*(-1.0/7.0); + h = x * tt; + *p++ += std::complex<double>(-h.imag(),h.real()); + // p = 8 + tt *= t*(1.0/8.0); + *p++ += x*tt; + // p = 9 + tt *= t*(-1.0/9.0); + h = x * tt; + *p++ += std::complex<double>(-h.imag(),h.real()); + // p = 10 + tt *= t*(1.0/10.0); + *p++ += x*tt; + // p = 11 + tt *= t*(-1.0/11.0); + h = x * tt; + *p++ += std::complex<double>(-h.imag(),h.real()); + } + record_current->stored_data = true; + } + if( k >= n ) break; + tau_h = te + delta_tau; + te = tau_h + delta_tau; record_current->next = new Precomputation_Record; record_current = record_current->next; } record_tail = record_current; record_current = precomp_records_head; record_tail->next = 0; - /* A test needs to be included for if there was a failure, but since - * precomp_subset_count is of type size_t, it should be okay. */ - for( ; record_current != 0 ; record_current = record_current->next ) { - for ( int j = 0 ; j < 12 ; j++ ) { - record_current->power_series[j] = std::complex<double> ( 0 , 0 ); - } // To avoid any trouble down the line, although it is an annoyance. - // Error is traced this far. Time to see if it's in this loop. - while ( (k < n) && (abs(tvec(k)-tau_h) <= delta_tau) ) { - double p; - // alpha = std::complex<double> ( 0 , 0 ); - for ( int j = 0 ; j < 12 ; j++ ) { - alpha.real() = xvec(k).real(); - alpha.imag() = xvec(k).imag(); - // alpha = std::complex<double> ( xvec(k).real() , xvec(k).imag() ); - // alpha *= ( -1 * im * mu * ( tvec(k) - tau_h ) ) * p; - if ( !( j % 2 ) ) { - if ( ! ( j % 4 ) ) { - alpha.real() = xvec(k).real() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; - alpha.imag() = xvec(k).imag() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; - } else { - alpha.real() = -1 * xvec(k).real() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; - alpha.imag() = -1 * xvec(k).imag() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; - } - } else { - if ( ! ( j % 3 ) ) { - alpha.real() = -1 * xvec(k).imag() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; - alpha.imag() = -1 * xvec(k).real() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; - } else { - alpha.real() = xvec(k).imag() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; - alpha.imag() = xvec(k).real() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; - } - } - record_current->power_series[j].real() += alpha.real(); - record_current->power_series[j].imag() += alpha.imag(); - } - // Computes each next step of the power series for the given power series element. - // j was reused since it was a handy inner-loop variable, even though I used it twice here. - record_current->stored_data = true; - k++; - } - tau_h += ( 2 * delta_tau ); - } - // At this point all precomputation records have been exhausted; short-circuit is abused to avoid overflow errors. /* Summation of coefficients for each frequency. As we have ncoeffs * noctaves elements, * it makes sense to work from the top down, as we have omega_max by default (maxfreq) @@ -162,40 +217,37 @@ octave_idx_type iter ( 0 ); - double real_part = 0, imag_part = 0, real_part_accumulator = 0, imag_part_accumulator = 0; - // Loops need to first travel over octaves, then coefficients; for ( octave_iter = octaves ; ; omega_oct *= 0.5 , octavemax *= 0.5 , loop_tau_0 += loop_delta_tau , loop_delta_tau *= 2 ) { - omega_working = omega_oct; - exp_term = std::complex<double> ( cos( - omega_working * loop_tau_0 ) , - sin ( - omega_working * loop_tau_0 ) ); - exp_multiplier = std::complex<double> ( cos ( - 2 * omega_working * loop_delta_tau ) , - sin ( - 2 * omega_working * loop_delta_tau ) ); - for ( coeff_iter = 0 ; coeff_iter < coefficients ; coeff_iter++, omega_working *= omega_multiplier){ - real_part_accumulator = 0; - imag_part_accumulator = 0; - real_part = 0; - imag_part = 0; - for ( record_current = precomp_records_head ; record_current ; + o = omega_oct; + omega_working = octavemax; + for ( coeff_iter = 0 ; coeff_iter < coefficients ; coeff_iter++, o *= omega_multiplier, omega_working *= omega_multiplier){ + exp_term = std::complex<double> ( cos( - omega_working * loop_tau_0 ) , + sin ( - omega_working * loop_tau_0 ) ); + exp_multiplier = std::complex<double> ( cos ( - 2 * omega_working * loop_delta_tau ) , + sin ( - 2 * omega_working * loop_delta_tau ) ); + for ( zeta = 0, record_current = precomp_records_head ; record_current ; record_current = record_current->next, exp_term *= exp_multiplier ) { - for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { - z_accumulator = ( pow(omega_working,array_iter) * record_current->power_series[array_iter] ); - real_part_accumulator += z_accumulator.real(); - imag_part_accumulator += z_accumulator.imag(); + if ( record_current->stored_data ) { + int p; + for ( zz = 0 , p = 0, on_1 = n_1 ; p < 12 ; p++ ) { + zz += record_current->power_series[p] * on_1 ; + on_1 *= o; + } + zeta += exp_term * zz; } - real_part = real_part + ( exp_term.real() * real_part_accumulator - ( exp_term.imag() * imag_part_accumulator ) ); - imag_part = imag_part + ( exp_term.imag() * real_part_accumulator + exp_term.real() * imag_part_accumulator ); } - results(iter) = std::complex<double> ( n_inv * real_part , n_inv * imag_part ); + results(iter) = std::complex<double> (zeta); iter++; } if ( !(--octave_iter) ) break; /* If we've already reached the lowest value, stop. * Otherwise, merge with the next computation range. */ - double exp_power_series_elements[12]; + double *exp_pse_ptr, *exp_ptr, exp_power_series_elements[12]; exp_power_series_elements[0] = 1; + exp_pse_ptr = exp_ptr = exp_power_series_elements; for ( int r_iter = 1 ; r_iter < 12 ; r_iter++ ) { exp_power_series_elements[r_iter] = exp_power_series_elements[r_iter-1] * ( mu * loop_delta_tau) * ( 1.0 / ( (double) r_iter ) ); @@ -204,61 +256,92 @@ for ( record_current = precomp_records_head ; record_current ; record_current = record_current->next ) { if ( ! ( record_ref = record_current->next ) || ! record_ref->stored_data ) { + // In this case, there is no next record, but this record has data. if ( record_current->stored_data ) { - std::complex<double> temp[12]; - for( int array_init = 0 ; array_init < 12 ; array_init++ ) { temp[array_init] = std::complex<double>(0,0); } - for( int p = 0 ; p < 12 ; p ++ ) { - double step_floor_r = floor( ( (double) p ) / 2.0 ); - double step_floor_i = floor( ( (double) ( p - 1 ) ) / 2.0 ); - for( int q = 0 ; q < step_floor_r ; q++ ) { - temp[p] += exp_power_series_elements[2*q] * pow((double)-1,q) * record_current->power_series[p - ( 2 * q )]; + int p = 0; + for( exp_pse_ptr = exp_power_series_elements + 1 , temp_ptr_alpha = temp_alpha ; p < 12 ; p++ , exp_pse_ptr++ ) { + tpra = temp_ptr_alpha; + *(temp_ptr_alpha++) = std::complex<double>(record_current->power_series[p]); + for( exp_ptr = exp_power_series_elements, record_current->power_series[p] = *temp_ptr_alpha * *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 + * of memory, and then it does ... painful things with a few + * 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; } - for( int q = 0 ; q <= step_floor_i ; q++ ) { - temp[p] += im * exp_power_series_elements[2 * q + 1] * pow((double)-1,q) * record_current->power_series[p - ( 2 * q ) - 1]; - } } - for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { - record_current->power_series[array_iter].real() = temp[array_iter].real(); - record_current->power_series[array_iter].imag() = temp[array_iter].imag(); - } if ( ! record_ref ) break; // Last record was reached } else { record_next = record_ref; if ( record_current->stored_data ) { - std::complex<double> temp[12]; - for( int array_init = 0 ; array_init < 12 ; array_init++ ) { temp[array_init] = std::complex<double>(0,0); } - for( int p = 0 ; p < 12 ; p ++ ) { - double step_floor_r = floor( ( (double) p ) / 2.0 ); - double step_floor_i = floor( ( (double) ( p - 1 ) ) / 2.0 ); - for( int q = 0 ; q < step_floor_r ; q++ ) { - temp[p] += exp_power_series_elements[2*q] * pow((double)-1,q) * ( record_current->power_series[p - ( 2 * q )] - record_next->power_series[p - (2*q)] ); + 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; } - for( int q = 0 ; q <= step_floor_i ; q++ ) { - temp[p] += im * exp_power_series_elements[2 * q + 1] * pow((double)-1,q) * ( record_current->power_series[p - ( 2 * q ) - 1] - record_next->power_series[p - ( 2 * q ) - 1 ] ); - } } - for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { - record_current->power_series[array_iter].real() = temp[array_iter].real(); - record_current->power_series[array_iter].imag() = temp[array_iter].imag(); - } } else { - std::complex<double> temp[12]; - for( int array_init = 0 ; array_init < 12 ; array_init++ ) { temp[array_init] = std::complex<double>(0,0); } - for( int p = 0 ; p < 12 ; p ++ ) { - double step_floor_r = floor( ( (double) p ) / 2.0 ); - double step_floor_i = floor( ( (double) ( p - 1 ) ) / 2.0 ); - for( int q = 0 ; q < step_floor_r ; q++ ) { - temp[p] += exp_power_series_elements[2*q] * pow((double)-1,q) * record_next->power_series[p - ( 2 * q )]; + 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; } - for( int q = 0 ; q <= step_floor_i ; q++ ) { - temp[p] += im * exp_power_series_elements[2 * q + 1] * pow((double)-1,(q+1)) * record_next->power_series[p - ( 2 * q ) - 1]; - } } - for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { - record_current->power_series[array_iter].real() = temp[array_iter].real(); - record_current->power_series[array_iter].imag() = temp[array_iter].imag(); - } } record_current->stored_data = true; record_ref = record_next; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <be...@us...> - 2012-07-25 04:49:18
|
Revision: 10773 http://octave.svn.sourceforge.net/octave/?rev=10773&view=rev Author: benjf5 Date: 2012-07-25 04:48:43 +0000 (Wed, 25 Jul 2012) Log Message: ----------- Working on lsrealwavelet, have some solid progress. (Not currently usable.) Added Paths: ----------- trunk/octave-forge/extra/lssa/SampleDataSet.m trunk/octave-forge/extra/lssa/lsrealwavelet.m Added: trunk/octave-forge/extra/lssa/SampleDataSet.m =================================================================== --- trunk/octave-forge/extra/lssa/SampleDataSet.m (rev 0) +++ trunk/octave-forge/extra/lssa/SampleDataSet.m 2012-07-25 04:48:43 UTC (rev 10773) @@ -0,0 +1,25 @@ +## 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/>. + +## No function structure to this, I just want to use it to store the +## sums of sines and cosines I'll use for testing. + +xvec = linspace(0,8,1000); +maxfreq = 4 / ( 2 * pi ); + +yvec = ( 2.*sin(maxfreq.*xvec) + 3.*sin((3/4)*maxfreq.*xvec) + - 0.5 .* sin((1/4)*maxfreq.*xvec) - 0.2 .* cos(maxfreq .* xvec) + + cos((1/4)*maxfreq.*xvec)); + Added: trunk/octave-forge/extra/lssa/lsrealwavelet.m =================================================================== --- trunk/octave-forge/extra/lssa/lsrealwavelet.m (rev 0) +++ trunk/octave-forge/extra/lssa/lsrealwavelet.m 2012-07-25 04:48:43 UTC (rev 10773) @@ -0,0 +1,89 @@ +# Copyright (C) 2012 Benjamin Lewis <be...@gm...> + +##-*- texinfo -*- +## @deffun {Function File} {t =} +## +## +## +## @end deffun + + +function transform = lsrealwavelet(T, X, maxfreq, ncoeff, noctave, t_min, t_max, minimum_window_number, sigma=0.1 ) + +delta_t = (t_max - t_min)/(t_subdiv-1) +# fails if you're trying to use less than 2 windows. Why use the wavelet tool at that point? + +len_tx = length (T) +omegamult = 2 ^ ( - 1/ ncoeff ) +omegamult_inv = 1 / omegamult +winradius = pi / ( sigma * maxfreq ) + +current_radius = winradius; + +o = maxfreq; + +# zeta _ ( t , omega ) = sum(w(sigma omega (t_k - t )e^(-i omega (t_k - t))xi_k) +# / sum( w(sigma omega ( t_k - t ) ) ); +# +# w ( t ) = { 1 - 3 | t | ^ 2 + 2 | t | ^ 3 , t in [ - 1 , 1 ] ; 0 for others } + +# Now, I *think* that this transform is supposed to be applied by taking +# t as the centre of each window, while sigma should scale the time +# values inside the window to the window. I think. + +transform = cell(noctave*ncoeff,1); + +## in this, win_t is the centre of the window in question +window_min = t_min; +## Although that will vary depending on the window. This is just an implementation for the first window. +win_t = window_min + window_radius; + +windowed_t = ((abs (T-win_t) < window_radius) .* T); +zeta = sum( cubicwgt ((windowed_t - win_t) ./ window_radius) .* exp( - i * o .* windowed_t ) .* X ) / sum ( cubicwgt( windowed_t ./ window_radius ) ); +iota = sum( cubicwgt ((windowed_t - win_t) ./ window_radius) .* exp( - i * 2 * o .* windowed_t) .* X ) / sum ( cubicwgt( windowed_t .* 2 * o ) ) +## this will of course involve an additional large memory allocation, at least in the short term, +## but it's faster to do the operation once on the time series, then multiply it by the data series. + + + +for iter_freq = 1:( noctave * ncoeff ) + t = t_min; + tx_point = 1; + for iter_elem = 1:t_subdiv + if tx_point > len_tx + break + endif + while ( tx_point+1 <= len_tx) && ((t-T(tx_point+1))<winradius) + tx_point++; + endwhile + zeta = 0; + iota = 0; + iota0 = 0; + count = 0; + ot = o * ( T(tx_point) - t); + sot = sigma * ot; + while ( tx_point <= len_tx) && ( (sot = sigma * (ot = o*(T(tx_point)-t))) < pi ) + w = 0.5 * ( 1 + cos (sot)); + iota0 += w; + zeta += w * ( cos (ot) + sin (ot) * i ) * X(tx_point); + ot *= 2; + iota += w * ( cos(ot) + sin (ot) * i ); + count++; + tx_point++; + endwhile + if count > 0 + result = 2 * ( conj (zeta) * iota0 + zeta * conj (iota) ) / ( ( count + iota0 ) ** 2 - real(iota) ** 2 - imag(iota) ** 2 ) + printf("%d\n",result); + transform(iter_freq,iter_elem) = result; + else + transform(iter_freq,iter_elem) = 0; + endif + t += delta_t + endfor + o *= omegamult + winradius *= omegamult_inv + iter_freq +endfor + + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <be...@us...> - 2012-07-26 23:07:40
|
Revision: 10777 http://octave.svn.sourceforge.net/octave/?rev=10777&view=rev Author: benjf5 Date: 2012-07-26 23:07:34 +0000 (Thu, 26 Jul 2012) Log Message: ----------- Added lscomplexwavelet, still working on it. Modified Paths: -------------- trunk/octave-forge/extra/lssa/lsrealwavelet.m Added Paths: ----------- trunk/octave-forge/extra/lssa/lscomplexwavelet.m Added: trunk/octave-forge/extra/lssa/lscomplexwavelet.m =================================================================== --- trunk/octave-forge/extra/lssa/lscomplexwavelet.m (rev 0) +++ trunk/octave-forge/extra/lssa/lscomplexwavelet.m 2012-07-26 23:07:34 UTC (rev 10777) @@ -0,0 +1,66 @@ +## 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 +## 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/>. + + + +function transform = lscomplexwavelet( t , x, omegamax, ncoeff, noctave, minimum_window_count, sigma) + +## This is a transform based entirely on the simplified complex-valued transform +## in the Mathias paper, page 10. My problem with the code as it stands is, it +## doesn't have a good way of determining the window size. Sigma is currently up +## to the user, and sigma determines the window width (but that might be best.) +## +## Currently the code does not apply a time-shift, which needs to be fixed so +## that it will work correctly over given frequencies. +## +## Additionally, each octave up adds one to the number of frequencies. + +transform = cell(ncoeff*noctave,1); +for octave_iter = 1:noctave + current_octave = maxfreq * 2 ^ ( - octave_iter ); + current_window_number = minimum_window_count + noctave - octave_iter; + window_step = ( tmax - tmin ) / current_window_number; + for coeff_iter = 1:ncoeff + ## in this, win_t is the centre of the window in question + window_min = t_min; + ## Although that will vary depending on the window. This is just an + ## implementation for the first window. + o = current_frequency = maxfreq * 2 ^ ( - octave_iter*coeff_iter / ncoeff ); + current_radius = 1 / ( current_octave * sigma ); + + transform{iter} = zeros(1,current_window_number); + win_t = window_min + ( window_step / 2); + for iter_window = 1:current_window_number + ## the beautiful part of this code is that if parts end up falling outside the + ## vector, it won't matter (although it's wasted computations.) + ## I may add a trap to avoid too many wasted cycles. + windowed_t = ((abs (T-win_t) < current_radius) .* T); + ## this will of course involve an additional large memory allocation, at least in the short term, + ## but it's faster to do the operation once on the time series, then multiply it by the data series. + zeta = sum( cubicwgt ((windowed_t - win_t) ./ current_radius) .* exp( - i * + o .* windowed_t ) .* X ) / sum( cubicwgt ((windowed_t - win_t ) ./ + current_radius) .* exp ( -i * o .* windowed_t )); + transform{iter}(iter_window) = zeta; + window_min += window_step ; + ## I remain hesitant about this value, since it is entirely possible necessary precision will be lost. Should I try to reduce that? + endfor + endfor + +endfor + +endfunction + Modified: trunk/octave-forge/extra/lssa/lsrealwavelet.m =================================================================== --- trunk/octave-forge/extra/lssa/lsrealwavelet.m 2012-07-26 13:15:46 UTC (rev 10776) +++ trunk/octave-forge/extra/lssa/lsrealwavelet.m 2012-07-26 23:07:34 UTC (rev 10777) @@ -10,7 +10,6 @@ function transform = lsrealwavelet(T, X, maxfreq, ncoeff, noctave, t_min, t_max, minimum_window_number ) -len_tx = length (T) omegamult = 2 ^ ( - 1/ ncoeff ) omegamult_inv = 1 / omegamult @@ -63,7 +62,7 @@ window_min += 2 * current_radius; ## I remain hesitant about this value, since it is entirely possible necessary precision will be lost. Should I try to reduce that? endfor - + o *= omegamult; endfor This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <be...@us...> - 2012-07-28 22:00:22
|
Revision: 10781 http://octave.svn.sourceforge.net/octave/?rev=10781&view=rev Author: benjf5 Date: 2012-07-28 22:00:12 +0000 (Sat, 28 Jul 2012) Log Message: ----------- Moving files to prepare for a first release. Not yet ready; lacks makefile and other files. Added Paths: ----------- trunk/octave-forge/extra/lssa/DESCRIPTION trunk/octave-forge/extra/lssa/inst/ trunk/octave-forge/extra/lssa/inst/SampleDataSet.m 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/lscomplex.m trunk/octave-forge/extra/lssa/inst/lscomplexwavelet.m trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m trunk/octave-forge/extra/lssa/inst/lsreal.m trunk/octave-forge/extra/lssa/inst/lsrealwavelet.m trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m trunk/octave-forge/extra/lssa/src/ trunk/octave-forge/extra/lssa/src/fastlscomplex.cc trunk/octave-forge/extra/lssa/src/fastlsreal.cc Removed Paths: ------------- trunk/octave-forge/extra/lssa/SampleDataSet.m trunk/octave-forge/extra/lssa/cubicwgt.m trunk/octave-forge/extra/lssa/fastlscomplex.cc trunk/octave-forge/extra/lssa/fastlscomplex.cpp trunk/octave-forge/extra/lssa/fastlsreal.cc trunk/octave-forge/extra/lssa/lombcoeff.m trunk/octave-forge/extra/lssa/lombnormcoeff.m trunk/octave-forge/extra/lssa/lscomplex.m trunk/octave-forge/extra/lssa/lscomplexwavelet.m trunk/octave-forge/extra/lssa/lscorrcoeff.m trunk/octave-forge/extra/lssa/lsreal.m trunk/octave-forge/extra/lssa/lsrealwavelet.m trunk/octave-forge/extra/lssa/lswaveletcoeff.m Added: trunk/octave-forge/extra/lssa/DESCRIPTION =================================================================== --- trunk/octave-forge/extra/lssa/DESCRIPTION (rev 0) +++ trunk/octave-forge/extra/lssa/DESCRIPTION 2012-07-28 22:00:12 UTC (rev 10781) @@ -0,0 +1,14 @@ +Name: lssa +Version: +Date: 2012-07-28 +Author: Ben Lewis +Maintainer: Ben Lewis +Title: Least squares spectral analysis +Description: A package implementing tools to compute spectral decompositions of +irregularly-spaced time series. Currently includes functions based off the +Lomb-Scargle periodogram and Adolf Mathias' implementation for R and C (see +URLs). +Url: http://www.jstatsoft.org/v11/i02 +Problems: fast implementations, wavelet functions are currently not functional. +Depends: +License: GPL version 2 or later Deleted: trunk/octave-forge/extra/lssa/SampleDataSet.m =================================================================== --- trunk/octave-forge/extra/lssa/SampleDataSet.m 2012-07-28 10:41:08 UTC (rev 10780) +++ trunk/octave-forge/extra/lssa/SampleDataSet.m 2012-07-28 22:00:12 UTC (rev 10781) @@ -1,25 +0,0 @@ -## 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/>. - -## No function structure to this, I just want to use it to store the -## sums of sines and cosines I'll use for testing. - -xvec = linspace(0,8,1000); -maxfreq = 4 / ( 2 * pi ); - -yvec = ( 2.*sin(maxfreq.*xvec) + 3.*sin((3/4)*maxfreq.*xvec) - - 0.5 .* sin((1/4)*maxfreq.*xvec) - 0.2 .* cos(maxfreq .* xvec) - + cos((1/4)*maxfreq.*xvec)); - Deleted: trunk/octave-forge/extra/lssa/cubicwgt.m =================================================================== --- trunk/octave-forge/extra/lssa/cubicwgt.m 2012-07-28 10:41:08 UTC (rev 10780) +++ trunk/octave-forge/extra/lssa/cubicwgt.m 2012-07-28 22:00:12 UTC (rev 10781) @@ -1,37 +0,0 @@ -## 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 3 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-*- -## @deftypefn {Function File} {a =} cubicwgt {series} -## Return the series as windowed by a cubic polynomial, -## 1 + ( x ^ 2 * ( 2 x - 3 ) ), assuming x is in [-1,1]. -## @end deftypefn - -%!shared h, m, k -%! h = 2; m = 0.01; -%! k = [ 0 , 3 , 1.5, -1, -0.5, -0.25, 0.75 ]; -%!assert( cubicwgt(h), 0 ); -%!assert( cubicwgt(m), 1 + m ^ 2 * ( 2 * m - 3 )); -%!assert( cubicwgt(k), [ 1.00000 0.00000 0.00000 0.00000 0.50000 0.84375 0.15625], 1E-6); -%! ## Tests cubicwgt on two scalars and two vectors; cubicwgt will work on any array input. - - -## This function implements the windowing function on page 10 of the doc. -## if t is in [-1,1] then the windowed term is a = 1 + ( |t|^2 * ( 2|t| - 3 ) -## else the windowed term is 0. -function a = cubicwgt(s) ## where s is the value to be windowed - a = abs(s); - a = ifelse( ( a < 1 ), 1 + ( ( a .^ 2 ) .* ( 2 .* a - 3 ) ), a = 0); -endfunction Deleted: trunk/octave-forge/extra/lssa/fastlscomplex.cc =================================================================== --- trunk/octave-forge/extra/lssa/fastlscomplex.cc 2012-07-28 10:41:08 UTC (rev 10780) +++ trunk/octave-forge/extra/lssa/fastlscomplex.cc 2012-07-28 22:00:12 UTC (rev 10781) @@ -1,361 +0,0 @@ -/* Copyright (C) 2012 Benjamin Lewis <be...@gm...> - * GNU GPLv2 - */ - - -#include <octave/oct.h> -#include <octave/unwind-prot.h> -#include <complex> -#include <string> -#include <math.h> -#include <iostream> -#include <exception> - - - -ComplexRowVector flscomplex( RowVector tvec , ComplexRowVector xvec , - double maxfreq , int octaves , int coefficients); - - -DEFUN_DLD(fastlscomplex,args,nargout, - "-*- texinfo -*-\n" -"@deftypefn {Function File} { C = } fastlscomplex" - "(@var{time},@var{magnitude},@var{maximum_frequency},@var{octaves},@var{coefficients})\n" -"\n" -"Return the complex least squares transform of the (@var{time},@var{magnitude}) series\n\ -supplied, using the fast algorithm.\n" -"\n" -"@seealso{lscomplex}\n" -"@seealso{fastlsreal}\n" -"\n" -"@end deftypefn") { - if ( args.length() != 5 ) { - print_usage(); - return octave_value_list (); - } - RowVector tvals = args(0).row_vector_value(); - ComplexRowVector xvals = args(1).complex_row_vector_value(); - double omegamax = args(2).double_value(); - int noctaves = args(3).int_value(); - int ncoeff = args(4).int_value(); - if ( tvals.numel() != xvals.numel() ){ - if ( tvals.numel() > xvals.numel() ) { - error("More time values than magnitude values."); - } else { - error("More magnitude values than time values."); - } - } - if ( ncoeff == 0 ) error("No coefficients to compute."); - if ( noctaves == 0 ) error("No octaves to compute over."); - if ( omegamax == 0 ) error("No difference between minimal and maximal frequency."); - octave_value_list retval; - if ( !error_state) { - ComplexRowVector results = flscomplex(tvals,xvals,omegamax,noctaves,ncoeff); - retval(0) = octave_value(results); - } else { - return octave_value_list (); - } - return retval; - -} - -ComplexRowVector flscomplex( RowVector tvec , ComplexRowVector xvec , - double maxfreq, int octaves, int coefficients ) { - struct Precomputation_Record { - Precomputation_Record *next; - std::complex<double> power_series[12]; // I'm using 12 as a matter of compatibility, only. - bool stored_data; - }; - - ComplexRowVector results = ComplexRowVector (coefficients * octaves ); - - double tau, delta_tau, tau_0, tau_h, n_inv, mu, te, - omega_oct, omega_multiplier, octavemax, omega_working, - loop_tau_0, loop_delta_tau, on_1, n_1, o; - double length = ( tvec((tvec.numel()-1)) - tvec( octave_idx_type (0))); - int octave_iter, coeff_iter; - std::complex<double> zeta, zz, z_accumulator, exp_term, exp_multiplier, alpha, h, *tpra, *temp_ptr_alpha, temp_alpha[12], *tprb, *temp_ptr_beta, temp_beta[12], temp_array[12], *p, x; - octave_idx_type n = tvec.numel(); - for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { - temp_array[array_iter] = std::complex<double> ( 0 , 0 ); - } - int factorial_array[12]; - factorial_array[0] = 1; - for ( int i = 1 ; i < 12 ; i++ ) { - factorial_array[i] = factorial_array[i-1] * i; - } - n_1 = n_inv = 1.0 / n; - mu = (0.5 * M_PI)/length; // Per the article; this is in place to improve numerical accuracy if desired. - /* Viz. the paper, in which Dtau = c / omega_max, and c is stated as pi/2 for floating point processors, - * In the case of this computation, I'll go by the recommendation. - */ - delta_tau = M_PI / ( 2 * maxfreq ); - tau_0 = tvec(0) + delta_tau; - tau_h = tau_0; - te = tau_h + delta_tau; - - octave_idx_type k ( 0 ); // Iterator for accessing xvec, tvec. - - Precomputation_Record * precomp_records_head, *record_current, *record_tail, *record_ref, *record_next; - record_current = precomp_records_head = new Precomputation_Record; - for ( te = tvec(k) + (2 * delta_tau) ; ; ) { - x = std::complex<double>(xvec(k)); - { - double t = mu*(tvec(k)-tau_h), tt; - p = record_current->power_series; - // p = 0 - *p++ = std::complex<double>(x); - // p = 1 - tt = -t; - h = x * tt; - *p++ = std::complex<double>(-h.imag(),h.real()); - // p = 2 - tt *= t*(1.0/2.0); - *p++ = x*tt; - // p = 3 - tt *= t*(-1.0/3.0); - h = x * tt; - *p++ = std::complex<double>(-h.imag(),h.real()); - // p = 4 - tt *= t*(1.0/4.0); - *p++ = x*tt; - // p = 5 - tt *= t*(-1.0/5.0); - h = x * tt; - *p++ = std::complex<double>(-h.imag(),h.real()); - // p = 6 - tt *= t*(1.0/6.0); - *p++ = x*tt; - // p = 7 - tt *= t*(-1.0/7.0); - h = x * tt; - *p++ = std::complex<double>(-h.imag(),h.real()); - // p = 8 - tt *= t*(1.0/8.0); - *p++ = x*tt; - // p = 9 - tt *= t*(-1.0/9.0); - h = x * tt; - *p++ = std::complex<double>(-h.imag(),h.real()); - // p = 10 - tt *= t*(1.0/10.0); - *p++ = x*tt; - // p = 11 - tt *= t*(-1.0/11.0); - h = x * tt; - *p++ = std::complex<double>(-h.imag(),h.real()); - } - record_current->stored_data = true; - for(k++; ( k < n ) && tvec(k) < te ; k++ ) { - x = std::complex<double>(xvec(k)); - { - double t = mu*(tvec(k)-tau_h), tt; - p = record_current->power_series; - // p = 0 - *p++ += std::complex<double>(x); - // p = 1 - tt = -t; - h = x * tt; - *p++ += std::complex<double>(- h.imag(), h.real()); - // p = 2 - tt *= t*(1.0/2.0); - *p++ += x*tt; - // p = 3 - tt *= t*(-1.0/3.0); - h = x * tt; - *p++ += std::complex<double>(-h.imag(),h.real()); - // p = 4 - tt *= t*(1.0/4.0); - *p++ += x*tt; - // p = 5 - tt *= t*(-1.0/5.0); - h = x * tt; - *p++ += std::complex<double>(-h.imag(),h.real()); - // p = 6 - tt *= t*(1.0/6.0); - *p++ += x*tt; - // p = 7 - tt *= t*(-1.0/7.0); - h = x * tt; - *p++ += std::complex<double>(-h.imag(),h.real()); - // p = 8 - tt *= t*(1.0/8.0); - *p++ += x*tt; - // p = 9 - tt *= t*(-1.0/9.0); - h = x * tt; - *p++ += std::complex<double>(-h.imag(),h.real()); - // p = 10 - tt *= t*(1.0/10.0); - *p++ += x*tt; - // p = 11 - tt *= t*(-1.0/11.0); - h = x * tt; - *p++ += std::complex<double>(-h.imag(),h.real()); - } - record_current->stored_data = true; - } - if( k >= n ) break; - tau_h = te + delta_tau; - te = tau_h + delta_tau; - record_current->next = new Precomputation_Record; - record_current = record_current->next; - } - record_tail = record_current; - record_current = precomp_records_head; - record_tail->next = 0; - - /* Summation of coefficients for each frequency. As we have ncoeffs * noctaves elements, - * it makes sense to work from the top down, as we have omega_max by default (maxfreq) - */ - - omega_oct = maxfreq / mu; - omega_multiplier = exp(-log(2)/coefficients); - octavemax = maxfreq; - loop_tau_0 = tau_0; - loop_delta_tau = delta_tau; - - octave_idx_type iter ( 0 ); - - // Loops need to first travel over octaves, then coefficients; - - for ( octave_iter = octaves ; ; omega_oct *= 0.5 , octavemax *= 0.5 , loop_tau_0 += loop_delta_tau , loop_delta_tau *= 2 ) { - o = omega_oct; - omega_working = octavemax; - for ( coeff_iter = 0 ; coeff_iter < coefficients ; coeff_iter++, o *= omega_multiplier, omega_working *= omega_multiplier){ - exp_term = std::complex<double> ( cos( - omega_working * loop_tau_0 ) , - sin ( - omega_working * loop_tau_0 ) ); - exp_multiplier = std::complex<double> ( cos ( - 2 * omega_working * loop_delta_tau ) , - sin ( - 2 * omega_working * loop_delta_tau ) ); - for ( zeta = 0, record_current = precomp_records_head ; record_current ; - record_current = record_current->next, exp_term *= exp_multiplier ) { - if ( record_current->stored_data ) { - int p; - for ( zz = 0 , p = 0, on_1 = n_1 ; p < 12 ; p++ ) { - zz += record_current->power_series[p] * on_1 ; - on_1 *= o; - } - zeta += exp_term * zz; - } - } - results(iter) = std::complex<double> (zeta); - iter++; - } - if ( !(--octave_iter) ) break; - /* If we've already reached the lowest value, stop. - * Otherwise, merge with the next computation range. - */ - double *exp_pse_ptr, *exp_ptr, exp_power_series_elements[12]; - exp_power_series_elements[0] = 1; - exp_pse_ptr = exp_ptr = exp_power_series_elements; - for ( int r_iter = 1 ; r_iter < 12 ; r_iter++ ) { - exp_power_series_elements[r_iter] = exp_power_series_elements[r_iter-1] - * ( mu * loop_delta_tau) * ( 1.0 / ( (double) r_iter ) ); - } - try{ - for ( record_current = precomp_records_head ; record_current ; - record_current = record_current->next ) { - if ( ! ( record_ref = record_current->next ) || ! record_ref->stored_data ) { - // 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++ ) { - tpra = temp_ptr_alpha; - *(temp_ptr_alpha++) = std::complex<double>(record_current->power_series[p]); - for( exp_ptr = exp_power_series_elements, record_current->power_series[p] = *temp_ptr_alpha * *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 - * of memory, and then it does ... painful things with a few - * 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 ( ! 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; - } - } - } 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; - } - } - } - record_current->stored_data = true; - record_ref = record_next; - record_current->next = record_ref->next; - delete record_ref; - } - } - } - } catch (std::exception& e) { //This section was part of my debugging, and may be removed. - std::cout << "Exception thrown: " << e.what() << std::endl; - ComplexRowVector exception_result (1); - exception_result(0) = std::complex<double> ( 0,0); - return exception_result; - } - } - return results; -} Deleted: trunk/octave-forge/extra/lssa/fastlscomplex.cpp =================================================================== --- trunk/octave-forge/extra/lssa/fastlscomplex.cpp 2012-07-28 10:41:08 UTC (rev 10780) +++ trunk/octave-forge/extra/lssa/fastlscomplex.cpp 2012-07-28 22:00:12 UTC (rev 10781) @@ -1,240 +0,0 @@ -/* - * fastlscomplex.cpp, compiles to fastlscomplex.oct - * Conversion to C++, with wrapper for Octave of the code from - * A. Mathias' nuspectral package. - */ - -#include <octave/oct.h> -#include <math.h> -#include <complex> -#include <string> -#include <iostream> - -ComplexRowVector fastlscomplex ( RowVector tvals, ComplexRowVector xvals, octave_idx_type n, - double length, int ncoeff, int noctaves, double omegamax ); - -inline double sqr(double x) -{ return x*x; } - - -#define SETXT(p_, op_, x_, t_) (p_)->x op_ x_; (p_++)->t op_ t_; -#define SETT(p_, op_, x_, t_) *p_++ op_ t_; -#define SETX(p_, op_, x_, t_) *p_++ op_ x_; -/* h is a complex aux. variable; it is used for assignment times I everywhere */ -#define SETIX(p_, op_, x_, t_) h = x_; (*(p_)).real() op_ -(h.imag()); (*(p_)).imag() op_ h.real(); p_++; - - /* Macro that sums up the power series terms into the power series - * element record pointed to by p_. - * By using = and += for op_, initial setting and accumulation can be selected. - * t_ is the expression specifying the abscissa value. set_ can be either - * SETXT to set the x and t fields of an XTElem record, or SETT/SETX to set - * the elements of a Real array representing alternately real and imaginary - * values. - */ - // -10 points, comments don't match method. -#define EXP_IOT_SERIES(p_, el_, t_, op_, setr_, seti_) \ -{ double t = t_, tt; p_ = el_; setr_(p_, op_, x, 1) \ - tt = -t; seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/2.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(-1.0/3.0); seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/4.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(-1.0/5.0); seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/6.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(-1.0/7.0); seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/8.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(-1.0/9.0); seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/10.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(-1.0/11.0); seti_(p_, op_, x*tt, tt) \ -} - -/* same as the above, but without alternating signs */ -#define EXPIOT_SERIES(p_, el_, t_, op_, setr_, seti_) \ -{ double t = t_, tt; p_ = el_; setr_(p_, op_, x, 1) \ - seti_(p_, op_, x*t, t ) \ - tt = t*t*(1.0/2.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/3.0); seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/4.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/5.0); seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/6.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/7.0); seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/8.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/9.0); seti_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/10.0); setr_(p_, op_, x*tt, tt) \ - tt *= t*(1.0/11.0); seti_(p_, op_, x*tt, tt) \ -} - -# define SRCARG double *tptr, double *xptr, int n, double *lengthptr -# define SRCVAR int k; double length = *lengthptr; - -//I'll remove these very shortly -# define SRCFIRST k = 0 -# define SRCAVAIL (k<n) -# define SRCNEXT k++ - -DEFUN_DLD(fastlscomplex, args, nargout, "Takes the fast complex least-squares transform of irregularly sampled data.\n\ -When called, takes a time series with associated x-values, a number of octaves,\n\ -a number of coefficients per octave, the maximum frequency, and a length term.\n\ -It returns a complex row vector of the transformed series." ){ - RowVector tvals = args(0).row_vector_value(); - ComplexRowVector xvals = args(1).complex_row_vector_value(); - double length = ( tvals((tvals.numel()-1)) - tvals( octave_idx_type (0))); - int ncoeff = args(4).int_value(); - int noctaves = args(5).int_value(); - double omegamax = args(6).double_value(); - - if ( error_state ) { - //print an error statement, see if error_state can be printed or interpreted. - return octave_value_list (); - } - if ( tvals.length() != xvals.length() ) { - std::cout << "Unmatched time series elements." << std::endl; - // return error state if possible? - return octave_value_list (); - } - octave_idx_type n = tvals.numel(); /* I think this will actually return octave_idx_type. - * In that case I'll change the signature of fastlscomplex. */ - if ( ( ncoeff == 0 ) || ( noctaves == 0 ) ) { - std::cout << "Cannot operate over either zero octaves or zero coefficients." << std::endl; - // return error state if possible - return octave_value_list (); - } - // possibly include error for when omegamax isn't right? - ComplexRowVector results = fastlscomplex(tvals, xvals, n, length, ncoeff, noctaves, omegamax); - return octave_value_list ( (octave_value) results ); -} - -ComplexRowVector fastlscomplex ( RowVector tvals, ComplexRowVector xvals, octave_idx_type n, - double length, int ncoeff, int noctaves, double omegamax ) { - /* Singly-linked list which contains each precomputation record - * count stores the number of samples for which power series elements - * were added. This will be useful for accelerating computation by ignoring - * unused entries. - */ - struct SumVec { - SumVec *next; - std::complex<double> elements[12]; - int count; }; - SumVec *shead, *stail, *sp, *sq; - double dtelems[12], /* power series elements of exp(-i dtau) */ - *dte, *r, /* Pointers into dtelems */ - tau, tau0, te, /* Precomputation range centers and range end */ - tau0d, /* tau_h of first summand range at level d */ - dtau = (0.5*M_PI)/omegamax,/* initial precomputation interval radius */ - dtaud, /* precomputation interval radius at d'th merging step */ - n_1 = 1.0/n, /* reciprocal of sample count */ // n is implicitly cast to double. - ooct, o, omul, /* omega/mu for octave's top omega and per band, mult. factor */ - omegaoct, omega, /* Max. frequency of octave and current frequency */ - on_1, /* n_1*(omega/mu)^p, n_1*(2*omega/mu)^p */ - mu = (0.5*M_PI)/length, /* Frequency shift: a quarter period of exp(i mu t) on length */ - tmp; - std::complex<double> zeta, zz, // Accumulators for spectral coefficients to place in complex<double> - e, emul, - x, - h, eoelems[12], oeelems[12], - *eop, *oep, - *ep, *op, - *p, *q, *pe; - ComplexRowVector results (ncoeff*noctaves); - - int i , j; // Counters; coefficient and octave, respectively. - - octave_idx_type k = 0; - - // Subdivision and precomputation, reinvisioned in an OOWorld. - tau = tvals(k) + dtau; - te = tau + dtau; - tau0 = tau; - shead = stail = sp = (SumVec*) operator new (sizeof(SumVec)); - sp->next = 0; - { te = tvals(k) + ( 2 * dtau ); - while ( k < n ) { - EXP_IOT_SERIES(p, sp->elements, mu*(tvals(k)-tau), =, SETX, SETIX); - sp->count = 1; - //Sum terms and show that there has been at least one precomputation. - // I will probably replace the macro with a better explanation. - for(SRCNEXT; SRCAVAIL && tvals(k) < te; SRCNEXT) { - x = xvals(k); - EXP_IOT_SERIES(p,sp->elements,mu*(tvals(k)-tau), +=, SETX, SETIX); - sp->count++; - } - if ( k >= n ) break; - tau = te + dtau; - te = tau + dtau; - sp = (SumVec*) operator new (sizeof(*sp)); - stail->next = sp; - stail = sp; - sp->next = 0; - sp->count = 0; - } } - // Defining starting values for the loops over octaves: - ooct = omegamax / mu; - omul = exp(-log(2)/ncoeff); - omegaoct = omegamax; - tau0d = tau0; - dtaud = dtau; - octave_idx_type iter ( 0 ); - // Looping over octaves - for ( j = noctaves ; ; ooct *= 0.5 , omegaoct *= 0.5 , tau0d += dtaud , dtaud *= 2 ) { - // Looping over&results per frequency - for ( i = ncoeff, o = ooct, omega = omegaoct; i-- ; o *= omul, omega *= omul ) { - e.real() = cos( - ( omega * tau0d ) ); e.imag() = sin( - ( omega * tau0d ) ); - // sets real, imag parts of e - emul.real() = cos( - 2 * ( omega * dtaud ) ); emul.imag() = sin( - 2 * ( omega * dtaud ) ); - // sets real, imag parts of emul - for( zeta = 0 , sp = shead; sp; sp = sp->next, e *= emul ) { - if ( sp->count ) { - zz = std::complex<double>(0.0,0.0); - octave_idx_type i ( 0 ); - for ( p = sp->elements , on_1 = n_1 ; i < (octave_idx_type) 12 ; i++ ) { - zz += *p++ * on_1; - on_1 *= 0; - } - zeta += e * zz; - } - results(iter) = std::complex<double>(zeta.real(), zeta.imag()); - iter++; - } - if ( --j <= 0 ) break; //Avoids excess merging - - EXPIOT_SERIES(r, dtelems, mu*dtaud, =, SETT, SETT); - for(sp = shead; sp; sp = sp->next){ - if(!(sq = sp->next) || !sq->count ) { - for(p = sp->elements, eop = eoelems, dte = dtelems+1, pe = p+12; p < pe; p++, dte++) - { ep = eop; *eop++ = *p; - for(r = dtelems, *p = *ep * *r; ; ) - { if(++r>=dte) break; --ep; h = *ep * *r; (*p).real() -= h.imag(); (*p).imag() += h.real(); - if(++r>=dte) break; --ep; *p -= *ep * *r; - if(++r>=dte) break; --ep; h = -*ep * *r; (*p).real() -= h.imag(); (*p).imag() += h.real(); - if(++r>=dte) break; --ep; *p += *ep * *r; - } - } - if(!sq) break; /* reached the last precomputation range */ - } - else - if(sp->count) - for(p = sp->elements, q = sq->elements, eop = eoelems, oep = oeelems, dte = dtelems+1, pe = p+12; - p < pe; p++, q++, dte++) - { ep = eop; *eop++ = *p+*q; *oep++ = *p-*q; op = oep; - for(r = dtelems, *p = *ep * *r; ; ) - { if(++r>=dte) break; op -= 2; h = *op * *r; (*p).real() -= h.imag(); (*p).imag() += h.real(); - if(++r>=dte) break; ep -= 2; *p -= *ep * *r; - if(++r>=dte) break; op -= 2; h = -*op * *r; (*p).real() -= h.imag(); (*p).imag() += h.real(); - if(++r>=dte) break; ep -= 2; *p += *ep * *r; - } - } - else - for(q = sq->elements, eop = eoelems, oep = oeelems, dte = dtelems+1, pe = q+12; q<pe; q++, dte++) - { ep = eop; *eop++ = *q; - for(r = dtelems, *q = *ep * *r; ; ) - { if(++r>=dte) break; --ep; h = *ep * *r; (*q).real() -= h.imag(); (*q).imag() += h.real(); - if(++r>=dte) break; --ep; *p -= *ep * *r; - if(++r>=dte) break; --ep; h = -*ep * *r; (*q).real() -= h.imag(); (*q).imag() += h.real(); - if(++r>=dte) break; --ep; *q += *ep * *r; - } - } - - sp->count += sq->count; sp->next = sq->next; /* free(sq) if malloc'ed */ - } - } - } -} Deleted: trunk/octave-forge/extra/lssa/fastlsreal.cc =================================================================== --- trunk/octave-forge/extra/lssa/fastlsreal.cc 2012-07-28 10:41:08 UTC (rev 10780) +++ trunk/octave-forge/extra/lssa/fastlsreal.cc 2012-07-28 22:00:12 UTC (rev 10781) @@ -1,347 +0,0 @@ -/* Copyright (C) 2012 Benjamin Lewis <be...@gm...> - * Licensed under the GNU GPLv2 - */ - - -#include <octave/oct.h> -#include <octave/unwind-prot.h> -#include <complex> -#include <string> -#include <math.h> -#include <iostream> -#include <exception> - -ComplexRowVector flsreal( RowVector tvec , ComplexRowVector xvec , - double maxfreq , int octaves , int coefficients); - - -DEFUN_DLD(fastlsreal,args,nargout, - "-*- texinfo -*-\n\ -@deftypefn {Function File} { C = } fastlsreal(@var{time},@var{magnitude},@var{maximum_frequency},@var{octaves},@var{coefficients})\n\ -\n\ -Return the real least-sqaures spectral fit to the (@var{time},@var{magnitude})\n\ -data supplied, using the fast algorithm.\n\ -\n\ -@seealso{fastlscomplex}\n\ -@seealso{lsreal}\n\ -@end deftypefn") { - if ( args.length() != 5 ) { - print_usage(); - return octave_value_list (); - } - RowVector tvals = args(0).row_vector_value(); - ComplexRowVector xvals = args(1).complex_row_vector_value(); - double omegamax = args(2).double_value(); - int noctaves = args(3).int_value(); - int ncoeff = args(4).int_value(); - if ( tvals.numel() != xvals.numel() ){ - if ( tvals.numel() > xvals.numel() ) { - error("More time values than magnitude values."); - } else { - error("More magnitude values than time values."); - } - } - if ( ncoeff == 0 ) error("No coefficients to compute."); - if ( noctaves == 0 ) error("No octaves to compute over."); - if ( omegamax == 0 ) error("No difference between minimal and maximal frequency."); - octave_value_list retval; - if ( !error_state) { - ComplexRowVector results = flsreal(tvals,xvals,omegamax,noctaves,ncoeff); - retval(0) = octave_value(results); - } else { - return octave_value_list (); - } - return retval; - -} - -ComplexRowVector flsreal( RowVector tvec , ComplexRowVector xvec , - double maxfreq, int octaves, int coefficients ) { - struct Precomputation_Record { - Precomputation_Record *next; - std::complex<double> power_series[12]; // I'm using 12 as a matter of compatibility, only. - bool stored_data; - }; - - ComplexRowVector results = ComplexRowVector (coefficients * octaves ); - - double tau, delta_tau, tau_0, tau_h, n_inv, mu, - omega_oct, omega_multiplier, octavemax, omega_working, - loop_tau_0, loop_delta_tau; - double length = ( tvec((tvec.numel()-1)) - tvec( octave_idx_type (0))); - int octave_iter, coeff_iter; - std::complex<double> zeta, z_accumulator, zeta_exp_term, zeta_exp_multiplier, alpha, - iota, i_accumulator, iota_exp_term, iota_exp_multiplier; - octave_idx_type n = tvec.numel(); - std::complex<double> temp_array[12]; - for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { - temp_array[array_iter] = std::complex<double> ( 0 , 0 ); - } - int factorial_array[12]; - factorial_array[0] = 1; - for ( int i = 1 ; i < 12 ; i++ ) { - factorial_array[i] = factorial_array[i-1] * i; - } - n_inv = 1.0 / n; - mu = (0.5 * M_PI)/length; // Per the article; this is in place to improve numerical accuracy if desired. - /* Viz. the paper, in which Dtau = c / omega_max, and c is stated as pi/2 for floating point processors, - * In the case of this computation, I'll go by the recommendation. - */ - delta_tau = M_PI / ( 2 * maxfreq ); - tau_0 = tvec(0) + delta_tau; - tau_h = tau_0; - size_t precomp_subset_count = (size_t) ceil( ( tvec(tvec.numel()-1) - tvec(0) ) / ( 2 * delta_tau ) ); - // I've used size_t because it will work for my purposes without threatening undefined behaviour. - const std::complex<double> im = std::complex<double> ( 0 , 1 ); //I seriously prefer C99's complex numbers. - - octave_idx_type k ( 0 ); // Iterator for accessing xvec, tvec. - - Precomputation_Record * complex_precomp_records_head, *complex_record_current, - *complex_record_tail, *complex_record_ref, *complex_record_next, *iota_precomp_records_head, - *iota_record_current, *iota_record_tail, *iota_record_ref, *iota_record_next; - complex_record_current = complex_precomp_records_head = new Precomputation_Record; - iota_record_current = iota_precomp_records_head = new Precomputation_Record; - for ( size_t p_r_iter = 1 ; p_r_iter < precomp_subset_count ; p_r_iter++ ) { - complex_record_current->next = new Precomputation_Record; - iota_record_current->next = new Precomputation_Record; - complex_record_current = complex_record_current->next; - iota_record_current = iota_record_current->next; - } - // Error's past this point - complex_record_tail = complex_record_current; - iota_record_tail = iota_record_current; - complex_record_current = complex_precomp_records_head; - iota_record_current = iota_precomp_records_head; - complex_record_tail->next = 0; - iota_record_tail->next = 0; - /* A test needs to be included for if there was a failure, but since - * precomp_subset_count is of type size_t, it should be okay. */ - for( ; complex_record_current != 0 ; complex_record_current = complex_record_current->next ) { - for ( int j = 0 ; j < 12 ; j++ ) { - complex_record_current->power_series[j] = std::complex<double> ( 0 , 0 ); - } // To avoid any trouble down the line, although it is an annoyance. - while ( (k < n) && (abs(tvec(k)-tau_h) <= delta_tau) ) { - double p; - for ( int j = 0 ; j < 12 ; j++ ) { - alpha.real() = xvec(k).real(); - alpha.imag() = xvec(k).imag(); - // Change to switches for easier manipulation, fewer tests. This is two tests where one will do. - if ( !( j % 2 ) ) { - if ( ! ( j % 4 ) ) { - alpha.real() = xvec(k).real() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; - alpha.imag() = xvec(k).imag() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; - } else { - alpha.real() = -1 * xvec(k).real() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; - alpha.imag() = -1 * xvec(k).imag() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; - } - } else { - if ( ! ( j % 3 ) ) { - alpha.real() = -1 * xvec(k).imag() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; - alpha.imag() = -1 * xvec(k).real() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; - } else { - alpha.real() = xvec(k).imag() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; - alpha.imag() = xvec(k).real() * pow(mu,j) * pow(tvec(k)-tau_h,j) / factorial_array[j]; - } - } - complex_record_current->power_series[j].real() += alpha.real(); - complex_record_current->power_series[j].imag() += alpha.imag(); - } - // Computes each next step of the power series for the given power series element. - // j was reused since it was a handy inner-loop variable, even though I used it twice here. - complex_record_current->stored_data = true; - k++; - } - tau_h += ( 2 * delta_tau ); - } - // At this point all precomputation records have been - // exhausted for complex records. Short-circuit is abused - // to avoid overflow errors. - // Reset k, tau_h to reset the process. I may rewrite - // these loops to be one, since running twice as long to - // do the same thing is painful. May also move to a switch - // in the previous section too. - k = 0; - tau_h = tau_0; - for( ; iota_record_current != 0 ; iota_record_current = iota_record_current->next ) { - for ( int j = 0 ; j < 12 ; j++ ) { - iota_record_current->power_series[j] = std::complex<double> ( 0 , 0 ); - } - while( ( k < n ) && (abs(tvec(k)-tau_h) <= delta_tau) ) { - double comps[12]; - iota_record_current->power_series[0].real() = 1; - comps[0] = 1; - for ( int j = 1 ; j < 12 ; j++ ) { - comps[j] = comps[j-1] * mu * (tvec(k)-tau_h); - switch ( j % 4 ) { - case 0 : - iota_record_current->power_series[j].real() += comps[j] / factorial_array[j] ; - break; - case 1: - iota_record_current->power_series[j].imag() += comps[j] / factorial_array[j] ; - break; - case 2: - iota_record_current->power_series[j].real() -= comps[j] / factorial_array[j] ; - break; - case 3: - iota_record_current->power_series[j].imag() -= comps[j] / factorial_array[j] ; - break; - } - } - iota_record_current->stored_data = true; - k++; - } - tau_h += ( 2 * delta_tau ); - } - - - /* Summation of coefficients for each frequency. As we have ncoeffs * noctaves elements, - * it makes sense to work from the top down, as we have omega_max by default (maxfreq) - */ - - omega_oct = maxfreq / mu; - omega_multiplier = exp(-log(2)/coefficients); - octavemax = maxfreq; - loop_tau_0 = tau_0; - loop_delta_tau = delta_tau; - - octave_idx_type iter ( 0 ); - - double zeta_real_part = 0, zeta_imag_part = 0, zeta_real_part_accumulator = 0, zeta_imag_part_accumulator = 0, - iota_real_part = 0, iota_imag_part = 0, iota_real_part_accumulator = 0, iota_imag_part_accumulator = 0; - - // Loops need to first travel over octaves, then coefficients; - - for ( octave_iter = octaves ; ; omega_oct *= 0.5 , octavemax *= 0.5 , loop_tau_0 += loop_delta_tau , loop_delta_tau *= 2 ) { - omega_working = omega_oct; - zeta_exp_term = std::complex<double> ( cos ( - omega_working * loop_tau_0 ) , - sin ( - omega_working * loop_tau_0 ) ); - zeta_exp_multiplier = std::complex<double> ( cos ( - 2 * omega_working * loop_delta_tau ) , - sin ( - 2 * omega_working * loop_delta_tau ) ); - iota_exp_term = std::complex<double> ( cos ( - 2 * omega_working * loop_tau_0 ) , - sin ( - 2 * omega_working * loop_tau_0 ) ); - iota_exp_multiplier = std::complex<double> ( cos ( - 2 * omega_working * loop_delta_tau ) , - sin ( - 2 * omega_working * loop_delta_tau ) ); - for ( coeff_iter = 0 ; coeff_iter < coefficients ; coeff_iter++, omega_working *= omega_multiplier){ - zeta_real_part_accumulator = 0; - zeta_imag_part_accumulator = 0; - zeta_real_part = 0; - zeta_imag_part = 0; - for ( complex_record_current = complex_precomp_records_head ; complex_record_current ; - complex_record_current = complex_record_current->next, zeta_exp_term *= zeta_exp_multiplier ) { - for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { - z_accumulator = ( pow(omega_working,array_iter) * complex_record_current->power_series[array_iter] ); - zeta_real_part_accumulator += z_accumulator.real(); - zeta_imag_part_accumulator += z_accumulator.imag(); - } - zeta_real_part = zeta_real_part + ( zeta_exp_term.real() * zeta_real_part_accumulator - zeta_exp_term.imag() * zeta_imag_part_accumulator ); - zeta_imag_part = zeta_imag_part + ( zeta_exp_term.imag() * zeta_real_part_accumulator + zeta_exp_term.real() * zeta_imag_part_accumulator ); - } - for ( iota_record_current = iota_precomp_records_head; iota_record_current ; - iota_record_current = iota_record_current->next, iota_exp_term *= iota_exp_multiplier ) { - for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { - i_accumulator = ( pow(omega_working,array_iter) * iota_record_current->power_series[array_iter] ); - iota_real_part_accumulator += i_accumulator.real(); - iota_imag_part_accumulator += i_accumulator.imag(); - } - iota_real_part = iota_real_part + ( iota_exp_term.real() * iota_real_part_accumulator - iota_exp_term.imag() * iota_imag_part_accumulator ); - iota_imag_part = iota_imag_part + ( iota_exp_term.imag() * iota_real_part_accumulator + iota_exp_term.real() * iota_imag_part_accumulator ); - } - // c + i s = 2 * ( zeta-omega-conjugate - iota-2omega-conjuage * zeta-omega ) / ( 1 - abs(iota-2omega) ^ 2 ) - // (is what the results will be.) - zeta_real_part *= n_inv; - zeta_imag_part *= n_inv; - iota_real_part *= n_inv; - iota_imag_part *= n_inv; - double result_real_part = 2 * ( zeta_real_part - iota_real_part * zeta_real_part - iota_imag_part * zeta_imag_part ) - / ( 1 - iota_real_part * iota_real_part - iota_imag_part * iota_imag_part ); - double result_imag_part = 2 * ( - zeta_imag_part + iota_imag_part * zeta_real_part - iota_real_part * zeta_imag_part ) - / ( 1 - iota_real_part * iota_real_part - iota_imag_part * iota_imag_part ); - results(iter) = std::complex<double> ( result_real_part , result_imag_part ); - iter++; - } - if ( !(--octave_iter) ) break; - /* If we've already reached the lowest value, stop. - * Otherwise, merge with the next computation range. - */ - double exp_power_series_elements[12]; - exp_power_series_elements[0] = 1; - for ( int r_iter = 1 ; r_iter < 12 ; r_iter++ ) { - exp_power_series_elements[r_iter] = exp_power_series_elements[r_iter-1] - * ( mu * loop_delta_tau) * ( 1.0 / ( (double) r_iter ) ); - } - try{ - for ( complex_record_current = complex_precomp_records_head ; complex_record_current ; - complex_record_current = complex_record_current->next ) { - if ( ! ( complex_record_ref = complex_record_current->next ) || ! complex_record_ref->stored_data ) { - if ( complex_record_current->stored_data ) { - std::complex<double> temp[12]; - for( int array_init = 0 ; array_init < 12 ; array_init++ ) { temp[array_init] = std::complex<double>(0,0); } - for( int p = 0 ; p < 12 ; p ++ ) { - double step_floor_r = floor( ( (double) p ) / 2.0 ); - double step_floor_i = floor( ( (double) ( p - 1 ) ) / 2.0 ); - for( int q = 0 ; q < step_floor_r ; q++ ) { - temp[p] += exp_power_series_elements[2*q] * pow((double)-1,q) * complex_record_current->power_series[p - ( 2 * q )]; - } - for( int q = 0 ; q <= step_floor_i ; q++ ) { - temp[p] += im * exp_power_series_elements[2 * q + 1] * pow((double)-1,q) * complex_record_current->power_series[p - ( 2 * q ) - 1]; - } - } - for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { - complex_record_current->power_series[array_iter].real() = temp[array_iter].real(); - complex_record_current->power_series[array_iter].imag() = temp[array_iter].imag(); - } - if ( ! complex_record_ref ) break; // Last record was reached - } - else { - complex_record_next = complex_record_ref; - if ( complex_record_current->stored_data ) { - std::complex<double> temp[12]; - for( int array_init = 0 ; array_init < 12 ; array_init++ ) { temp[array_init] = std::complex<double>(0,0); } - for( int p = 0 ; p < 12 ; p ++ ) { - double step_floor_r = floor( ( (double) p ) / 2.0 ); - double step_floor_i = floor( ( (double) ( p - 1 ) ) / 2.0 ); - for( int q = 0 ; q < step_floor_r ; q++ ) { - temp[p] += exp_power_series_elements[2*q] * pow((double)-1,q) * ( complex_record_current->power_series[p - ( 2 * q )] - complex_record_next->power_series[p - (2*q)] ); - } - for( int q = 0 ; q <= step_floor_i ; q++ ) { - temp[p] += im * exp_power_series_elements[2 * q + 1] * pow((double)-1,q) * ( complex_record_current->power_series[p - ( 2 * q ) - 1] - complex_record_next->power_series[p - ( 2 * q ) - 1 ] ); - } - } - for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { - complex_record_current->power_series[array_iter].real() = temp[array_iter].real(); - complex_record_current->power_series[array_iter].imag() = temp[array_iter].imag(); - } - } else { - std::complex<double> temp[12]; - for( int array_init = 0 ; array_init < 12 ; array_init++ ) { temp[array_init] = std::complex<double>(0,0); } - for( int p = 0 ; p < 12 ; p ++ ) { - double step_floor_r = floor( ( (double) p ) / 2.0 ); - double step_floor_i = floor( ( (double) ( p - 1 ) ) / 2.0 ); - for( int q = 0 ; q < step_floor_r ; q++ ) { - temp[p] += exp_power_series_elements[2*q] * pow((double)-1,q) * complex_record_next->power_series[p - ( 2 * q )]; - } - for( int q = 0 ; q <= step_floor_i ; q++ ) { - temp[p] += im * exp_power_series_elements[2 * q + 1] * pow((double)-1,(q+1)) * complex_record_next->power_series[p - ( 2 * q ) - 1]; - } - } - for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { - complex_record_current->power_series[array_iter].real() = temp[array_iter].real(); - complex_record_current->power_series[array_iter].imag() = temp[array_iter].imag(); - } - } - complex_record_current->stored_data = true; - complex_record_ref = complex_record_next; - complex_record_current->next = complex_record_ref->next; - delete complex_record_ref; - } - } - } - } catch (std::exception& e) { //This section was part of my debugging, and may be removed. - std::cout << "Exception thrown: " << e.what() << std::endl; - ComplexRowVector exception_result (1); - exception_result(0) = std::complex<double> ( 0,0); - return exception_result; - } - } - return results; -} Copied: trunk/octave-forge/extra/lssa/inst/SampleDataSet.m (from rev 10774, trunk/octave-forge/extra/lssa/SampleDataSet.m) =================================================================== --- trunk/octave-forge/extra/lssa/inst/SampleDataSet.m (rev 0) +++ trunk/octave-forge/extra/lssa/inst/SampleDataSet.m 2012-07-28 22:00:12 UTC (rev 10781) @@ -0,0 +1,25 @@ +## 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/>. + +## No function structure to this, I just want to use it to store the +## sums of sines and cosines I'll use for testing. + +xvec = linspace(0,8,1000); +maxfreq = 4 / ( 2 * pi ); + +yvec = ( 2.*sin(maxfreq.*xvec) + 3.*sin((3/4)*maxfreq.*xvec) + - 0.5 .* sin((1/4)*maxfreq.*xvec) - 0.2 .* cos(maxfreq .* xvec) + + cos((1/4)*maxfreq.*xvec)); + Copied: trunk/octave-forge/extra/lssa/inst/cubicwgt.m (from rev 10774, trunk/octave-forge/extra/lssa/cubicwgt.m) =================================================================== --- trunk/octave-forge/extra/lssa/inst/cubicwgt.m (rev 0) +++ trunk/octave-forge/extra/lssa/inst/cubicwgt.m 2012-07-28 22:00:12 UTC (rev 10781) @@ -0,0 +1,37 @@ +## 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 3 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-*- +## @deftypefn {Function File} {a =} cubicwgt {series} +## Return the series as windowed by a cubic polynomial, +## 1 + ( x ^ 2 * ( 2 x - 3 ) ), assuming x is in [-1,1]. +## @end deftypefn + +%!shared h, m, k +%! h = 2; m = 0.01; +%! k = [ 0 , 3 , 1.5, -1, -0.5, -0.25, 0.75 ]; +%!assert( cubicwgt(h), 0 ); +%!assert( cubicwgt(m), 1 + m ^ 2 * ( 2 * m - 3 )); +%!assert( cubicwgt(k), [ 1.00000 0.00000 0.00000 0.00000 0.50000 0.84375 0.15625], 1E-6); +%! ## Tests cubicwgt on two scalars and two vectors; cubicwgt will work on any array input. + + +## This function implements the windowing function on page 10 of the doc. +## if t is in [-1,1] then the windowed term is a = 1 + ( |t|^2 * ( 2|t| - 3 ) +## else the windowed term is 0. +function a = cubicwgt(s) ## where s is the value to be windowed + a = abs(s); + a = ifelse( ( a < 1 ), 1 + ( ( a .^ 2 ) .* ( 2 .* a - 3 ) ), a = 0); +endfunction Copied: trunk/octave-forge/extra/lssa/inst/lombcoeff.m (from rev 10774, trunk/octave-forge/extra/lssa/lombcoeff.m) =================================================================== --- trunk/octave-forge/extra/lssa/inst/lombcoeff.m (rev 0) +++ trunk/octave-forge/extra/lssa/inst/lombcoeff.m 2012-07-28 22:00:12 UTC (rev 10781) @@ -0,0 +1,40 @@ +## 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 -*- +## @deftypefn {Function File} {c =} lombcoeff (time, mag, freq) +## +## Return the coefficient of the Lomb periodogram (unnormalized) for the +## (@var{time},@var{mag}) series for the @var{freq} provided. +## +## @seealso{lombnormcoeff} +## @end deftypefn + +%!test +%! shared t, x, o, maxfreq +%! maxfreq = 4 / ( 2 * pi ); +%! t = linspace(0,8); x = ( 2.*sin(maxfreq.*t) + 3.*sin((3/4)*maxfreq.*t) +%! - 0.5 .* sin((1/4)*maxfreq.*t) - 0.2 .* cos(maxfreq .* t) +%! + cos((1/4)*maxfreq.*t)); o = [ maxfreq , 3 / 4 * maxfreq , 1 / 4 * maxfreq ]; +%!assert( lombcoeff(t,x,o(1)),10788.9848389923,5e-10 ); +%!assert( lombcoeff(t,x,o(2)),12352.6413413457,5e-10 ); +%!assert( lombcoeff(t,x,o(3)),13673.4098969780,5e-10 ); + + +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 + Copied: trunk/octave-forge/extra/lssa/inst/lombnormcoeff.m (from rev 10774, trunk/octave-forge/extra/lssa/lombnormcoeff.m) =================================================================== --- trunk/octave-forge/extra/lssa/inst/lombnormcoeff.m (rev 0) +++ trunk/octave-forge/extra/lssa/inst/lombnormcoeff.m 2012-07-28 22:00:12 UTC (rev 10781) @@ -0,0 +1,30 @@ +## 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 -*- +## @deftypefn {Function File} {c =} lombnormcoeff (time, mag, freq) +## +## Return the coefficient of the Lomb Normalised Periodogram at the +## specified @var{frequency} of the periodogram applied to the +## (@var{time}, @var{mag}) series. +## +## @end deftypefn + +function coeff = lombnormcoeff(T,X,omega) +tau = atan2( sum( sin( 2.*omega.*T)), sum(cos(2.*omega.*T))) / 2; +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 Copied: trunk/octave-forge/extra/lssa/inst/lscomplex.m (from rev 10774, trunk/octave-forge/extra/lssa/lscomplex.m) =================================================================== --- trunk/octave-forge/extra/lssa/inst/lscomplex.m (rev 0) +++ trunk/octave-forge/extra/lssa/inst/lscomplex.m 2012-07-28 22:00:12 UTC (rev 10781) @@ -0,0 +1,44 @@ +## 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 -*- +## @deftypefn {Function File} {t =} lscomplex ( time, mag, maxfreq, numcoeff, numoctaves) +## +## Return the complex least-squares transform of the (@var{time},@var{mag}) +## series, considering frequencies up to @var{maxfreq}, over @var{numoctaves} +## octaves and @var{numcoeff} coefficients. +## +## @seealso{lsreal} +## @end deftypefn + +%!test +%! shared t, x, o, maxfreq +%! maxfreq = 4 / ( 2 * pi ); t = [0:0.008:8]; x = ( 2.*sin(maxfreq.*t) + 3.*sin((3/4)*maxfreq.*t)- 0.5 .* sin((1/4)*maxfreq.*t) - 0.2 .* cos(maxfreq .* t) + cos((1/4)*maxfreq.*t)); o = [ maxfreq , 3 / 4 * maxfreq , 1 / 4 * maxfreq ]; +%! assert( lscomplex(t,x,maxfreq,2,2), [-0.400754376933531 - 2.366871097665244i, 1.226663545950135 - 2.243899314661490i, 1.936433327880238 - 1.515538553198501i, 2.125045509991203 - 0.954100898917708i ], 6e-14 ); + + + +function transform = lscomplex( t , x , omegamax , ncoeff , noctave ) + n = length(t); ## VECTOR ONLY, and since t and x have the same number of entries, there's no problem. + transform = zeros(1,ncoeff*noctave); + o = omegamax; + omul = 2 ^ ( - 1 / ncoeff ); + for iter = 1:ncoeff*noctave + ot = o .* t; + transform(iter) = sum( ( cos(ot) - ( sin(ot) .* i ) ) .* x ) / n; ## See the paper for the expression + o *= omul; ## To advance the transform to the next coefficient in the octave + endfor + +endfunction Copied: trunk/octave-forge/extra/lssa/inst/lscomplexwavelet.m (from rev 10777, trunk/octave-forge/extra/lssa/lscomplexwavelet.m) =================================================================== --- trunk/octave-forge/extra/lssa/inst/lscomplexwavelet.m (rev 0) +++ trunk/octave-forge/extra/lssa/inst/lscomplexwavelet.m 2012-07-28 22:00:12 UTC (rev 10781) @@ -0,0 +1,66 @@ +## 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 +## 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/>. + + + +function transform = lscomplexwavelet( t , x, omegamax, ncoeff, noctave, minimum_window_count, sigma) + +## This is a transform based entirely on the simplified complex-valued transform +## in the Mathias paper, page 10. My problem with the code as it stands is, it +## doesn't have a good way of determining the window size. Sigma is currently up +## to the user, and sigma determines the window width (but that might be best.) +## +## Currently the code does not apply a time-shift, which needs to be fixed so +## that it will work correctly over given frequencies. +## +## Additionally, each octave up adds one to the number of frequencies. + +transform = cell(ncoeff*noctave,1); +for octave_iter = 1:noctave + current_octave = maxfreq * 2 ^ ( - octave_iter ); + current_window_number = minimum_window_count + noctave - octave_iter; + window_step = ( tmax - tmin ) / current_window_number; + for coeff_iter = 1:ncoeff + ## in this, win_t is the centre of the window in question + window_min = t_min; + ## Although that will vary depending on the window. This is just an + ## implementation for the first window. + o = current_frequency = maxfreq * 2 ^ ( - octave_iter*coeff_iter / ncoeff ); + current_radius = 1 / ( current_octave * sigma ); + + transform{iter} = zeros(1,current_window_number); + win_t = window_min + ( window_step / 2); + for iter_window = 1:current_window_number + ## the beautiful part of this code is that if parts end up falling outside the + ## vector, it won't matter (although it's wasted computations.) + ## I may add a trap to avoid too many wasted cycles. + windowed_t = ((abs (T-win_t) < current_radius) .* T); + ## this will of course involve an additional large memory allocation, at least in the short term, + ## but it's faster to do the operation once on the time series, then multiply it by the data series. + zeta = sum( cubicwgt ((windowed_t - win_t) ./ current_radius) .* exp( - i * + o .* windowed_t ) .* X ) / sum( cubicwgt ((windowed_t - win_t ) ./ + current_radius) .* exp ( -i * o .* windowed_t )); + transform{iter}(iter_window) = zeta; + window_min += window_step ; + ## I remain hesitant about this value, since it is entirely possible necessary precision will be lost. Should I try to reduce that? + endfor + endfor + +endfor + +endfunction + Copied: trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m (from rev 10774, trunk/octave-forge/extra/lssa/lscorrcoeff.m) =================================================================== --- trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m (rev 0) +++ trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m 2012-07-28 22:00:12 UTC (rev 10781) @@ -0,0 +1,69 @@ +## Copyright (C) 2012 Benjamin Lewis <ben... [truncated message content] |
From: <be...@us...> - 2012-07-31 15:34:47
|
Revision: 10795 http://octave.svn.sourceforge.net/octave/?rev=10795&view=rev Author: benjf5 Date: 2012-07-31 15:34:36 +0000 (Tue, 31 Jul 2012) Log Message: ----------- Ready for an alpha release. The data files will be improved shortly. Modified Paths: -------------- trunk/octave-forge/extra/lssa/DESCRIPTION trunk/octave-forge/extra/lssa/src/Makefile Added Paths: ----------- trunk/octave-forge/extra/lssa/INDEX trunk/octave-forge/extra/lssa/NEWS trunk/octave-forge/extra/lssa/samples/ trunk/octave-forge/extra/lssa/samples/SampleDataSet.m trunk/octave-forge/extra/lssa/samples/SampleScriptWithVostokData Removed Paths: ------------- trunk/octave-forge/extra/lssa/SampleScriptWithVostokData trunk/octave-forge/extra/lssa/inst/SampleDataSet.m Modified: trunk/octave-forge/extra/lssa/DESCRIPTION =================================================================== --- trunk/octave-forge/extra/lssa/DESCRIPTION 2012-07-31 14:43:11 UTC (rev 10794) +++ trunk/octave-forge/extra/lssa/DESCRIPTION 2012-07-31 15:34:36 UTC (rev 10795) @@ -1,5 +1,5 @@ Name: lssa -Version: +Version: 0.1.0 Date: 2012-07-28 Author: Ben Lewis Maintainer: Ben Lewis @@ -10,5 +10,6 @@ URLs). Url: http://www.jstatsoft.org/v11/i02 Problems: fast implementations, wavelet functions are currently not functional. -Depends: -License: GPL version 2 or later +Depends: octave (>= 3.4.3) +Autoload: no +License: GPLv2+ Added: trunk/octave-forge/extra/lssa/INDEX =================================================================== --- trunk/octave-forge/extra/lssa/INDEX (rev 0) +++ trunk/octave-forge/extra/lssa/INDEX 2012-07-31 15:34:36 UTC (rev 10795) @@ -0,0 +1,10 @@ +cubicwgt +fastlscomplex +lombcoeff +lomgnormcoeff +lscomplex +lscomplexwavelet +lscorrcoeff +lsreal +lsrealwavelet +lswaveletcoeff \ No newline at end of file Added: trunk/octave-forge/extra/lssa/NEWS =================================================================== --- trunk/octave-forge/extra/lssa/NEWS (rev 0) +++ trunk/octave-forge/extra/lssa/NEWS 2012-07-31 15:34:36 UTC (rev 10795) @@ -0,0 +1,20 @@ +Welcome to the first release of lssa, 0.1.0 + +Current status: + + ** lscomplex and lsreal both produce accurate results; they can be slow for + very large datasets. + + ** fastlscomplex is accurate for the first octave of results; there is still an + error I need to pin down in the merging for additional octaves. fastlsreal + is disabled at the moment as I move to an implementation based on the new + fastlscomplex. + + ** lscorrcoeff works, although I'm still attempting to understand the initial + author's reasoning. Its generated results are relevant to any given data + set, but it does not appear to be normalized to any great extent. + + ** lsrealwavelet and lscomplexwavelet are not currently correct or even really + functional; this is an ongoing struggle for me, and if anyone can suggest + what I might do to improve them, please! By all means, send me an email. + Deleted: trunk/octave-forge/extra/lssa/SampleScriptWithVostokData =================================================================== --- trunk/octave-forge/extra/lssa/SampleScriptWithVostokData 2012-07-31 14:43:11 UTC (rev 10794) +++ trunk/octave-forge/extra/lssa/SampleScriptWithVostokData 2012-07-31 15:34:36 UTC (rev 10795) @@ -1,226 +0,0 @@ -## Copyright (C) 2012 Benjamin Lewis -## Licensed under the GNU GPL v2 - -## This is just a sample script to introduce the purpose and usage of -## the Lomb-Scargle Least Squares method with experimental data, here -## using the Vostok ice core data collected and measured by J.R. Petit -## et. al. and published in Nature; also available from the NOAA's -## Paleoclimatology pages here: -## <http://www.ncdc.noaa.gov/paleo/icecore/antarctica/vostok/vostok_data.html>. - -co2 = csvread("./data/co2.csv")(2:end,2:end); -ch4 = csvread("./data/ch4.csv")(2:end,2:end); -o18 = csvread("./data/o18.csv")(2:end,2:end); -deut = csvread("./data/deut.csv")(2:end,2:end); -dust = csvread("./data/dust.csv")(2:end,2:end); -## The limited ranges are to deal with artifacts from the extraction of -## the R data, notably that it leaves an extra column on the front of 0s -## and the first row is text that Octave refuses to process. - -## Columns in co2 are Depth, Ice Age, Gas Age, and CO2 Concentration. -## Columns in ch4 are Depth, Ice Age, Gas Age, and CH4 Concentration. -## Columns in o18 are Depth, Ice Age, Gas Age, and Atmospheric O18. -## Columns in dust are Depth, Ice Age, Dust Concentration. -## Columns in deut are Depth, Ice Age, D concentration, and DeltaTS. - -co2_fig = figure("visible","off","name","CO2"); -ch4_fig = figure("visible","off","name","CH4"); -o18_fig = figure("visible","off","name","O18"); -deut_fig = figure("visible","off","name","Deuterium"); -dust_fig = figure("visible","off","name","Dust"); -## Generates figures and attaches handles to them for easy access. - -## Now we need some data to display; I'll run a few functions. -ls_complex_co2_ice_age = lscomplex(co2(:,2),co2(:,4),1,100,20); -ls_complex_co2_gas_age = lscomplex(co2(:,3),co2(:,4),1,100,20); -ls_real_co2_ice_age = lsreal(co2(:,2),co2(:,4),1,100,20); -ls_real_co2_gas_age = lsreal(co2(:,3),co2(:,4),1,100,20); -ls_complex_ch4_ice_age = lscomplex(ch4(:,2),ch4(:,4),1,100,20); -ls_complex_ch4_gas_age = lscomplex(ch4(:,3),ch4(:,4),1,100,20); -ls_real_ch4_ice_age = lsreal(ch4(:,2),ch4(:,4),1,100,20); -ls_real_ch4_gas_age = lsreal(ch4(:,3),ch4(:,4),1,100,20); -ls_complex_o18_ice_age = lscomplex(o18(:,2),o18(:,4),1,100,20); -ls_complex_o18_gas_age = lscomplex(o18(:,3),o18(:,4),1,100,20); -ls_real_o18_ice_age = lsreal(o18(:,2),o18(:,4),1,100,20); -ls_real_o18_gas_age = lsreal(o18(:,3),o18(:,4),1,100,20); -ls_complex_deut = lscomplex(deut(:,2),deut(:,3),1,100,20); -ls_real_deut = lsreal(deut(:,2),deut(:,3),1,100,20); -ls_complex_dust = lscomplex(dust(:,2),dust(:,3),1,100,20); -ls_real_dust = lsreal(dust(:,2),dust(:,3),1,100,20); - -x_data_axis_vector = [ -430000, 0 ]; -## Useful because all of the data extends over 430 000 years up to the -## present. - -## Setting up the CO2 plots: -figure(co2_fig); -subplot(4,2,1); -axis(x_data_axis_vector); -plot(-(co2(:,2)),co2(:,4)); -title("Gas levels over ice age"); -subplot(4,2,2); -axis(x_data_axis_vector); -plot(-(co2(:,3),co2(:,4)); -title("Gas levels over gas age"); -subplot(4,2,3); -plot(real(ls_complex_co2_ice_age)); -hold on; -plot(imag(ls_complex_co2_ice_age),'r'); -title("Complex L-S transform of Gas/ice age data"); -legend("Real part","Imaginary part"); -subplot(4,2,4); -plot(real(ls_complex_co2_gas_age)); -hold on; -plot(imag(ls_complex_co2_gas_age),'r'); -title("Complex L-S transform of Gas/gas age data"); -legend("Real part","Imaginary part"); -subplot(4,2,5); -plot(real(ls_real_co2_ice_age)); -hold on; -plot(imag(ls_real_co2_ice_age),'r'); -title("Real L-S transform of Gas/ice age data"); -legend("Real part","Imaginary part"); -subplot(4,2,6); -plot(real(ls_real_co2_gas_age)); -hold on; -plot(imag(ls_real_co2_gas_age)); -title("Real L-S transform of Gas/gas age data"); -legend("Real part","Imaginary part"); -## At this point, we have transforms of both datasets, real and complex, -## and just need to figure out what cool thing to do with the remaining slot. - -## Setting up the CH4 plots -figure(ch4_fig); -subplot(4,2,1); -axis(x_data_axis_vector); -plot(-(ch4(:,2)),ch4(:,4)); -title("Gas levels over ice age"); -subplot(4,2,2); -axis(x_data_axis_vector); -plot(-(ch4(:,3),ch4(:,4)); -title("Gas levels over gas age"); -subplot(4,2,3); -plot(real(ls_complex_ch4_ice_age)); -hold on; -plot(imag(ls_complex_ch4_ice_age),'r'); -title("Complex L-S transform of Gas/ice age data"); -legend("Real part","Imaginary part"); -subplot(4,2,4); -plot(real(ls_complex_ch4_gas_age)); -hold on; -plot(imag(ls_complex_ch4_gas_age),'r'); -title("Complex L-S transform of Gas/gas age data"); -legend("Real part","Imaginary part"); -subplot(4,2,5); -plot(real(ls_real_ch4_ice_age)); -hold on; -plot(imag(ls_real_ch4_ice_age),'r'); -title("Real L-S transform of Gas/ice age data"); -legend("Real part","Imaginary part"); -subplot(4,2,6); -plot(real(ls_real_ch4_gas_age)); -hold on; -plot(imag(ls_real_ch4_gas_age)); -title("Real L-S transform of Gas/gas age data"); -legend("Real part","Imaginary part"); - -## Setting up the O18 plots: -figure(o18_fig); -subplot(4,2,1); -axis(x_data_axis_vector); -plot(-(o18(:,2)),o18(:,4)); -title("Gas levels over ice age"); -subplot(4,2,2); -axis(x_data_axis_vector); -plot(-(o18(:,3),o18(:,4)); -title("Gas levels over gas age"); -subplot(4,2,3); -plot(real(ls_complex_o18_ice_age)); -hold on; -plot(imag(ls_complex_o18_ice_age),'r'); -title("Complex L-S transform of Gas/ice age data"); -legend("Real part","Imaginary part"); -subplot(4,2,4); -plot(real(ls_complex_o18_gas_age)); -hold on; -plot(imag(ls_complex_o18_gas_age),'r'); -title("Complex L-S transform of Gas/gas age data"); -legend("Real part","Imaginary part"); -subplot(4,2,5); -plot(real(ls_real_o18_ice_age)); -hold on; -plot(imag(ls_real_o18_ice_age),'r'); -title("Real L-S transform of Gas/ice age data"); -legend("Real part","Imaginary part"); -subplot(4,2,6); -plot(real(ls_real_o18_gas_age)); -hold on; -plot(imag(ls_real_o18_gas_age)); -title("Real L-S transform of Gas/gas age data"); -legend("Real part","Imaginary part"); - -## Setting up Dust plots: -figure(dust_fig); -subplot(4,1,1); -axis(x_data_axis_vector); -plot(-(dust(:,2)),dust(:,3)); -title("Dust levels over ice age"); -subplot(4,1,2); -plot(real(ls_complex_dust_ice_age)); -hold on; -plot(imag(ls_complex_dust_ice_age),'r'); -title("Complex L-S transform of Dust/ice age data"); -legend("Real part","Imaginary part"); -subplot(4,1,3); -plot(real(ls_real_dust_ice_age)); -hold on; -plot(imag(ls_real_dust_ice_age),'r'); -title("Real L-S transform of Dust/ice age data"); -legend("Real part","Imaginary part"); - -## Setting up Deuterium plots: -figure(deut_fig); -subplot(4,1,1); -axis(x_data_axis_vector); -plot(-(deut(:,2)),deut(:,3)); -title("Deuterium levels over ice age"); -subplot(4,1,2); -plot(real(ls_complex_deut_ice_age)); -hold on; -plot(imag(ls_complex_deut_ice_age),'r'); -title("Complex L-S transform of Deuterium/ice age data"); -legend("Real part","Imaginary part"); -subplot(4,1,3); -plot(real(ls_real_deut_ice_age)); -hold on; -plot(imag(ls_real_deut_ice_age),'r'); -title("Real L-S transform of Deuterium/ice age data"); -legend("Real part","Imaginary part"); - -co2_ch4_comparison_figure = figure("visible","off","name","CO2/CH4 -comparison"); -subplot(4,1,1); -axes(x_data_axis_vector); -plot(-(co2(:,2)),co2(:,4)); -hold on; -plot(-(ch4(:,2)),ch4(:,4),'g'); -title("CO2 and CH4 data"); -legend("CO2","CH4"); - -subplot(4,1,2); -plot(abs(ls_complex_co2_ice_age)); -hold on; -plot(abs(ls_complex_ch4_gas_age),'g'); -title("Abs. values of CO2 and CH4 L-S complex transforms"); -legend("CO2,CH4"); - - - - - - -## to implement: -## - displays of all the data and flaws in trying to model with just - ## using L-S data -## - correlations of every data set with every other data set -## - Comparing ls* results to periodogram results \ No newline at end of file Deleted: trunk/octave-forge/extra/lssa/inst/SampleDataSet.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/SampleDataSet.m 2012-07-31 14:43:11 UTC (rev 10794) +++ trunk/octave-forge/extra/lssa/inst/SampleDataSet.m 2012-07-31 15:34:36 UTC (rev 10795) @@ -1,25 +0,0 @@ -## 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/>. - -## No function structure to this, I just want to use it to store the -## sums of sines and cosines I'll use for testing. - -xvec = linspace(0,8,1000); -maxfreq = 4 / ( 2 * pi ); - -yvec = ( 2.*sin(maxfreq.*xvec) + 3.*sin((3/4)*maxfreq.*xvec) - - 0.5 .* sin((1/4)*maxfreq.*xvec) - 0.2 .* cos(maxfreq .* xvec) - + cos((1/4)*maxfreq.*xvec)); - Copied: trunk/octave-forge/extra/lssa/samples/SampleDataSet.m (from rev 10785, trunk/octave-forge/extra/lssa/inst/SampleDataSet.m) =================================================================== --- trunk/octave-forge/extra/lssa/samples/SampleDataSet.m (rev 0) +++ trunk/octave-forge/extra/lssa/samples/SampleDataSet.m 2012-07-31 15:34:36 UTC (rev 10795) @@ -0,0 +1,25 @@ +## 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/>. + +## No function structure to this, I just want to use it to store the +## sums of sines and cosines I'll use for testing. + +xvec = linspace(0,8,1000); +maxfreq = 4 / ( 2 * pi ); + +yvec = ( 2.*sin(maxfreq.*xvec) + 3.*sin((3/4)*maxfreq.*xvec) + - 0.5 .* sin((1/4)*maxfreq.*xvec) - 0.2 .* cos(maxfreq .* xvec) + + cos((1/4)*maxfreq.*xvec)); + Copied: trunk/octave-forge/extra/lssa/samples/SampleScriptWithVostokData (from rev 10785, trunk/octave-forge/extra/lssa/SampleScriptWithVostokData) =================================================================== --- trunk/octave-forge/extra/lssa/samples/SampleScriptWithVostokData (rev 0) +++ trunk/octave-forge/extra/lssa/samples/SampleScriptWithVostokData 2012-07-31 15:34:36 UTC (rev 10795) @@ -0,0 +1,226 @@ +## Copyright (C) 2012 Benjamin Lewis +## Licensed under the GNU GPL v2 + +## This is just a sample script to introduce the purpose and usage of +## the Lomb-Scargle Least Squares method with experimental data, here +## using the Vostok ice core data collected and measured by J.R. Petit +## et. al. and published in Nature; also available from the NOAA's +## Paleoclimatology pages here: +## <http://www.ncdc.noaa.gov/paleo/icecore/antarctica/vostok/vostok_data.html>. + +co2 = csvread("./data/co2.csv")(2:end,2:end); +ch4 = csvread("./data/ch4.csv")(2:end,2:end); +o18 = csvread("./data/o18.csv")(2:end,2:end); +deut = csvread("./data/deut.csv")(2:end,2:end); +dust = csvread("./data/dust.csv")(2:end,2:end); +## The limited ranges are to deal with artifacts from the extraction of +## the R data, notably that it leaves an extra column on the front of 0s +## and the first row is text that Octave refuses to process. + +## Columns in co2 are Depth, Ice Age, Gas Age, and CO2 Concentration. +## Columns in ch4 are Depth, Ice Age, Gas Age, and CH4 Concentration. +## Columns in o18 are Depth, Ice Age, Gas Age, and Atmospheric O18. +## Columns in dust are Depth, Ice Age, Dust Concentration. +## Columns in deut are Depth, Ice Age, D concentration, and DeltaTS. + +co2_fig = figure("visible","off","name","CO2"); +ch4_fig = figure("visible","off","name","CH4"); +o18_fig = figure("visible","off","name","O18"); +deut_fig = figure("visible","off","name","Deuterium"); +dust_fig = figure("visible","off","name","Dust"); +## Generates figures and attaches handles to them for easy access. + +## Now we need some data to display; I'll run a few functions. +ls_complex_co2_ice_age = lscomplex(co2(:,2),co2(:,4),1,100,20); +ls_complex_co2_gas_age = lscomplex(co2(:,3),co2(:,4),1,100,20); +ls_real_co2_ice_age = lsreal(co2(:,2),co2(:,4),1,100,20); +ls_real_co2_gas_age = lsreal(co2(:,3),co2(:,4),1,100,20); +ls_complex_ch4_ice_age = lscomplex(ch4(:,2),ch4(:,4),1,100,20); +ls_complex_ch4_gas_age = lscomplex(ch4(:,3),ch4(:,4),1,100,20); +ls_real_ch4_ice_age = lsreal(ch4(:,2),ch4(:,4),1,100,20); +ls_real_ch4_gas_age = lsreal(ch4(:,3),ch4(:,4),1,100,20); +ls_complex_o18_ice_age = lscomplex(o18(:,2),o18(:,4),1,100,20); +ls_complex_o18_gas_age = lscomplex(o18(:,3),o18(:,4),1,100,20); +ls_real_o18_ice_age = lsreal(o18(:,2),o18(:,4),1,100,20); +ls_real_o18_gas_age = lsreal(o18(:,3),o18(:,4),1,100,20); +ls_complex_deut = lscomplex(deut(:,2),deut(:,3),1,100,20); +ls_real_deut = lsreal(deut(:,2),deut(:,3),1,100,20); +ls_complex_dust = lscomplex(dust(:,2),dust(:,3),1,100,20); +ls_real_dust = lsreal(dust(:,2),dust(:,3),1,100,20); + +x_data_axis_vector = [ -430000, 0 ]; +## Useful because all of the data extends over 430 000 years up to the +## present. + +## Setting up the CO2 plots: +figure(co2_fig); +subplot(4,2,1); +axis(x_data_axis_vector); +plot(-(co2(:,2)),co2(:,4)); +title("Gas levels over ice age"); +subplot(4,2,2); +axis(x_data_axis_vector); +plot(-(co2(:,3),co2(:,4)); +title("Gas levels over gas age"); +subplot(4,2,3); +plot(real(ls_complex_co2_ice_age)); +hold on; +plot(imag(ls_complex_co2_ice_age),'r'); +title("Complex L-S transform of Gas/ice age data"); +legend("Real part","Imaginary part"); +subplot(4,2,4); +plot(real(ls_complex_co2_gas_age)); +hold on; +plot(imag(ls_complex_co2_gas_age),'r'); +title("Complex L-S transform of Gas/gas age data"); +legend("Real part","Imaginary part"); +subplot(4,2,5); +plot(real(ls_real_co2_ice_age)); +hold on; +plot(imag(ls_real_co2_ice_age),'r'); +title("Real L-S transform of Gas/ice age data"); +legend("Real part","Imaginary part"); +subplot(4,2,6); +plot(real(ls_real_co2_gas_age)); +hold on; +plot(imag(ls_real_co2_gas_age)); +title("Real L-S transform of Gas/gas age data"); +legend("Real part","Imaginary part"); +## At this point, we have transforms of both datasets, real and complex, +## and just need to figure out what cool thing to do with the remaining slot. + +## Setting up the CH4 plots +figure(ch4_fig); +subplot(4,2,1); +axis(x_data_axis_vector); +plot(-(ch4(:,2)),ch4(:,4)); +title("Gas levels over ice age"); +subplot(4,2,2); +axis(x_data_axis_vector); +plot(-(ch4(:,3),ch4(:,4)); +title("Gas levels over gas age"); +subplot(4,2,3); +plot(real(ls_complex_ch4_ice_age)); +hold on; +plot(imag(ls_complex_ch4_ice_age),'r'); +title("Complex L-S transform of Gas/ice age data"); +legend("Real part","Imaginary part"); +subplot(4,2,4); +plot(real(ls_complex_ch4_gas_age)); +hold on; +plot(imag(ls_complex_ch4_gas_age),'r'); +title("Complex L-S transform of Gas/gas age data"); +legend("Real part","Imaginary part"); +subplot(4,2,5); +plot(real(ls_real_ch4_ice_age)); +hold on; +plot(imag(ls_real_ch4_ice_age),'r'); +title("Real L-S transform of Gas/ice age data"); +legend("Real part","Imaginary part"); +subplot(4,2,6); +plot(real(ls_real_ch4_gas_age)); +hold on; +plot(imag(ls_real_ch4_gas_age)); +title("Real L-S transform of Gas/gas age data"); +legend("Real part","Imaginary part"); + +## Setting up the O18 plots: +figure(o18_fig); +subplot(4,2,1); +axis(x_data_axis_vector); +plot(-(o18(:,2)),o18(:,4)); +title("Gas levels over ice age"); +subplot(4,2,2); +axis(x_data_axis_vector); +plot(-(o18(:,3),o18(:,4)); +title("Gas levels over gas age"); +subplot(4,2,3); +plot(real(ls_complex_o18_ice_age)); +hold on; +plot(imag(ls_complex_o18_ice_age),'r'); +title("Complex L-S transform of Gas/ice age data"); +legend("Real part","Imaginary part"); +subplot(4,2,4); +plot(real(ls_complex_o18_gas_age)); +hold on; +plot(imag(ls_complex_o18_gas_age),'r'); +title("Complex L-S transform of Gas/gas age data"); +legend("Real part","Imaginary part"); +subplot(4,2,5); +plot(real(ls_real_o18_ice_age)); +hold on; +plot(imag(ls_real_o18_ice_age),'r'); +title("Real L-S transform of Gas/ice age data"); +legend("Real part","Imaginary part"); +subplot(4,2,6); +plot(real(ls_real_o18_gas_age)); +hold on; +plot(imag(ls_real_o18_gas_age)); +title("Real L-S transform of Gas/gas age data"); +legend("Real part","Imaginary part"); + +## Setting up Dust plots: +figure(dust_fig); +subplot(4,1,1); +axis(x_data_axis_vector); +plot(-(dust(:,2)),dust(:,3)); +title("Dust levels over ice age"); +subplot(4,1,2); +plot(real(ls_complex_dust_ice_age)); +hold on; +plot(imag(ls_complex_dust_ice_age),'r'); +title("Complex L-S transform of Dust/ice age data"); +legend("Real part","Imaginary part"); +subplot(4,1,3); +plot(real(ls_real_dust_ice_age)); +hold on; +plot(imag(ls_real_dust_ice_age),'r'); +title("Real L-S transform of Dust/ice age data"); +legend("Real part","Imaginary part"); + +## Setting up Deuterium plots: +figure(deut_fig); +subplot(4,1,1); +axis(x_data_axis_vector); +plot(-(deut(:,2)),deut(:,3)); +title("Deuterium levels over ice age"); +subplot(4,1,2); +plot(real(ls_complex_deut_ice_age)); +hold on; +plot(imag(ls_complex_deut_ice_age),'r'); +title("Complex L-S transform of Deuterium/ice age data"); +legend("Real part","Imaginary part"); +subplot(4,1,3); +plot(real(ls_real_deut_ice_age)); +hold on; +plot(imag(ls_real_deut_ice_age),'r'); +title("Real L-S transform of Deuterium/ice age data"); +legend("Real part","Imaginary part"); + +co2_ch4_comparison_figure = figure("visible","off","name","CO2/CH4 +comparison"); +subplot(4,1,1); +axes(x_data_axis_vector); +plot(-(co2(:,2)),co2(:,4)); +hold on; +plot(-(ch4(:,2)),ch4(:,4),'g'); +title("CO2 and CH4 data"); +legend("CO2","CH4"); + +subplot(4,1,2); +plot(abs(ls_complex_co2_ice_age)); +hold on; +plot(abs(ls_complex_ch4_gas_age),'g'); +title("Abs. values of CO2 and CH4 L-S complex transforms"); +legend("CO2,CH4"); + + + + + + +## to implement: +## - displays of all the data and flaws in trying to model with just + ## using L-S data +## - correlations of every data set with every other data set +## - Comparing ls* results to periodogram results \ No newline at end of file Modified: trunk/octave-forge/extra/lssa/src/Makefile =================================================================== --- trunk/octave-forge/extra/lssa/src/Makefile 2012-07-31 14:43:11 UTC (rev 10794) +++ trunk/octave-forge/extra/lssa/src/Makefile 2012-07-31 15:34:36 UTC (rev 10795) @@ -1,13 +1,14 @@ MKOCTFILE ?= mkoctfile -all: fastlscomplex.oct \ - fastlsreal.oct +all: fastlscomplex.oct #\ +# fastlsreal.oct fastlscomplex.oct: fastlscomplex.cc $(MKOCTFILE) fastlscomplex.cc -fastlsreal.oct: fastlsreal.cc - $(MKOCTFILE) fastlsreal.cc +# fastlsreal compilation is disabled for the time being +#fastlsreal.oct: fastlsreal.cc +# $(MKOCTFILE) fastlsreal.cc # helper function just in case clean: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <be...@us...> - 2012-08-05 15:13:40
|
Revision: 10829 http://octave.svn.sourceforge.net/octave/?rev=10829&view=rev Author: benjf5 Date: 2012-08-05 15:13:33 +0000 (Sun, 05 Aug 2012) Log Message: ----------- Updated license information for all functions, more work on lscomplexwavelet. Modified Paths: -------------- trunk/octave-forge/extra/lssa/DESCRIPTION trunk/octave-forge/extra/lssa/inst/cubicwgt.m trunk/octave-forge/extra/lssa/inst/lombcoeff.m trunk/octave-forge/extra/lssa/inst/lscomplex.m trunk/octave-forge/extra/lssa/inst/lscomplexwavelet.m trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m trunk/octave-forge/extra/lssa/inst/lsreal.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/DESCRIPTION =================================================================== --- trunk/octave-forge/extra/lssa/DESCRIPTION 2012-08-05 05:52:09 UTC (rev 10828) +++ trunk/octave-forge/extra/lssa/DESCRIPTION 2012-08-05 15:13:33 UTC (rev 10829) @@ -1,15 +1,15 @@ Name: lssa Version: 0.1.0 Date: 2012-07-28 -Author: Ben Lewis -Maintainer: Ben Lewis +Author: Ben Lewis <be...@gm...> +Maintainer: Ben Lewis <be...@gm...> Title: Least squares spectral analysis Description: A package implementing tools to compute spectral decompositions of irregularly-spaced time series. Currently includes functions based off the Lomb-Scargle periodogram and Adolf Mathias' implementation for R and C (see -URLs). +URLs). Url: http://www.jstatsoft.org/v11/i02 Problems: fast implementations, wavelet functions are currently not functional. Depends: octave (>= 3.4.3) Autoload: no -License: GPLv2+ +License: GPLv3+ Modified: trunk/octave-forge/extra/lssa/inst/cubicwgt.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/cubicwgt.m 2012-08-05 05:52:09 UTC (rev 10828) +++ trunk/octave-forge/extra/lssa/inst/cubicwgt.m 2012-08-05 15:13:33 UTC (rev 10829) @@ -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 2 of the License, or (at your option) any later +## Foundation; either version 3 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-05 05:52:09 UTC (rev 10828) +++ trunk/octave-forge/extra/lssa/inst/lombcoeff.m 2012-08-05 15:13:33 UTC (rev 10829) @@ -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 2 of the License, or (at your option) any later +## Foundation; either version 3 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/lscomplex.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lscomplex.m 2012-08-05 05:52:09 UTC (rev 10828) +++ trunk/octave-forge/extra/lssa/inst/lscomplex.m 2012-08-05 15:13:33 UTC (rev 10829) @@ -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 2 of the License, or (at your option) any later +## Foundation; either version 3 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/lscomplexwavelet.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lscomplexwavelet.m 2012-08-05 05:52:09 UTC (rev 10828) +++ trunk/octave-forge/extra/lssa/inst/lscomplexwavelet.m 2012-08-05 15:13:33 UTC (rev 10829) @@ -2,7 +2,7 @@ ## ## 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 +## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT @@ -15,7 +15,7 @@ -function transform = lscomplexwavelet( t , x, omegamax, ncoeff, noctave, minimum_window_count, sigma) +function transform = lscomplexwavelet( t , x, omegamax, ncoeff, noctave, minimum_window_count, sigma = 0.05) ## This is a transform based entirely on the simplified complex-valued transform ## in the Mathias paper, page 10. My problem with the code as it stands is, it @@ -37,21 +37,14 @@ window_min = t_min; ## Although that will vary depending on the window. This is just an ## implementation for the first window. - o = current_frequency = maxfreq * 2 ^ ( - octave_iter*coeff_iter / ncoeff ); + omega = current_frequency = maxfreq * 2 ^ ( - octave_iter*coeff_iter / ncoeff ); current_radius = 1 / ( current_octave * sigma ); transform{iter} = zeros(1,current_window_number); win_t = window_min + ( window_step / 2); for iter_window = 1:current_window_number - ## the beautiful part of this code is that if parts end up falling outside the - ## vector, it won't matter (although it's wasted computations.) - ## I may add a trap to avoid too many wasted cycles. - windowed_t = ((abs (T-win_t) < current_radius) .* T); - ## this will of course involve an additional large memory allocation, at least in the short term, - ## but it's faster to do the operation once on the time series, then multiply it by the data series. - zeta = sum( cubicwgt ((windowed_t - win_t) ./ current_radius) .* exp( - i * - o .* windowed_t ) .* X ) / sum( cubicwgt ((windowed_t - win_t ) ./ - current_radius) .* exp ( -i * o .* windowed_t )); + ## Computes the transform as stated in the paper for each given frequency. + zeta = sum ( cubicwgt ( sigma .* omega .* ( T - win_t ) ) .* exp ( -i .* omega .* ( T - win_t ) ) .* X ) / sum ( cubicwgt ( sigma .* omega .* ( T - win_t ) ) .* exp ( -i .* omega .* ( T - win_t ) ) ); transform{iter}(iter_window) = zeta; window_min += window_step ; ## I remain hesitant about this value, since it is entirely possible necessary precision will be lost. Should I try to reduce that? Modified: trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m 2012-08-05 05:52:09 UTC (rev 10828) +++ trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m 2012-08-05 15:13:33 UTC (rev 10829) @@ -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 2 of the License, or (at your option) any later +## Foundation; either version 3 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,7 +24,7 @@ ## default is cubicwgt if left blank, and its radius is 1, ## as defined as the default for @var{winradius}. ## -## @seealso lswaveletcoeff lscomplexwavelet lsrealwavelet +## @seealso{lswaveletcoeff, lscomplexwavelet, lsrealwavelet} ## ## @end deftypefn Modified: trunk/octave-forge/extra/lssa/inst/lsreal.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lsreal.m 2012-08-05 05:52:09 UTC (rev 10828) +++ trunk/octave-forge/extra/lssa/inst/lsreal.m 2012-08-05 15:13:33 UTC (rev 10829) @@ -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 2 of the License, or (at your option) any later +## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT @@ -14,7 +14,7 @@ ## this program; if not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {transform =} nureal ( time, mag, maxfreq, numcoeff, numoctaves) +## @deftypefn {Function File} {transform =} lsreal ( time, mag, maxfreq, numcoeff, numoctaves) ## ## Return the real least-squares transform of the time series ## defined, based on the maximal frequency @var{maxfreq}, the @@ -23,6 +23,7 @@ ## pair (c_o, s_o) defining the coefficients which best fit the ## function y = c_o * cos(ot) + s_o * sin(ot) to the (@var{time}, @var{mag}) data. ## +## @seealso{lscomplex} ## @end deftypefn %!shared t, x, o, maxfreq Modified: trunk/octave-forge/extra/lssa/inst/lsrealwavelet.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lsrealwavelet.m 2012-08-05 05:52:09 UTC (rev 10828) +++ trunk/octave-forge/extra/lssa/inst/lsrealwavelet.m 2012-08-05 15:13:33 UTC (rev 10829) @@ -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 2 of the License, or (at your option) any later +## Foundation; either version 3 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,7 +24,7 @@ ## ## Currently non-functional. ## -## @seealso lscomplexwavelet lswaveletcoeff lscorrcoeff +## @seealso{lscomplexwavelet, lswaveletcoeff, lscorrcoeff} ## ## @end deftypefn Modified: trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m 2012-08-05 05:52:09 UTC (rev 10828) +++ trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m 2012-08-05 15:13:33 UTC (rev 10829) @@ -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 2 of the License, or (at your option) any later +## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT @@ -25,7 +25,7 @@ ## while @var{winradius} is the windowing radius, and defaults ## to 1 (the radius of cubicwgt.) ## -## @seealso lscorrcoeff lscomplexwavelet lsrealwavelet +## @seealso{lscorrcoeff, lscomplexwavelet, lsrealwavelet} ## ## @end deftypefn Modified: trunk/octave-forge/extra/lssa/src/fastlscomplex.cc =================================================================== --- trunk/octave-forge/extra/lssa/src/fastlscomplex.cc 2012-08-05 05:52:09 UTC (rev 10828) +++ trunk/octave-forge/extra/lssa/src/fastlscomplex.cc 2012-08-05 15:13:33 UTC (rev 10829) @@ -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 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -38,8 +38,7 @@ "Return the complex least squares transform of the (@var{time},@var{magnitude}) series\n\ supplied, using the fast algorithm.\n" "\n" -"@seealso{lscomplex}\n" -"@seealso{fastlsreal}\n" +"@seealso{lscomplex, fastlsreal}\n" "\n" "@end deftypefn") { if ( args.length() != 5 ) { Modified: trunk/octave-forge/extra/lssa/src/fastlsreal.cc =================================================================== --- trunk/octave-forge/extra/lssa/src/fastlsreal.cc 2012-08-05 05:52:09 UTC (rev 10828) +++ trunk/octave-forge/extra/lssa/src/fastlsreal.cc 2012-08-05 15:13:33 UTC (rev 10829) @@ -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 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -35,8 +35,7 @@ Return the real least-sqaures spectral fit to the (@var{time},@var{magnitude})\n\ data supplied, using the fast algorithm.\n\ \n\ -@seealso{fastlscomplex}\n\ -@seealso{lsreal}\n\ +@seealso{lsreal, fastlscomplex}\n\ @end deftypefn") { if ( args.length() != 5 ) { print_usage(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <be...@us...> - 2012-08-09 16:08:25
|
Revision: 10849 http://octave.svn.sourceforge.net/octave/?rev=10849&view=rev Author: benjf5 Date: 2012-08-09 16:08:18 +0000 (Thu, 09 Aug 2012) Log Message: ----------- Updated tests, DESCRIPTION, etc. for lssa release. Modified Paths: -------------- trunk/octave-forge/extra/lssa/DESCRIPTION trunk/octave-forge/extra/lssa/NEWS trunk/octave-forge/extra/lssa/inst/cubicwgt.m trunk/octave-forge/extra/lssa/inst/lombcoeff.m trunk/octave-forge/extra/lssa/inst/lscomplex.m trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m trunk/octave-forge/extra/lssa/inst/lsreal.m trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m Modified: trunk/octave-forge/extra/lssa/DESCRIPTION =================================================================== --- trunk/octave-forge/extra/lssa/DESCRIPTION 2012-08-09 12:58:55 UTC (rev 10848) +++ trunk/octave-forge/extra/lssa/DESCRIPTION 2012-08-09 16:08:18 UTC (rev 10849) @@ -1,6 +1,6 @@ Name: lssa -Version: 0.1.0 -Date: 2012-07-28 +Version: 0.1.1 +Date: 2012-08-09 Author: Ben Lewis <be...@gm...> Maintainer: Ben Lewis <be...@gm...> Title: Least squares spectral analysis Modified: trunk/octave-forge/extra/lssa/NEWS =================================================================== --- trunk/octave-forge/extra/lssa/NEWS 2012-08-09 12:58:55 UTC (rev 10848) +++ trunk/octave-forge/extra/lssa/NEWS 2012-08-09 16:08:18 UTC (rev 10849) @@ -1,4 +1,4 @@ -Welcome to the first release of lssa, 0.1.0 +Welcome to the first release of lssa, 0.1.1 Current status: @@ -18,3 +18,7 @@ functional; this is an ongoing struggle for me, and if anyone can suggest what I might do to improve them, please! By all means, send me an email. + ** For all the working functions, tests have been written and formatted to + Octave coding standards. These tests should pass on any given architecture + (there was some question about that previously) and often provide examples + of how the function operates. For a few functions, there are demo scripts. Modified: trunk/octave-forge/extra/lssa/inst/cubicwgt.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/cubicwgt.m 2012-08-09 12:58:55 UTC (rev 10848) +++ trunk/octave-forge/extra/lssa/inst/cubicwgt.m 2012-08-09 16:08:18 UTC (rev 10849) @@ -19,19 +19,22 @@ ## 1 + ( x ^ 2 * ( 2 x - 3 ) ), assuming x is in [-1,1]. ## @end deftypefn -%!shared h, m, k -%! h = 2; m = 0.01; -%! k = [ 0 , 3 , 1.5, -1, -0.5, -0.25, 0.75 ]; -%!assert( cubicwgt(h), 0 ); -%!assert( cubicwgt(m), 1 + m ^ 2 * ( 2 * m - 3 )); -%!assert( cubicwgt(k), [ 1.00000 0.00000 0.00000 0.00000 0.50000 0.84375 0.15625], 1E-6); -%! ## Tests cubicwgt on two scalars and two vectors; cubicwgt will work on any array input. - - -## This function implements the windowing function on page 10 of the doc. +## This function implements the windowing function on page 10 of the paper. ## if t is in [-1,1] then the windowed term is a = 1 + ( |t|^2 * ( 2|t| - 3 ) ## else the windowed term is 0. function a = cubicwgt(s) ## where s is the value to be windowed a = abs(s); a = ifelse( ( a < 1 ), 1 + ( ( a .^ 2 ) .* ( 2 .* a - 3 ) ), a = 0); endfunction + +%!test +%!shared h, m, k +%! h = 2; +%! m = 0.01; +%! k = [ 0 , 3 , 1.5, -1, -0.5, -0.25, 0.75 ]; +%!assert( cubicwgt(h), 0 ); +%!assert( cubicwgt(m), 1 + m ^ 2 * ( 2 * m - 3 )); +%!assert( cubicwgt(k), [ 1.00000, 0.00000, 0.00000, 0.00000, 0.50000, +%! 0.84375, 0.15625], 1e-6); +%! ## Tests cubicwgt on two scalars and two vectors; cubicwgt will work +%! ## on any array input. \ No newline at end of file Modified: trunk/octave-forge/extra/lssa/inst/lombcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lombcoeff.m 2012-08-09 12:58:55 UTC (rev 10848) +++ trunk/octave-forge/extra/lssa/inst/lombcoeff.m 2012-08-09 16:08:18 UTC (rev 10849) @@ -47,6 +47,6 @@ %! 0.2 .* cos (maxfreq .* t) + %! cos ((1/4) * maxfreq .* t)); %! o = [maxfreq , (3/4 * maxfreq) , (1/4 * maxfreq)]; -%!assert (lombcoeff (t, x, maxfreq), 10788.9848389923, 5e-10); -%!assert (lombcoeff (t, x, 3/4*maxfreq), 12352.6413413457, 5e-10); -%!assert (lombcoeff (t, x, 1/4*maxfreq), 13673.4098969780, 5e-10); +%!assert (lombcoeff (t, x, maxfreq), 1076.77574184435, 5e-10); +%!assert (lombcoeff (t, x, 3/4*maxfreq), 1226.53572492183, 5e-10); +%!assert (lombcoeff (t, x, 1/4*maxfreq), 1341.63962181896, 5e-10); Modified: trunk/octave-forge/extra/lssa/inst/lscomplex.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lscomplex.m 2012-08-09 12:58:55 UTC (rev 10848) +++ trunk/octave-forge/extra/lssa/inst/lscomplex.m 2012-08-09 16:08:18 UTC (rev 10849) @@ -23,16 +23,7 @@ ## @seealso{lsreal} ## @end deftypefn -%!test -%!shared t, x, o, maxfreq -%! maxfreq = 4 / ( 2 * pi ); -%! t = [0:0.008:8]; -%! x = ( 2.*sin(maxfreq.*t) + 3.*sin((3/4)*maxfreq.*t)- 0.5 .* sin((1/4)*maxfreq.*t) - 0.2 .* cos(maxfreq .* t) + cos((1/4)*maxfreq.*t)); -%! o = [ maxfreq , 3 / 4 * maxfreq , 1 / 4 * maxfreq ]; -%!assert( lscomplex(t,x,maxfreq,2,2), [-0.400754376933531 - 2.366871097665244i, 1.226663545950135 - 2.243899314661490i, 1.936433327880238 - 1.515538553198501i, 2.125045509991203 - 0.954100898917708i ], 6e-14 ); - - function transform = lscomplex( t , x , omegamax , ncoeff , noctave ) n = length(t); ## VECTOR ONLY, and since t and x have the same number of entries, there's no problem. transform = zeros(1,ncoeff*noctave); @@ -45,3 +36,19 @@ endfor endfunction + +%!test +%!shared t, x, o, maxfreq +%! maxfreq = 4 / ( 2 * pi ); +%! t = [0:0.008:8]; +%! x = ( 2 .* sin (maxfreq .* t) + +%! 3 .* sin ( (3 / 4) * maxfreq .* t)- +%! 0.5 .* sin ((1/4) * maxfreq .* t) - +%! 0.2 .* cos (maxfreq .* t) + +%! cos ((1/4)*maxfreq.*t)); +%! o = [ maxfreq , 3 / 4 * maxfreq , 1 / 4 * maxfreq ]; +%!assert( lscomplex(t,x,maxfreq,2,2), +%! [-0.400924546169395 - 2.371555305867469i, +%! 1.218065147708429 - 2.256125004156890i, +%! 1.935428592212907 - 1.539488163739336i, +%! 2.136692292751917 - 0.980532175174563i ], 5e-10 ); \ No newline at end of file Modified: trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m 2012-08-09 12:58:55 UTC (rev 10848) +++ trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m 2012-08-09 16:08:18 UTC (rev 10849) @@ -68,7 +68,7 @@ endfunction - +%!test %!shared t, p, x, y, z, o, maxfreq %! maxfreq = 4 / (2 * pi); %! t = linspace (0, 8); Modified: trunk/octave-forge/extra/lssa/inst/lsreal.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lsreal.m 2012-08-09 12:58:55 UTC (rev 10848) +++ trunk/octave-forge/extra/lssa/inst/lsreal.m 2012-08-09 16:08:18 UTC (rev 10849) @@ -26,13 +26,6 @@ ## @seealso{lscomplex} ## @end deftypefn -%!shared t, x, o, maxfreq -%! maxfreq = 4 / ( 2 * pi ); -%! t = linspace(0,8); -%! x = ( 2.*sin(maxfreq.*t) + 3.*sin((3/4)*maxfreq.*t) - 0.5 .* sin((1/4)*maxfreq.*t) - 0.2 .* cos(maxfreq .* t) + cos((1/4)*maxfreq.*t)); -%!assert(lsreal(t,x,maxfreq,2,2),[-1.68275915310663 + 4.70126183846743i, 1.93821553170889 + 4.95660209883437i, 4.38145452686697 + 2.14403733658600i, 5.27425332281147 - 0.73933440226597i],6e-14) -%! #In the assert here, I've got an error bound large enough to catch individual system errors which would present no real issue. - function transform = lsreal( t, x, omegamax, ncoeff, noctave) ## the R function runs the following command: ## nureal( double X, double Y, int min(X,Y), int ncoeff, int noctave, double omegamax, complex rp) @@ -65,6 +58,22 @@ o = o .* od; endfor - ## transform = rp; +endfunction -endfunction +%!test +%!shared t, x, o, maxfreq +%! maxfreq = 4 / ( 2 * pi ); +%! t = linspace(0,8); +%! x = ( 2 .* sin ( maxfreq .* t ) + +%! 3 .* sin ( (3/4) * maxfreq .* t ) - +%! 0.5 .* sin ( (1/4) * maxfreq .* t ) - +%! 0.2 .* cos ( maxfreq .* t ) + +%! cos ( (1/4) * maxfreq .* t ) ); +%!assert (lsreal (t,x,maxfreq,2,2), +%! [-1.68275915310663 + 4.70126183846743i, +%! 1.93821553170889 + 4.95660209883437i, +%! 4.38145452686697 + 2.14403733658600i, +%! 5.27425332281147 - 0.73933440226597i ], +%! 5e-10) +%! # In the assert here, I've got an error bound large enough to catch +%! # individual system errors which would present no real issue. \ No newline at end of file Modified: trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m 2012-08-09 12:58:55 UTC (rev 10848) +++ trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m 2012-08-09 16:08:18 UTC (rev 10849) @@ -53,3 +53,25 @@ coeff = ifelse( s != 0 , sum( wgt( ( rx - t ) .* so) .* exp( i .* o .* ( rx - t ) ) .* ry ) ./ s , 0 ); endfunction + +%!test +%!shared t, p, x, y, z, o, maxfreq +%! maxfreq = 4 / (2 * pi); +%! t = linspace (0, 8); +%! x = (2 .* sin (maxfreq .* t) + +%! 3 .* sin ((3/4) * maxfreq .* t) - +%! 0.5 .* sin ((1/4) * maxfreq .* t) - +%! 0.2 .* cos (maxfreq .* t) + +%! cos ((1/4) * maxfreq .* t)); +%! y = - x; +%! p = linspace (0, 8, 500); +%! z = (2 .* sin (maxfreq .* p) + +%! 3 .* sin ((3/4) * maxfreq .* p) - +%! 0.5 .* sin ((1/4) * maxfreq .* p) - +%! 0.2 .* cos (maxfreq .* p) + +%! cos ((1/4) * maxfreq .* p)); +%! o = [maxfreq , (3/4 * maxfreq) , (1/4 * maxfreq)]; +%!assert (lswaveletcoeff (t, x, 0.5, maxfreq), 0.383340407638780 + +%! 2.385251997545446i , 5e-10); +%!assert (lswaveletcoeff (t, y, 3.3, 3/4 * maxfreq), -2.35465091096084 + +%! 1.01892561714824i, 5e-10); \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <be...@us...> - 2012-08-09 23:49:28
|
Revision: 10851 http://octave.svn.sourceforge.net/octave/?rev=10851&view=rev Author: benjf5 Date: 2012-08-09 23:49:21 +0000 (Thu, 09 Aug 2012) Log Message: ----------- Fixed INDEX, NEWS for lssa 0.1.1 release. Also updated formatting. Modified Paths: -------------- trunk/octave-forge/extra/lssa/DESCRIPTION trunk/octave-forge/extra/lssa/INDEX trunk/octave-forge/extra/lssa/NEWS 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/lscomplex.m trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m trunk/octave-forge/extra/lssa/inst/lsreal.m trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m Modified: trunk/octave-forge/extra/lssa/DESCRIPTION =================================================================== --- trunk/octave-forge/extra/lssa/DESCRIPTION 2012-08-09 16:45:30 UTC (rev 10850) +++ trunk/octave-forge/extra/lssa/DESCRIPTION 2012-08-09 23:49:21 UTC (rev 10851) @@ -5,9 +5,9 @@ Maintainer: Ben Lewis <be...@gm...> Title: Least squares spectral analysis Description: A package implementing tools to compute spectral decompositions of -irregularly-spaced time series. Currently includes functions based off the -Lomb-Scargle periodogram and Adolf Mathias' implementation for R and C (see -URLs). + irregularly-spaced time series. Currently includes functions based off the + Lomb-Scargle periodogram and Adolf Mathias' implementation for R and C (see + URLs). Url: http://www.jstatsoft.org/v11/i02 Problems: fast implementations, wavelet functions are currently not functional. Depends: octave (>= 3.4.3) Modified: trunk/octave-forge/extra/lssa/INDEX =================================================================== --- trunk/octave-forge/extra/lssa/INDEX 2012-08-09 16:45:30 UTC (rev 10850) +++ trunk/octave-forge/extra/lssa/INDEX 2012-08-09 23:49:21 UTC (rev 10851) @@ -1,10 +1,19 @@ -cubicwgt -fastlscomplex -lombcoeff -lombnormcoeff -lscomplex -lscomplexwavelet -lscorrcoeff -lsreal -lsrealwavelet -lswaveletcoeff \ No newline at end of file +lssa >> Least Squares Spectral Analysis +Windowing + cubicwgt +Periodogram + lombcoeff lombnormcoeff +Accelerated time-series functions + fastlscomplex +Complex time-series functions + lscomplex fastlscomplex lswaveletcoeff +# lscomplexwavelet +Real time-series functions + lsreal +# lsrealwavelet +Correlation + lscorrcoeff +Wavelet Transform + lswaveletcoeff +# lscomplexwavelet lsrealwavelet +## The wavelet functions are unavailable until I can get them working. Modified: trunk/octave-forge/extra/lssa/NEWS =================================================================== --- trunk/octave-forge/extra/lssa/NEWS 2012-08-09 16:45:30 UTC (rev 10850) +++ trunk/octave-forge/extra/lssa/NEWS 2012-08-09 23:49:21 UTC (rev 10851) @@ -14,9 +14,13 @@ author's reasoning. Its generated results are relevant to any given data set, but it does not appear to be normalized to any great extent. - ** lsrealwavelet and lscomplexwavelet are not currently correct or even really - functional; this is an ongoing struggle for me, and if anyone can suggest - what I might do to improve them, please! By all means, send me an email. + ** There are two wavelet functions under development, but they are not included + in this release as they are currently not functional. For all your wavelet + needs, the specific transformation used is available in the lswaveletcoeff + function, and will generate a single cosine/sine magnitude pair (as a + complex number) for a complex-valued series (this function may be joined by + a companion for real-valued series) and can be looped to simulate a full + wavelet transform. ** For all the working functions, tests have been written and formatted to Octave coding standards. These tests should pass on any given architecture Modified: trunk/octave-forge/extra/lssa/inst/cubicwgt.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/cubicwgt.m 2012-08-09 16:45:30 UTC (rev 10850) +++ trunk/octave-forge/extra/lssa/inst/cubicwgt.m 2012-08-09 23:49:21 UTC (rev 10851) @@ -14,8 +14,8 @@ ## this program; if not, see <http://www.gnu.org/licenses/>. ## -*-texinfo-*- -## @deftypefn {Function File} {a =} cubicwgt {series} -## Return the series as windowed by a cubic polynomial, +## @deftypefn {Function File} {@var{a} =} cubicwgt (@var{series}) +## Return @var{series} as windowed by a cubic polynomial, ## 1 + ( x ^ 2 * ( 2 x - 3 ) ), assuming x is in [-1,1]. ## @end deftypefn @@ -36,4 +36,4 @@ %!assert( cubicwgt(m), 1 + m ^ 2 * ( 2 * m - 3 )); %!assert( cubicwgt(k), [ 1.00000, 0.00000, 0.00000, 0.00000, 0.50000, 0.84375, 0.15625], 1e-6); %! ## Tests cubicwgt on two scalars and two vectors; cubicwgt will work -%! ## on any array input. \ No newline at end of file +%! ## on any array input. Modified: trunk/octave-forge/extra/lssa/inst/lombcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lombcoeff.m 2012-08-09 16:45:30 UTC (rev 10850) +++ trunk/octave-forge/extra/lssa/inst/lombcoeff.m 2012-08-09 23:49:21 UTC (rev 10851) @@ -14,7 +14,7 @@ ## this program; if not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {c =} lombcoeff (time, mag, freq) +## @deftypefn {Function File} {@var{c} =} lombcoeff (@var{time}, @var{mag}, @var{freq}) ## ## Return the coefficient of the Lomb periodogram (unnormalized) for the ## (@var{time},@var{mag}) series for the @var{freq} provided. Modified: trunk/octave-forge/extra/lssa/inst/lombnormcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lombnormcoeff.m 2012-08-09 16:45:30 UTC (rev 10850) +++ trunk/octave-forge/extra/lssa/inst/lombnormcoeff.m 2012-08-09 23:49:21 UTC (rev 10851) @@ -14,7 +14,7 @@ ## this program; if not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {c =} lombnormcoeff (time, mag, freq) +## @deftypefn {Function File} {@var{c} =} lombnormcoeff (@var{time}, @var{mag}, @var{freq}) ## ## Return the coefficient of the Lomb Normalised Periodogram at the ## specified @var{frequency} of the periodogram applied to the @@ -25,11 +25,17 @@ function coeff = lombnormcoeff (T, X, omega) -tau = atan2 (sum (sin (2 .* omega .*T)), sum (cos (2 .* omega .* T))) / 2; -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))); + xmean = mean (X); + theta = atan2 (sum (sin (2 .* omega .*T)), + sum (cos (2 .* omega .* T))) / (2*omega); + + coeff = ((sum ((X-xmean) .* cos (omega .* T - theta)) .^ 2 / + sum (cos (omega .* T - theta) .^ 2) + + sum ((X-xmean) .* sin (omega .* T - theta)) .^ 2 / + sum (sin (omega .* T - theta) .^ 2 )) / + (2 * var(X))); + endfunction %!shared t, x, o, maxfreq @@ -41,6 +47,6 @@ %! 0.2 .* cos (maxfreq .* t) + %! cos ((1/4) * maxfreq .*t)); %! o = [maxfreq , (3/4 * maxfreq) , (1/4 * maxfreq)]; -%!assert (lombnormcoeff (t,x,o(1)), 63.3294946603949, 5e-10); -%!assert (lombnormcoeff (t,x,o(2)), 73.2601360674868, 5e-10); -%!assert (lombnormcoeff (t,x,o(3)), 53.0799752083903, 5e-10); +%!assert (lombnormcoeff (t,x,o(1)), 44.7068607258824, 5e-10); +%!assert (lombnormcoeff (t,x,o(2)), 35.7769955188467, 5e-10); +%!assert (lombnormcoeff (t,x,o(3)), 20.7577786183241, 5e-10); Modified: trunk/octave-forge/extra/lssa/inst/lscomplex.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lscomplex.m 2012-08-09 16:45:30 UTC (rev 10850) +++ trunk/octave-forge/extra/lssa/inst/lscomplex.m 2012-08-09 23:49:21 UTC (rev 10851) @@ -14,7 +14,7 @@ ## this program; if not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {t =} lscomplex ( time, mag, maxfreq, numcoeff, numoctaves) +## @deftypefn {Function File} {@var{t} =} lscomplex (@var{time}, @var{mag}, @var{maxfreq}, @var{numcoeff}, @var{numoctaves}) ## ## Return the complex least-squares transform of the (@var{time},@var{mag}) ## series, considering frequencies up to @var{maxfreq}, over @var{numoctaves} @@ -25,14 +25,25 @@ function transform = lscomplex( t , x , omegamax , ncoeff , noctave ) - n = length(t); ## VECTOR ONLY, and since t and x have the same number of entries, there's no problem. + + n = length(t); ## VECTOR ONLY, and since t and x have the same number of + ## entries, there's no problem. + transform = zeros(1,ncoeff*noctave); + o = omegamax; - omul = 2 ^ ( - 1 / ncoeff ); + + omul = 2 ^ (- 1 / ncoeff); + for iter = 1:ncoeff*noctave + ot = o .* t; - transform(iter) = sum( ( cos(ot) - ( sin(ot) .* i ) ) .* x ) / n; ## See the paper for the expression + + transform(iter) = sum ((cos (ot) - (sin (ot) .* i)) .* x) / n; ## See the + ## paper for the expression + o *= omul; ## To advance the transform to the next coefficient in the octave + endfor endfunction @@ -48,4 +59,4 @@ %! cos ((1/4)*maxfreq.*t)); %! o = [ maxfreq , 3 / 4 * maxfreq , 1 / 4 * maxfreq ]; %!assert( lscomplex(t,x,maxfreq,2,2), -%! [-0.400924546169395 - 2.371555305867469i, 1.218065147708429 - 2.256125004156890i, 1.935428592212907 - 1.539488163739336i, 2.136692292751917 - 0.980532175174563i ], 5e-10 ); \ No newline at end of file +%! [-0.400924546169395 - 2.371555305867469i, 1.218065147708429 - 2.256125004156890i, 1.935428592212907 - 1.539488163739336i, 2.136692292751917 - 0.980532175174563i ], 5e-10 ); Modified: trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m 2012-08-09 16:45:30 UTC (rev 10850) +++ trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m 2012-08-09 23:49:21 UTC (rev 10851) @@ -14,12 +14,15 @@ ## this program; if not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {c =} lscorrcoeff (abc1, ord1, abc2, ord2, time, freq) -## @deftypefnx {Function File} {c =} lscorrcoeff (abc1, ord1, abc2, ord2, time, freq, window) -## @deftypefnx {Function File} {c =} lscorrcoeff (abc1, ord1, abc2, ord2, time, freq, window, winradius) +## @deftypefn {Function File} {@var{c} =} lscorrcoeff (@var{time1}, @var{mag1}, @var{time2}, @var{mag2}, @var{time}, @var{freq}) +## @deftypefnx {Function File} {@var{c} =} lscorrcoeff (@var{time1}, @var{mag1}, +## @var{time2}, @var{mag2}, @var{time}, @var{freq}, @var{window} = @var{cubicwgt}) +## @deftypefnx {Function File} {@var{c} =} lscorrcoeff (@var{time1}, @var{mag1}, +## @var{time2}, @var{mag2}, @var{time}, @var{freq}, @var{window} = +## @var{cubicwgt}, @var{winradius} = 1) ## ## Return the coefficient of the wavelet correlation of time -## series (@var{abc1}, @var{ord1}) and (@var{abc2}, @var{ord2}). +## series (@var{time1}, @var{mag1}) and (@var{time2}, @var{mag2}). ## @var{window} is used to apply a windowing function, its ## default is cubicwgt if left blank, and its radius is 1, ## as defined as the default for @var{winradius}. Modified: trunk/octave-forge/extra/lssa/inst/lsreal.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lsreal.m 2012-08-09 16:45:30 UTC (rev 10850) +++ trunk/octave-forge/extra/lssa/inst/lsreal.m 2012-08-09 23:49:21 UTC (rev 10851) @@ -14,7 +14,7 @@ ## this program; if not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {transform =} lsreal ( time, mag, maxfreq, numcoeff, numoctaves) +## @deftypefn {Function File} {@var{transform} =} lsreal (@var{time}, @var{mag}, @var{maxfreq}, @var{numcoeff}, @var{numoctaves}) ## ## Return the real least-squares transform of the time series ## defined, based on the maximal frequency @var{maxfreq}, the @@ -26,35 +26,39 @@ ## @seealso{lscomplex} ## @end deftypefn -function transform = lsreal( t, x, omegamax, ncoeff, noctave) - ## the R function runs the following command: - ## nureal( double X, double Y, int min(X,Y), int ncoeff, int noctave, double omegamax, complex rp) - ## this means that in the C, *tptr is X and *xptr is Y. Yes, I know. I think I'll rename them. - ## n is the min of X and Y ... (as is k) and ncoeff is ... ncoeff, while noctave is noctave and - ## o is omegamax. - ## where rp = complex(noctave*ncoeff) so ... I can just store that as noctave*ncoeff and have no - ## problems, I guess. - ## Possibly throw an error if ncoeff <= 0. +function transform = lsreal (t, x, omegamax, ncoeff, noctave) + k = n = length(t); ## THIS IS VECTOR-ONLY. I'd need to add another bit of code to ## make it array-safe, and that's not knowing right now what else will be necessary. - transform = zeros(1,(noctave * ncoeff)); ## In the C code, this is rendered as a Complex, but Octave doesn't care. - od = 2 ^ ( - 1 / ncoeff ); ## this will cause a crash if ncoeff=0; prefer error & quit? + transform = zeros(1,(noctave * ncoeff)); + + od = 2 ^ (- 1 / ncoeff); + o = omegamax; - ## ot is just defined as a Real here, I'm leaving it until it needs to be called. - n1 = 1 / n; ## written n_1 in the C, but I'd prefer to not get into underscores here. - ## zeta and iota are defined as Complex here, leaving them until they need to be defined. - ## I'm not convinced I won't want ncoeff again, so ... + + n1 = 1 / n; + ncoeffp = ncoeff; + ncoeffp *= noctave; + for iter = 1:ncoeffp ## This method is an application of Eq. 8 on page 6 of the text, as well as Eq. 7 ot = o .* t; - zeta = sum( ( cos(ot) .* x ) - ( sin(ot) .* x .* i ) ); + + zeta = sum ((cos (ot) .* x) - + (sin (ot) .* x .* i)); + ot = ot .* 2; - iota = sum( cos(ot) - ( sin(ot) .* i ) ); + + iota = sum (cos (ot) - + (sin (ot) .* i)); + zeta = zeta .* n1; + iota = iota .* n1; - transform(iter) = 2 / ( 1 - ( real(iota) ^ 2 ) - ( imag(iota) ^ 2 ) ) * ( conj(zeta) - (conj(iota) * zeta )); + + transform(iter) = (2 / (1 -(real (iota) ^ 2) - (imag(iota) ^ 2)) * (conj(zeta) - (conj(iota) * zeta))); o = o .* od; endfor @@ -73,4 +77,4 @@ %! [-1.68275915310663 + 4.70126183846743i, 1.93821553170889 + 4.95660209883437i, 4.38145452686697 + 2.14403733658600i, 5.27425332281147 - 0.73933440226597i ], %! 5e-10) %! # In the assert here, I've got an error bound large enough to catch -%! # individual system errors which would present no real issue. \ No newline at end of file +%! # individual system errors which would present no real issue. Modified: trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m 2012-08-09 16:45:30 UTC (rev 10850) +++ trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m 2012-08-09 23:49:21 UTC (rev 10851) @@ -14,12 +14,12 @@ ## this program; if not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {c =} lswaveletcoeff (abc, ord, time, freq) -## @deftypefnx {Function File} {c =} lswaveletcoeff (abc, ord, time, freq, window) -## @deftypefnx {Function File} {c =} lswaveletcoeff (abc, ord, time, freq, window, winradius) +## @deftypefn {Function File} {@var{c} =} lswaveletcoeff (@var{t}, @var{x}, @var{time}, @var{freq}) +## @deftypefnx {Function File} {@var{c} =} lswaveletcoeff (@var{t}, @var{x}, @var{time}, @var{freq}, @var{window}=cubicwgt) +## @deftypefnx {Function File} {@var{c} =} lswaveletcoeff (@var{t}, @var{x}, @var{time}, @var{freq}, @var{window}=cubicwgt, @var{winradius}=1) ## ## Return the coefficient of the wavelet transform of the -## complex time series (@var{abc}, @var{ord}) at time @var{time} +## complex time series (@var{t}, @var{x}) at time @var{time} ## and frequency @var{freq}; optional variable @var{window} ## provides a windowing function and defaults to cubicwgt, ## while @var{winradius} is the windowing radius, and defaults @@ -74,4 +74,4 @@ %!assert (lswaveletcoeff (t, x, 0.5, maxfreq), 0.383340407638780 + %! 2.385251997545446i , 5e-10); %!assert (lswaveletcoeff (t, y, 3.3, 3/4 * maxfreq), -2.35465091096084 + -%! 1.01892561714824i, 5e-10); \ No newline at end of file +%! 1.01892561714824i, 5e-10); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2012-08-10 15:11:02
|
Revision: 10855 http://octave.svn.sourceforge.net/octave/?rev=10855&view=rev Author: cdf Date: 2012-08-10 15:10:54 +0000 (Fri, 10 Aug 2012) Log Message: ----------- more code revision Modified Paths: -------------- trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m trunk/octave-forge/extra/lssa/src/fastlscomplex.cc Modified: trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m 2012-08-10 13:17:33 UTC (rev 10854) +++ trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m 2012-08-10 15:10:54 UTC (rev 10855) @@ -29,33 +29,31 @@ ## ## @end deftypefn -%!demo -%! x = 1:10; -%! y = sin(x); -%! xt = x'; -%! yt = y'; -%! a = lswaveletcoeff(x,y,0.5,0.9) -%! b = lswaveletcoeff(xt,yt,0.5,0.9) -%! ## Generates the wavelet transform coefficient for time 0.5 and circ. freq. 0.9, for row & column vectors. +function coeff = lswaveletcoeff (x, y, t, o, wgt = @cubicwgt, wgtrad = 1) -function coeff = lswaveletcoeff( x , y , t , o , wgt = @cubicwgt , wgtrad = 1 ) so = 0.05 .* o; - if ( ( ndims(x) == 2 ) && ! ( rows(x) == 1 ) ) - x = reshape(x,1,length(x)); - y = reshape(y,1,length(y)); + + if ((ndims (x) == 2) && ! (rows (x) == 1)) + x = reshape (x, 1, length (x)); + y = reshape (y, 1, length (y)); endif - mask = find( abs( x - t ) * so < wgtrad ); + + mask = (abs (x - t) * so < wgtrad); rx = x(mask); ry = y(mask); + ## Going by the R code, this can use the same mask. - s = sum( wgt( ( x - t ) .* so ) ); - coeff = ifelse( s != 0 , sum( wgt( ( rx - t ) .* so) .* exp( i .* o .* ( rx - t ) ) .* ry ) ./ s , 0 ); + s = sum (wgt ((x - t) .* so)); + coeff = ifelse (s != 0, + sum (wgt ((rx - t) .* so) .* + exp (i .* o .* (rx - t)) .* ry) ./ s, + 0); endfunction -%!test -%!shared t, p, x, y, z, o, maxfreq + +%!shared t, p, x, y, maxfreq %! maxfreq = 4 / (2 * pi); %! t = linspace (0, 8); %! x = (2 .* sin (maxfreq .* t) + @@ -65,13 +63,18 @@ %! cos ((1/4) * maxfreq .* t)); %! y = - x; %! p = linspace (0, 8, 500); -%! z = (2 .* sin (maxfreq .* p) + -%! 3 .* sin ((3/4) * maxfreq .* p) - -%! 0.5 .* sin ((1/4) * maxfreq .* p) - -%! 0.2 .* cos (maxfreq .* p) + -%! cos ((1/4) * maxfreq .* p)); -%! o = [maxfreq , (3/4 * maxfreq) , (1/4 * maxfreq)]; -%!assert (lswaveletcoeff (t, x, 0.5, maxfreq), 0.383340407638780 + -%! 2.385251997545446i , 5e-10); -%!assert (lswaveletcoeff (t, y, 3.3, 3/4 * maxfreq), -2.35465091096084 + -%! 1.01892561714824i, 5e-10); +%!assert (lswaveletcoeff (t, x, 0.5, maxfreq), +%! 0.383340407638780 + 2.385251997545446i, 5e-10); +%!assert (lswaveletcoeff (t, y, 3.3, 3/4 * maxfreq), +%! -2.35465091096084 + 1.01892561714824i, 5e-10); + + +%!demo +%! ## Generates the wavelet transform coefficient for time 0.5 and circ. freq. 0.9, for row & column vectors. +%! x = 1:10; +%! y = sin (x); +%! xt = x'; +%! yt = y'; +%! a = lswaveletcoeff (x, y, 0.5, 0.9) +%! b = lswaveletcoeff (xt, yt, 0.5, 0.9) + Modified: trunk/octave-forge/extra/lssa/src/fastlscomplex.cc =================================================================== --- trunk/octave-forge/extra/lssa/src/fastlscomplex.cc 2012-08-10 13:17:33 UTC (rev 10854) +++ trunk/octave-forge/extra/lssa/src/fastlscomplex.cc 2012-08-10 15:10:54 UTC (rev 10855) @@ -24,195 +24,225 @@ #include <iostream> #include <exception> +bool flscomplex (const RowVector & tvec, const ComplexRowVector & xvec, + double maxfreq, int octaves, int coefficients, ComplexRowVector & result) +DEFUN_DLD(fastlscomplex,args,nargout, +"-*- texinfo -*-\n\ +@deftypefn {Function File} { C = } fastlscomplex \ +(@var{time},@var{magnitude},@var{maximum_frequency},@var{octaves},@var{coefficients})\n \ +\n\ +Return the complex least squares transform of the (@var{time},@var{magnitude}) series\n\ +supplied, using the fast algorithm.\n\ +\n\ +@seealso{lscomplex, fastlsreal}\n\ +\n\ +@end deftypefn") +{ -ComplexRowVector flscomplex( RowVector tvec , ComplexRowVector xvec , - double maxfreq , int octaves , int coefficients); + octave_value_list retval; + if (args.length() != 5) + print_usage(); + else + { -DEFUN_DLD(fastlscomplex,args,nargout, - "-*- texinfo -*-\n" -"@deftypefn {Function File} { C = } fastlscomplex" - "(@var{time},@var{magnitude},@var{maximum_frequency},@var{octaves},@var{coefficients})\n" -"\n" -"Return the complex least squares transform of the (@var{time},@var{magnitude}) series\n\ -supplied, using the fast algorithm.\n" -"\n" -"@seealso{lscomplex, fastlsreal}\n" -"\n" -"@end deftypefn") { - if ( args.length() != 5 ) { - print_usage(); - return octave_value_list (); - } - RowVector tvals = args(0).row_vector_value(); - ComplexRowVector xvals = args(1).complex_row_vector_value(); - double omegamax = args(2).double_value(); - int noctaves = args(3).int_value(); - int ncoeff = args(4).int_value(); - if ( tvals.numel() != xvals.numel() ){ - if ( tvals.numel() > xvals.numel() ) { - error("More time values than magnitude values."); - } else { - error("More magnitude values than time values."); + RowVector tvals = args(0).row_vector_value (); + ComplexRowVector xvals = args(1).complex_row_vector_value (); + double omegamax = args(2).double_value (); + int noctaves = args(3).int_value (); + int ncoeff = args(4).int_value (); + + if (tvals.numel () != xvals.numel ()) + if (tvals.numel () > xvals.numel ()) + error ("fastlscomplex: More time values than magnitude values"); + else + error ("fastlscomplex: More magnitude values than time values"); + + if (ncoeff == 0) + error ("fastlscomplex: No coefficients to compute"); + if (noctaves == 0) + error ("fastlscomplex: No octaves to compute over"); + if (omegamax == 0) + error ("fastlscomplex: No difference between minimal and maximal frequency"); + + if (! error_state) + { + ComplexRowVector results; + if (flscomplex (tvals, xvals, omegamax, noctaves, ncoeff, results)) + retval(0) = octave_value (results); + else + error ("fastlscomplex: error in the underlying flscomplex function") + } + } - } - if ( ncoeff == 0 ) error("No coefficients to compute."); - if ( noctaves == 0 ) error("No octaves to compute over."); - if ( omegamax == 0 ) error("No difference between minimal and maximal frequency."); - octave_value_list retval; - if ( !error_state) { - ComplexRowVector results = flscomplex(tvals,xvals,omegamax,noctaves,ncoeff); - retval(0) = octave_value(results); - } else { - return octave_value_list (); - } + return retval; - } -ComplexRowVector flscomplex( RowVector tvec , ComplexRowVector xvec , - double maxfreq, int octaves, int coefficients ) { - struct Precomputation_Record { +bool flscomplex (const RowVector & tvec, const ComplexRowVector & xvec, + double maxfreq, int octaves, int coefficients, + ComplexRowVector & results) +{ + struct Precomputation_Record + { Precomputation_Record *next; std::complex<double> power_series[12]; // I'm using 12 as a matter of compatibility, only. bool stored_data; }; - ComplexRowVector results = ComplexRowVector (coefficients * octaves ); + results.resize (coefficients * octaves); double tau, delta_tau, tau_0, tau_h, n_inv, mu, te, omega_oct, omega_multiplier, octavemax, omega_working, loop_tau_0, loop_delta_tau, on_1, n_1, o; - double length = ( tvec((tvec.numel()-1)) - tvec( octave_idx_type (0))); + + double length = tvec(tvec.numel () - 1) - tvec(0); + int octave_iter, coeff_iter; - std::complex<double> zeta, zz, z_accumulator, exp_term, exp_multiplier, alpha, h, *tpra, *temp_ptr_alpha, temp_alpha[12], *tprb, *temp_ptr_beta, temp_beta[12], temp_array[12], *p, x; - octave_idx_type n = tvec.numel(); - for ( int array_iter = 0 ; array_iter < 12 ; array_iter++ ) { - temp_array[array_iter] = std::complex<double> ( 0 , 0 ); - } + + std::complex<double> zeta, zz, z_accumulator, exp_term, exp_multiplier, + alpha, h, *tpra, *temp_ptr_alpha, temp_alpha[12], *tprb, *temp_ptr_beta, + temp_beta[12], temp_array[12], *p, x; + + octave_idx_type n = tvec.numel (); + + for (int array_iter = 0; array_iter < 12; array_iter++) + temp_array[array_iter] = std::complex<double> (0 , 0); + int factorial_array[12]; factorial_array[0] = 1; - for ( int i = 1 ; i < 12 ; i++ ) { + + for (int i = 1; i < 12; i++) factorial_array[i] = factorial_array[i-1] * i; - } + n_1 = n_inv = 1.0 / n; - mu = (0.5 * M_PI)/length; // Per the article; this is in place to improve numerical accuracy if desired. + mu = (0.5 * M_PI) / length; // Per the article; this is in place to improve numerical accuracy if desired. /* Viz. the paper, in which Dtau = c / omega_max, and c is stated as pi/2 for floating point processors, * In the case of this computation, I'll go by the recommendation. */ - delta_tau = M_PI / ( 2 * maxfreq ); + + delta_tau = M_PI / (2 * maxfreq); tau_0 = tvec(0) + delta_tau; tau_h = tau_0; te = tau_h + delta_tau; - octave_idx_type k ( 0 ); // Iterator for accessing xvec, tvec. + octave_idx_type k = 0; // Iterator for accessing xvec, tvec. Precomputation_Record * precomp_records_head, *record_current, *record_tail, *record_ref, *record_next; record_current = precomp_records_head = new Precomputation_Record; - for ( te = tvec(k) + (2 * delta_tau) ; ; ) { - x = std::complex<double>(xvec(k)); + + for (te = tvec(k) + (2 * delta_tau) ; ;) { - double t = mu*(tvec(k)-tau_h), tt; - p = record_current->power_series; - // p = 0 - *p++ = std::complex<double>(x); - // p = 1 - tt = -t; - h = x * tt; - *p++ = std::complex<double>(-h.imag(),h.real()); - // p = 2 - tt *= t*(1.0/2.0); - *p++ = x*tt; - // p = 3 - tt *= t*(-1.0/3.0); - h = x * tt; - *p++ = std::complex<double>(-h.imag(),h.real()); - // p = 4 - tt *= t*(1.0/4.0); - *p++ = x*tt; - // p = 5 - tt *= t*(-1.0/5.0); - h = x * tt; - *p++ = std::complex<double>(-h.imag(),h.real()); - // p = 6 - tt *= t*(1.0/6.0); - *p++ = x*tt; - // p = 7 - tt *= t*(-1.0/7.0); - h = x * tt; - *p++ = std::complex<double>(-h.imag(),h.real()); - // p = 8 - tt *= t*(1.0/8.0); - *p++ = x*tt; - // p = 9 - tt *= t*(-1.0/9.0); - h = x * tt; - *p++ = std::complex<double>(-h.imag(),h.real()); - // p = 10 - tt *= t*(1.0/10.0); - *p++ = x*tt; - // p = 11 - tt *= t*(-1.0/11.0); - h = x * tt; - *p++ = std::complex<double>(-h.imag(),h.real()); - } - record_current->stored_data = true; - for(k++; ( k < n ) && tvec(k) < te ; k++ ) { x = std::complex<double>(xvec(k)); { - double t = mu*(tvec(k)-tau_h), tt; - p = record_current->power_series; - // p = 0 - *p++ += std::complex<double>(x); - // p = 1 - tt = -t; - h = x * tt; - *p++ += std::complex<double>(- h.imag(), h.real()); - // p = 2 - tt *= t*(1.0/2.0); - *p++ += x*tt; - // p = 3 - tt *= t*(-1.0/3.0); - h = x * tt; - *p++ += std::complex<double>(-h.imag(),h.real()); - // p = 4 - tt *= t*(1.0/4.0); - *p++ += x*tt; - // p = 5 - tt *= t*(-1.0/5.0); - h = x * tt; - *p++ += std::complex<double>(-h.imag(),h.real()); - // p = 6 - tt *= t*(1.0/6.0); - *p++ += x*tt; - // p = 7 - tt *= t*(-1.0/7.0); - h = x * tt; - *p++ += std::complex<double>(-h.imag(),h.real()); - // p = 8 - tt *= t*(1.0/8.0); - *p++ += x*tt; - // p = 9 - tt *= t*(-1.0/9.0); - h = x * tt; - *p++ += std::complex<double>(-h.imag(),h.real()); - // p = 10 - tt *= t*(1.0/10.0); - *p++ += x*tt; - // p = 11 - tt *= t*(-1.0/11.0); - h = x * tt; - *p++ += std::complex<double>(-h.imag(),h.real()); + double t = mu*(tvec(k)-tau_h), tt; + p = record_current->power_series; + // p = 0 + *p++ = std::complex<double>(x); + // p = 1 + tt = -t; + h = x * tt; + *p++ = std::complex<double>(-h.imag(),h.real()); + // p = 2 + tt *= t*(1.0/2.0); + *p++ = x*tt; + // p = 3 + tt *= t*(-1.0/3.0); + h = x * tt; + *p++ = std::complex<double>(-h.imag(),h.real()); + // p = 4 + tt *= t*(1.0/4.0); + *p++ = x*tt; + // p = 5 + tt *= t*(-1.0/5.0); + h = x * tt; + *p++ = std::complex<double>(-h.imag(),h.real()); + // p = 6 + tt *= t*(1.0/6.0); + *p++ = x*tt; + // p = 7 + tt *= t*(-1.0/7.0); + h = x * tt; + *p++ = std::complex<double>(-h.imag(),h.real()); + // p = 8 + tt *= t*(1.0/8.0); + *p++ = x*tt; + // p = 9 + tt *= t*(-1.0/9.0); + h = x * tt; + *p++ = std::complex<double>(-h.imag(),h.real()); + // p = 10 + tt *= t*(1.0/10.0); + *p++ = x*tt; + // p = 11 + tt *= t*(-1.0/11.0); + h = x * tt; + *p++ = std::complex<double>(-h.imag(),h.real()); } + record_current->stored_data = true; - } - if( k >= n ) break; - tau_h = te + delta_tau; - te = tau_h + delta_tau; - record_current->next = new Precomputation_Record; - record_current = record_current->next; + for(k++; k < n && tvec(k) < te; k++) + { + x = std::complex<double> (xvec(k)); + { + double t = mu*(tvec(k)-tau_h), tt; + p = record_current->power_series; + // p = 0 + *p++ += std::complex<double>(x); + // p = 1 + tt = -t; + h = x * tt; + *p++ += std::complex<double>(- h.imag(), h.real()); + // p = 2 + tt *= t*(1.0/2.0); + *p++ += x*tt; + // p = 3 + tt *= t*(-1.0/3.0); + h = x * tt; + *p++ += std::complex<double>(-h.imag(),h.real()); + // p = 4 + tt *= t*(1.0/4.0); + *p++ += x*tt; + // p = 5 + tt *= t*(-1.0/5.0); + h = x * tt; + *p++ += std::complex<double>(-h.imag(),h.real()); + // p = 6 + tt *= t*(1.0/6.0); + *p++ += x*tt; + // p = 7 + tt *= t*(-1.0/7.0); + h = x * tt; + *p++ += std::complex<double>(-h.imag(),h.real()); + // p = 8 + tt *= t*(1.0/8.0); + *p++ += x*tt; + // p = 9 + tt *= t*(-1.0/9.0); + h = x * tt; + *p++ += std::complex<double>(-h.imag(),h.real()); + // p = 10 + tt *= t*(1.0/10.0); + *p++ += x*tt; + // p = 11 + tt *= t*(-1.0/11.0); + h = x * tt; + *p++ += std::complex<double>(-h.imag(),h.real()); + } + record_current->stored_data = true; + } + + if (k >= n) + break; + + tau_h = te + delta_tau; + te = tau_h + delta_tau; + + record_current->next = new Precomputation_Record; + record_current = record_current->next; } + record_tail = record_current; record_current = precomp_records_head; record_tail->next = 0; @@ -222,152 +252,233 @@ */ omega_oct = maxfreq / mu; - omega_multiplier = exp(-log(2)/coefficients); + omega_multiplier = exp (-log(2) / coefficients); octavemax = maxfreq; loop_tau_0 = tau_0; loop_delta_tau = delta_tau; - octave_idx_type iter ( 0 ); + octave_idx_type iter = 0; // Loops need to first travel over octaves, then coefficients; - - for ( octave_iter = octaves ; ; omega_oct *= 0.5 , octavemax *= 0.5 , loop_tau_0 += loop_delta_tau , loop_delta_tau *= 2 ) { - o = omega_oct; - omega_working = octavemax; - for ( coeff_iter = 0 ; coeff_iter < coefficients ; coeff_iter++, o *= omega_multiplier, omega_working *= omega_multiplier){ - exp_term = std::complex<double> ( cos( - omega_working * loop_tau_0 ) , - sin ( - omega_working * loop_tau_0 ) ); - exp_multiplier = std::complex<double> ( cos ( - 2 * omega_working * loop_delta_tau ) , - sin ( - 2 * omega_working * loop_delta_tau ) ); - for ( zeta = 0, record_current = precomp_records_head ; record_current ; - record_current = record_current->next, exp_term *= exp_multiplier ) { - if ( record_current->stored_data ) { - int p; - for ( zz = 0 , p = 0, on_1 = n_1 ; p < 12 ; p++ ) { - zz += record_current->power_series[p] * on_1 ; - on_1 *= o; - } - zeta += exp_term * zz; - } - } - results(iter) = std::complex<double> (zeta); - iter++; + for (octave_iter = octaves; ; + omega_oct *= 0.5, octavemax *= 0.5, loop_tau_0 += loop_delta_tau, loop_delta_tau *= 2) + { + o = omega_oct; + omega_working = octavemax; + for (coeff_iter = 0; + coeff_iter < coefficients; + coeff_iter++, o *= omega_multiplier, omega_working *= omega_multiplier) + { + exp_term = std::complex<double> (cos (- omega_working * loop_tau_0) , + sin (- omega_working * loop_tau_0)); + + exp_multiplier = std::complex<double> (cos (- 2 * omega_working * loop_delta_tau) , + sin (- 2 * omega_working * loop_delta_tau)); + + for (zeta = 0, record_current = precomp_records_head; + record_current; + record_current = record_current->next, exp_term *= exp_multiplier ) + { + if (record_current->stored_data) + { + int p; + for (zz = 0, p = 0, on_1 = n_1; p < 12; p++) + { + zz += record_current->power_series[p] * on_1; + on_1 *= o; + } + zeta += exp_term * zz; + } + } + + results(iter) = std::complex<double> (zeta); + iter++; + } + if (! (--octave_iter)) + break; + + /* If we've already reached the lowest value, stop. + * Otherwise, merge with the next computation range. + */ + double *exp_pse_ptr, *exp_ptr, exp_power_series_elements[12]; + exp_power_series_elements[0] = 1; + exp_pse_ptr = exp_ptr = exp_power_series_elements; + + for (int r_iter = 1; r_iter < 12; r_iter++) + exp_power_series_elements[r_iter] = exp_power_series_elements[r_iter-1] * + (mu * loop_delta_tau) * (1.0 / ((double) r_iter)); + + try + { + for (record_current = precomp_records_head; + record_current; + record_current = record_current->next) + { + if (! (record_ref = record_current->next ) + || ! record_ref->stored_data ) + { + // 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++) + { + tpra = temp_ptr_alpha; + *(temp_ptr_alpha++) = std::complex<double>(record_current->power_series[p]); + for( exp_ptr = exp_power_series_elements, record_current->power_series[p] = *temp_ptr_alpha * *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 + * of memory, and then it does ... painful things with a few + * 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 ( ! 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; + } + } + } + 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; + } + } + } + + record_current->stored_data = true; + record_ref = record_next; + record_current->next = record_ref->next; + delete record_ref; + + } + } + } + } + catch (std::exception& e) + {//This section was part of my debugging, and may be removed. + std::cout << "Exception thrown: " << e.what() << std::endl; + ComplexRowVector exception_result (1); + exception_result(0) = false; + return exception_result; + } } - if ( !(--octave_iter) ) break; - /* If we've already reached the lowest value, stop. - * Otherwise, merge with the next computation range. - */ - double *exp_pse_ptr, *exp_ptr, exp_power_series_elements[12]; - exp_power_series_elements[0] = 1; - exp_pse_ptr = exp_ptr = exp_power_series_elements; - for ( int r_iter = 1 ; r_iter < 12 ; r_iter++ ) { - exp_power_series_elements[r_iter] = exp_power_series_elements[r_iter-1] - * ( mu * loop_delta_tau) * ( 1.0 / ( (double) r_iter ) ); - } - try{ - for ( record_current = precomp_records_head ; record_current ; - record_current = record_current->next ) { - if ( ! ( record_ref = record_current->next ) || ! record_ref->stored_data ) { - // 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++ ) { - tpra = temp_ptr_alpha; - *(temp_ptr_alpha++) = std::complex<double>(record_current->power_series[p]); - for( exp_ptr = exp_power_series_elements, record_current->power_series[p] = *temp_ptr_alpha * *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 - * of memory, and then it does ... painful things with a few - * 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 ( ! 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; - } - } - } 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; - } - } - } - record_current->stored_data = true; - record_ref = record_next; - record_current->next = record_ref->next; - delete record_ref; - } - } - } - } catch (std::exception& e) { //This section was part of my debugging, and may be removed. - std::cout << "Exception thrown: " << e.what() << std::endl; - ComplexRowVector exception_result (1); - exception_result(0) = std::complex<double> ( 0,0); - return exception_result; - } - } - return results; + + return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <be...@us...> - 2012-08-14 16:27:42
|
Revision: 10861 http://octave.svn.sourceforge.net/octave/?rev=10861&view=rev Author: benjf5 Date: 2012-08-14 16:27:34 +0000 (Tue, 14 Aug 2012) Log Message: ----------- DESCRIPTION update for lssa due to broadcasting, other miscellaneous help string changes. Modified Paths: -------------- trunk/octave-forge/extra/lssa/DESCRIPTION trunk/octave-forge/extra/lssa/inst/lscomplexwavelet.m trunk/octave-forge/extra/lssa/src/fastlscomplex.cc Modified: trunk/octave-forge/extra/lssa/DESCRIPTION =================================================================== --- trunk/octave-forge/extra/lssa/DESCRIPTION 2012-08-14 13:42:51 UTC (rev 10860) +++ trunk/octave-forge/extra/lssa/DESCRIPTION 2012-08-14 16:27:34 UTC (rev 10861) @@ -10,6 +10,6 @@ URLs). Url: http://www.jstatsoft.org/v11/i02 Problems: fast implementations, wavelet functions are currently not functional. -Depends: octave (>= 3.4.3) +Depends: octave (>= 3.6.0) Autoload: no License: GPLv3+ Modified: trunk/octave-forge/extra/lssa/inst/lscomplexwavelet.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lscomplexwavelet.m 2012-08-14 13:42:51 UTC (rev 10860) +++ trunk/octave-forge/extra/lssa/inst/lscomplexwavelet.m 2012-08-14 16:27:34 UTC (rev 10861) @@ -13,8 +13,11 @@ ## 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 -*- +## +## @deftypefn {Function File} {@var{t} =} lscomplexwavelet (@var{time}, +##@var{mag}, @var{maxfreq}, @var{numcoeff}, @var{numoctave}, - function transform = lscomplexwavelet( T, X, omegamax, ncoeff, noctave, tmin, tmax, tstep, sigma = 0.05) ## This is a transform based entirely on the simplified complex-valued transform Modified: trunk/octave-forge/extra/lssa/src/fastlscomplex.cc =================================================================== --- trunk/octave-forge/extra/lssa/src/fastlscomplex.cc 2012-08-14 13:42:51 UTC (rev 10860) +++ trunk/octave-forge/extra/lssa/src/fastlscomplex.cc 2012-08-14 16:27:34 UTC (rev 10861) @@ -25,16 +25,22 @@ #include <exception> bool flscomplex (const RowVector & tvec, const ComplexRowVector & xvec, - double maxfreq, int octaves, int coefficients, ComplexRowVector & result); + double maxfreq, int coefficients, int octaves, ComplexRowVector & result); DEFUN_DLD(fastlscomplex,args,nargout, "-*- texinfo -*-\n\ @deftypefn {Function File} { C = } fastlscomplex \ -(@var{time},@var{magnitude},@var{maximum_frequency},@var{octaves},@var{coefficients})\n \ +(@var{time},@var{magnitude},@var{maxfreq},@var{ncoeff},@var{noctave})\n \ \n\ -Return the complex least squares transform of the (@var{time},@var{magnitude}) series\n\ -supplied, using the fast algorithm.\n\ +Return a series of least-squares transforms of a complex time series via a divide and\n\ +conquer algorithm. Each transform is minimized independently at each frequency,\n\ +starting from @var{maxfreq} and descending over @var{ncoeff} frequencies for\n\ +each of @var{noctave} octaves.\n\ \n\ +For each result, the complex result for a given frequency o defines the real and\n\ +imaginary sinusoids which have the least distance to the data set: for a + bi,\n\ +the matching sinusoids are a cos (ot) + b i sin (ot).\n\ +\n\ @seealso{lscomplex, fastlsreal}\n\ \n\ @end deftypefn") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <be...@us...> - 2012-08-14 18:55:45
|
Revision: 10863 http://octave.svn.sourceforge.net/octave/?rev=10863&view=rev Author: benjf5 Date: 2012-08-14 18:55:38 +0000 (Tue, 14 Aug 2012) Log Message: ----------- Removed looped lsreal, lscomplex; detabified fastlsreal.cc, cleaned up spaces in fastlscomplex. Modified Paths: -------------- trunk/octave-forge/extra/lssa/src/fastlscomplex.cc trunk/octave-forge/extra/lssa/src/fastlsreal.cc Removed Paths: ------------- trunk/octave-forge/extra/lssa/inst/lscomplex.m.old trunk/octave-forge/extra/lssa/inst/lsreal.m.old Deleted: trunk/octave-forge/extra/lssa/inst/lscomplex.m.old =================================================================== --- trunk/octave-forge/extra/lssa/inst/lscomplex.m.old 2012-08-14 16:51:37 UTC (rev 10862) +++ trunk/octave-forge/extra/lssa/inst/lscomplex.m.old 2012-08-14 18:55:38 UTC (rev 10863) @@ -1,68 +0,0 @@ -## 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 3 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 -*- -## @deftypefn {Function File} {@var{t} =} lscomplex (@var{time}, @var{mag}, @var{maxfreq}, @var{numcoeff}, @var{numoctaves}) -## -## Return the complex least-squares transform of the (@var{time},@var{mag}) -## series, considering frequencies up to @var{maxfreq}, over @var{numoctaves} -## octaves and @var{numcoeff} coefficients. -## -## @seealso{lsreal} -## @end deftypefn - - -function transform = lscomplex (t, x, omegamax, ncoeff, noctave) - - ## VECTOR ONLY, and since t and x have the same number of - ## entries, there's no problem. - n = length (t); - - - transform = zeros (1, ncoeff * noctave); - - o = omegamax; - - omul = 2 ^ (- 1 / ncoeff); - - for iter = 1:ncoeff * noctave - - ot = o .* t; - - ## See the paper for the expression below - transform(iter) = sum ((cos (ot) - (sin (ot) .* i)) .* x) / n; - - - ## Advance the transform to the next coefficient in the octave - o *= omul; - - endfor - -endfunction - -%!test -%! maxfreq = 4 / ( 2 * pi ); -%! t = [0:0.008:8]; -%! x = ( 2 .* sin (maxfreq .* t) + -%! 3 .* sin ( (3 / 4) * maxfreq .* t)- -%! 0.5 .* sin ((1/4) * maxfreq .* t) - -%! 0.2 .* cos (maxfreq .* t) + -%! cos ((1/4) * maxfreq .* t)); -%! o = [ maxfreq , 3 / 4 * maxfreq , 1 / 4 * maxfreq ]; -%! assert (lscomplex (t, x, maxfreq, 2, 2), -%! [(-0.400924546169395 - 2.371555305867469i), ... -%! (1.218065147708429 - 2.256125004156890i), ... -%! (1.935428592212907 - 1.539488163739336i), ... -%! (2.136692292751917 - 0.980532175174563i)], 5e-10); Deleted: trunk/octave-forge/extra/lssa/inst/lsreal.m.old =================================================================== --- trunk/octave-forge/extra/lssa/inst/lsreal.m.old 2012-08-14 16:51:37 UTC (rev 10862) +++ trunk/octave-forge/extra/lssa/inst/lsreal.m.old 2012-08-14 18:55:38 UTC (rev 10863) @@ -1,79 +0,0 @@ -## Copyright (C) 2012 Benjamin Lewis -## -## 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 -## 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 -*- -## @deftypefn {Function File} {@var{transform} =} lsreal (@var{time}, @var{mag}, @var{maxfreq}, @var{numcoeff}, @var{numoctaves}) -## -## Return the real least-squares transform of the time series -## defined, based on the maximal frequency @var{maxfreq}, the -## number of coefficients @var{numcoeff}, and the number of -## octaves @var{numoctaves}. Each complex-valued result is the -## pair (c_o, s_o) defining the coefficients which best fit the -## function y = c_o * cos(ot) + s_o * sin(ot) to the (@var{time}, @var{mag}) data. -## -## @seealso{lscomplex} -## @end deftypefn - -function transform = lsreal (t, x, omegamax, ncoeff, noctave) - - ## FIXME : THIS IS VECTOR-ONLY. I'd need to add another bit of code to - ## make it array-safe, and that's not knowing right now what else - ## will be necessary. - k = n = length (t); - - transform = zeros (1, (noctave * ncoeff)); - - od = 2 ^ (- 1 / ncoeff); - o = omegamax; - n1 = 1 / n; - - ncoeffp = ncoeff * noctave; - - for iter = 1:ncoeffp - ## This method is an application of Eq. 8 on - ## page 6 of the text, as well as Eq. 7 - ot = o .* t; - - zeta = n1 * sum ((cos (ot) - i * sin (ot)) .* x); - - ot *= 2; - - iota = n1 * sum (cos (ot) - i * sin (ot)); - - - transform(iter) = (2 * (conj (zeta) - (conj (iota) * zeta)) / - (1 - (real (iota) ^ 2) - (imag (iota) ^ 2))); - - o *= od; - endfor - -endfunction - -%!test -%! maxfreq = 4 / ( 2 * pi ); -%! t = linspace(0,8); -%! x = ( 2 .* sin ( maxfreq .* t ) + -%! 3 .* sin ( (3/4) * maxfreq .* t ) - -%! 0.5 .* sin ( (1/4) * maxfreq .* t ) - -%! 0.2 .* cos ( maxfreq .* t ) + -%! cos ( (1/4) * maxfreq .* t ) ); -%! # In the assert here, I've got an error bound large enough to catch -%! # individual system errors which would present no real issue. -%! assert (lsreal (t,x,maxfreq,2,2), -%! [(-1.68275915310663 + 4.70126183846743i), ... -%! (1.93821553170889 + 4.95660209883437i), ... -%! (4.38145452686697 + 2.14403733658600i), ... -%! (5.27425332281147 - 0.73933440226597i)], -%! 5e-10) Modified: trunk/octave-forge/extra/lssa/src/fastlscomplex.cc =================================================================== --- trunk/octave-forge/extra/lssa/src/fastlscomplex.cc 2012-08-14 16:51:37 UTC (rev 10862) +++ trunk/octave-forge/extra/lssa/src/fastlscomplex.cc 2012-08-14 18:55:38 UTC (rev 10863) @@ -43,12 +43,12 @@ \n\ @seealso{lscomplex, fastlsreal}\n\ \n\ -@end deftypefn") +@end deftypefn") { - octave_value_list retval; + octave_value_list retval; - if (args.length() != 5) + if (args.length() != 5) print_usage(); else { @@ -60,38 +60,37 @@ int ncoeff = args(4).int_value (); if (tvals.numel () != xvals.numel ()) - if (tvals.numel () > xvals.numel ()) + if (tvals.numel () > xvals.numel ()) error ("fastlscomplex: More time values than magnitude values"); - else + else error ("fastlscomplex: More magnitude values than time values"); - - if (ncoeff == 0) + if (ncoeff == 0) error ("fastlscomplex: No coefficients to compute"); - if (noctaves == 0) + if (noctaves == 0) error ("fastlscomplex: No octaves to compute over"); - if (omegamax == 0) + if (omegamax == 0) error ("fastlscomplex: No difference between minimal and maximal frequency"); - if (! error_state) + if (! error_state) { ComplexRowVector results; if (flscomplex (tvals, xvals, omegamax, noctaves, ncoeff, results)) retval(0) = octave_value (results); else error ("fastlscomplex: error in the underlying flscomplex function"); - } - + } + } return retval; } bool flscomplex (const RowVector & tvec, const ComplexRowVector & xvec, - double maxfreq, int octaves, int coefficients, - ComplexRowVector & results) + double maxfreq, int octaves, int coefficients, + ComplexRowVector & results) { - - struct Precomputation_Record + + struct Precomputation_Record { Precomputation_Record *next; std::complex<double> power_series[12]; // I'm using 12 as a matter of compatibility, only. @@ -112,19 +111,19 @@ int octave_iter, coeff_iter; - std::complex<double> zeta, zz, z_accumulator, exp_term, exp_multiplier, - alpha, h, *tpra, *temp_ptr_alpha, temp_alpha[12], *tprb, *temp_ptr_beta, + std::complex<double> zeta, zz, z_accumulator, exp_term, exp_multiplier, + alpha, h, *tpra, *temp_ptr_alpha, temp_alpha[12], *tprb, *temp_ptr_beta, temp_beta[12], temp_array[12], *p, x; octave_idx_type n = tvec.numel (); - for (int array_iter = 0; array_iter < 12; array_iter++) + for (int array_iter = 0; array_iter < 12; array_iter++) temp_array[array_iter] = std::complex<double> (0 , 0); - + int factorial_array[12]; factorial_array[0] = 1; - for (int i = 1; i < 12; i++) + for (int i = 1; i < 12; i++) factorial_array[i] = factorial_array[i-1] * i; n_1 = n_inv = 1.0 / n; @@ -244,7 +243,7 @@ record_current->stored_data = true; } - if (k >= n) + if (k >= n) break; tau_h = te + delta_tau; @@ -257,7 +256,7 @@ record_tail = record_current; record_current = precomp_records_head; record_tail->next = 0; - + /* Summation of coefficients for each frequency. As we have ncoeffs * noctaves elements, * it makes sense to work from the top down, as we have omega_max by default (maxfreq) */ @@ -267,18 +266,18 @@ octavemax = maxfreq; loop_tau_0 = tau_0; loop_delta_tau = delta_tau; - + octave_idx_type iter = 0; - + // Loops need to first travel over octaves, then coefficients; - for (octave_iter = octaves; ; + for (octave_iter = octaves; ; omega_oct *= 0.5, octavemax *= 0.5, loop_tau_0 += loop_delta_tau, loop_delta_tau *= 2) { o = omega_oct; omega_working = octavemax; - for (coeff_iter = 0; - coeff_iter < coefficients; - coeff_iter++, o *= omega_multiplier, + for (coeff_iter = 0; + coeff_iter < coefficients; + coeff_iter++, o *= omega_multiplier, omega_working *= omega_multiplier) { exp_term = std::complex<double> (cos (- omega_working * loop_tau_0), @@ -287,14 +286,14 @@ exp_multiplier = std::complex<double> (cos (- 2 * omega_working * loop_delta_tau) , sin (- 2 * omega_working * loop_delta_tau)); - for (zeta = 0, record_current = precomp_records_head; + for (zeta = 0, record_current = precomp_records_head; record_current; record_current = record_current->next, exp_term *= exp_multiplier ) { - if (record_current->stored_data) + if (record_current->stored_data) { int p; - for (zz = 0, p = 0, on_1 = n_1; p < 12; p++) + for (zz = 0, p = 0, on_1 = n_1; p < 12; p++) { zz += record_current->power_series[p] * on_1; on_1 *= o; @@ -302,40 +301,39 @@ zeta += exp_term * zz; } } - results(iter) = std::complex<double> (zeta); iter++; } - if (! (--octave_iter)) + if (! (--octave_iter)) break; - + /* If we've already reached the lowest value, stop. * Otherwise, merge with the next computation range. */ double *exp_pse_ptr, *exp_ptr, exp_power_series_elements[12]; exp_power_series_elements[0] = 1; exp_pse_ptr = exp_ptr = exp_power_series_elements; - - for (int r_iter = 1; r_iter < 12; r_iter++) + + for (int r_iter = 1; r_iter < 12; r_iter++) exp_power_series_elements[r_iter] = exp_power_series_elements[r_iter-1] * (mu * loop_delta_tau) * (1.0 / ((double) r_iter)); - + try - { - for (record_current = precomp_records_head; + { + for (record_current = precomp_records_head; record_current; - record_current = record_current->next) + record_current = record_current->next) { - if (! (record_ref = record_current->next ) - || ! record_ref->stored_data ) + if (! (record_ref = record_current->next ) + || ! record_ref->stored_data ) { // In this case, there is no next record, but this record has data. - if (record_current->stored_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++) + p < 12; + p++ , exp_pse_ptr++) { tpra = temp_ptr_alpha; *(temp_ptr_alpha++) = std::complex<double>(record_current->power_series[p]); @@ -348,29 +346,29 @@ * actually be accessed for the first iterations, it's easier. */ - if (++exp_ptr >= exp_pse_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 ) + + if (++exp_ptr >= exp_pse_ptr ) break; --tpra; record_current->power_series[p] -= *tpra * *exp_ptr; - if (++exp_ptr >= exp_pse_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) + + if (++exp_ptr >= exp_pse_ptr) break; --tpra; @@ -378,112 +376,112 @@ } } - if ( ! record_ref ) + if ( ! record_ref ) break; // Last record was reached - } - else + } + else { record_next = record_ref; - if ( record_current->stored_data ) + 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++) + 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 ) + 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 ) + + if ( ++exp_ptr >= exp_pse_ptr ) break; - + tpra -= 2; record_current->power_series[p] -= *tpra * *exp_ptr; - - if (++exp_ptr >= exp_pse_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) + + if (++exp_ptr >= exp_pse_ptr) break; - + tpra -= 2; record_current->power_series[p] += *tpra * *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++) + 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, + + for (exp_ptr = exp_power_series_elements, record_next->power_series[q] = *tpra * *exp_ptr; ;) { - if (++exp_ptr >= exp_pse_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) + + if (++exp_ptr >= exp_pse_ptr) break; - + --tpra; record_next->power_series[q] -= *tpra * *exp_ptr; - - if ( ++exp_ptr >= exp_pse_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) + + if (++exp_ptr >= exp_pse_ptr) break; - + --tpra; record_next->power_series[q] += *tpra * *exp_ptr; } } } - + record_current->stored_data = true; record_ref = record_next; record_current->next = record_ref->next; delete record_ref; - + } } } - } - catch (std::exception & e) + } + catch (std::exception & e) {//This section was part of my debugging, and may be removed. std::cout << "Exception thrown: " << e.what() << std::endl; return (false); Modified: trunk/octave-forge/extra/lssa/src/fastlsreal.cc =================================================================== --- trunk/octave-forge/extra/lssa/src/fastlsreal.cc 2012-08-14 16:51:37 UTC (rev 10862) +++ trunk/octave-forge/extra/lssa/src/fastlsreal.cc 2012-08-14 18:55:38 UTC (rev 10863) @@ -25,11 +25,11 @@ #include <exception> ComplexRowVector flsreal( RowVector tvec , ComplexRowVector xvec , - double maxfreq , int octaves , int coefficients); + double maxfreq , int octaves , int coefficients); DEFUN_DLD(fastlsreal,args,nargout, - "-*- texinfo -*-\n\ + "-*- texinfo -*-\n\ @deftypefn {Function File} { C = } fastlsreal(@var{time},@var{magnitude},@var{maximum_frequency},@var{octaves},@var{coefficients})\n\ \n\ Return the real least-sqaures spectral fit to the (@var{time},@var{magnitude})\n\ @@ -68,7 +68,7 @@ } ComplexRowVector flsreal( RowVector tvec , RowVector xvec , - double maxfreq, int octaves, int coefficients ) { + double maxfreq, int octaves, int coefficients ) { struct XTElem { double x, t; }; @@ -169,55 +169,55 @@ for(k++; ( k < n ) && tvec(k) < te ; k++ ) { x = xvec(k); { - double t = mu*(tvec(k)-tau_h), tt; - p = record_current->power_series; - // p = 0 - p->x += x; - (p++)->t += 1; - // p = 1 - tt = -t; - p->x += x * tt; - (p++)->t += tt; - // p = 2 - tt *= t*(1.0/2.0); - p->x += x * tt; - (p++)->t += tt; - // p = 3 - tt *= t*(-1.0/3.0); - p->x += x * tt; - (p++)->t += tt; - // p = 4 - tt *= t*(1.0/4.0); - p->x += x * tt; - (p++)->t += tt; - // p = 5 - tt *= t*(-1.0/5.0); - p->x += x * tt; - (p++)->t += tt; - // p = 6 - tt *= t*(1.0/6.0); - p->x += x * tt; - (p++)->t += tt; - // p = 7 - tt *= t*(-1.0/7.0); - p->x += x * tt; - (p++)->t += tt; - // p = 8 - tt *= t*(1.0/8.0); - p->x += x * tt; - (p++)->t += tt; - // p = 9 - tt *= t*(-1.0/9.0); - p->x += x * tt; - (p++)->t += tt; - // p = 10 - tt *= t*(1.0/10.0); - p->x += x * tt; - (p++)->t += tt; - // p = 11 - tt *= t*(-1.0/11.0); - p->x += x * tt; - (p++)->t += tt; + double t = mu*(tvec(k)-tau_h), tt; + p = record_current->power_series; + // p = 0 + p->x += x; + (p++)->t += 1; + // p = 1 + tt = -t; + p->x += x * tt; + (p++)->t += tt; + // p = 2 + tt *= t*(1.0/2.0); + p->x += x * tt; + (p++)->t += tt; + // p = 3 + tt *= t*(-1.0/3.0); + p->x += x * tt; + (p++)->t += tt; + // p = 4 + tt *= t*(1.0/4.0); + p->x += x * tt; + (p++)->t += tt; + // p = 5 + tt *= t*(-1.0/5.0); + p->x += x * tt; + (p++)->t += tt; + // p = 6 + tt *= t*(1.0/6.0); + p->x += x * tt; + (p++)->t += tt; + // p = 7 + tt *= t*(-1.0/7.0); + p->x += x * tt; + (p++)->t += tt; + // p = 8 + tt *= t*(1.0/8.0); + p->x += x * tt; + (p++)->t += tt; + // p = 9 + tt *= t*(-1.0/9.0); + p->x += x * tt; + (p++)->t += tt; + // p = 10 + tt *= t*(1.0/10.0); + p->x += x * tt; + (p++)->t += tt; + // p = 11 + tt *= t*(-1.0/11.0); + p->x += x * tt; + (p++)->t += tt; } record_current->stored_data = true; } @@ -250,33 +250,33 @@ omega_working = octavemax; for ( coeff_iter = 0 ; coeff_iter < coefficients ; coeff_iter++, o *= omega_multiplier, omega_working *= omega_multiplier){ exp_term = std::complex<double> ( cos( - omega_working * loop_tau_0 ) , - sin ( - omega_working * loop_tau_0 ) ); + sin ( - omega_working * loop_tau_0 ) ); exp_squared = exp_term * exp_term; exp_multiplier = std::complex<double> ( cos ( - 2 * omega_working * loop_delta_tau ) , - sin ( - 2 * omega_working * loop_delta_tau ) ); + sin ( - 2 * omega_working * loop_delta_tau ) ); exp_squared_multiplier = exp_multiplier * exp_multiplier; for ( zeta = iota = 0, record_current = precomp_records_head ; record_current ; - record_current = record_current->next, exp_term *= exp_multiplier, + record_current = record_current->next, exp_term *= exp_multiplier, exp_squared *= exp_squared_multiplier ) { - if ( record_current->stored_data ) { - int p; - for ( zz = ii = 0 , p = 0, on_1 = n_1 ; p < 12 ; ) { - zz.real() += record_current->power_series[p]->x * on_1; - ii.real() += record_current->power_series[p++]-> t * o2n_1; - on_1 *= o; - o2n_1 *= o2; - zz.imag() += record_current->power_series[p]->x * on_1; - ii.imag() += record_current->power_series[p++]-> t * o2n_1; - on_1 *= o; - o2n_1 *= o2; - } - zeta += exp_term * zz; - iota += exp_squared * ii; - } + if ( record_current->stored_data ) { + int p; + for ( zz = ii = 0 , p = 0, on_1 = n_1 ; p < 12 ; ) { + zz.real() += record_current->power_series[p]->x * on_1; + ii.real() += record_current->power_series[p++]-> t * o2n_1; + on_1 *= o; + o2n_1 *= o2; + zz.imag() += record_current->power_series[p]->x * on_1; + ii.imag() += record_current->power_series[p++]-> t * o2n_1; + on_1 *= o; + o2n_1 *= o2; + } + zeta += exp_term * zz; + iota += exp_squared * ii; + } } results(iter) = 2 / ( 1 - ( iota.real() * iota.real() ) - (iota.imag() * - iota.imag() ) - * ( conj(zeta) - conj(iota) * zeta ); + iota.imag() ) + * ( conj(zeta) - conj(iota) * zeta ); iter++; } if ( !(--octave_iter) ) break; @@ -288,104 +288,104 @@ exp_pse_ptr = exp_ptr = exp_power_series_elements; for ( int r_iter = 1 ; r_iter < 12 ; r_iter++ ) { exp_power_series_elements[r_iter] = exp_power_series_elements[r_iter-1] - * ( mu * loop_delta_tau) * ( 1.0 / ( (double) r_iter ) ); + * ( mu * loop_delta_tau) * ( 1.0 / ( (double) r_iter ) ); } try{ for ( record_current = precomp_records_head ; record_current ; - record_current = record_current->next ) { - if ( ! ( record_ref = record_current->next ) || ! record_ref->stored_data ) { - // 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 , 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_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 - * of memory, and then it does ... painful things with a few - * numbers. However, remembering that most of these will not - * actually be accessed for the first iterations, it's easier. - */ - 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; - 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; - } - 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; - } - } 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; - } + record_current = record_current->next ) { + if ( ! ( record_ref = record_current->next ) || ! record_ref->stored_data ) { + // 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 , 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_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 + * of memory, and then it does ... painful things with a few + * numbers. However, remembering that most of these will not + * actually be accessed for the first iterations, it's easier. + */ + 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; + 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; + } + 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; + } + } 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. |
From: <be...@us...> - 2012-08-16 16:30:04
|
Revision: 10880 http://octave.svn.sourceforge.net/octave/?rev=10880&view=rev Author: benjf5 Date: 2012-08-16 16:29:54 +0000 (Thu, 16 Aug 2012) Log Message: ----------- Added sanity checks to functions, improved some documentation for lssa. Modified Paths: -------------- trunk/octave-forge/extra/lssa/INDEX trunk/octave-forge/extra/lssa/data/ch4.csv trunk/octave-forge/extra/lssa/data/co2.csv trunk/octave-forge/extra/lssa/data/deut.csv trunk/octave-forge/extra/lssa/data/dust.csv trunk/octave-forge/extra/lssa/data/o18.csv 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/lscomplex.m trunk/octave-forge/extra/lssa/inst/lscomplexwavelet.m trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m trunk/octave-forge/extra/lssa/inst/lsreal.m trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m trunk/octave-forge/extra/lssa/src/fastlscomplex.cc Modified: trunk/octave-forge/extra/lssa/INDEX =================================================================== --- trunk/octave-forge/extra/lssa/INDEX 2012-08-15 14:40:58 UTC (rev 10879) +++ trunk/octave-forge/extra/lssa/INDEX 2012-08-16 16:29:54 UTC (rev 10880) @@ -6,11 +6,9 @@ Accelerated time-series functions fastlscomplex Complex time-series functions - lscomplex fastlscomplex lswaveletcoeff -# lscomplexwavelet + lscomplex Real time-series functions lsreal -# lsrealwavelet Correlation lscorrcoeff Wavelet Transform Modified: trunk/octave-forge/extra/lssa/data/ch4.csv =================================================================== --- trunk/octave-forge/extra/lssa/data/ch4.csv 2012-08-15 14:40:58 UTC (rev 10879) +++ trunk/octave-forge/extra/lssa/data/ch4.csv 2012-08-16 16:29:54 UTC (rev 10880) @@ -1,459 +1,458 @@ -"","Depth.corrected","Ice.age..GT4.","Gas.age","CH4..ppbv." -"1",149.2,5683,2347,668 -"2",173.1,6828,3634,636 -"3",177.4,7043,3833,595 -"4",228.7,9528,6225,588 -"5",236.4,9901,6614,574 -"6",266,11334,8113,616 -"7",303.8,13526,10189,667 -"8",321.2,14538,11013,621 -"9",325,14775,11143,511 -"10",331.7,15215,11329,477 -"11",342.1,15922,11719,501 -"12",356,16974,12626,662 -"13",365.6,17755,13412,610 -"14",366.2,17803,13457,642 -"15",381.7,19089,14241,445 -"16",426.3,22829,16417,395 -"17",443.5,24315,17695,363 -"18",458.3,25557,18950,349 -"19",471,26595,20004,379 -"20",491.3,28356,21636,348 -"21",506.4,29630,22977,406 -"22",507.4,29716,23059,339 -"23",510.2,29967,23392,371 -"24",513.6,30250,23714,377 -"25",517.6,30591,24146,403 -"26",519.7,30761,24327,403 -"27",522.5,30998,24643,340 -"28",522.6,31011,24654,360 -"29",522.7,31020,24662,381 -"30",525.6,31266,24875,358 -"31",528.2,31487,25073,392 -"32",532.2,31828,25423,377 -"33",532.4,31845,25440,381 -"34",532.4,31845,25440,379 -"35",535,32058,25684,360 -"36",540,32465,25999,363 -"37",541.5,32583,26099,382 -"38",541.5,32583,26099,386 -"39",545.2,32887,26336,387 -"40",547,33042,26471,412 -"41",549.4,33240,26672,426 -"42",552,33461,26884,418 -"43",554.2,33646,27064,448 -"44",556.5,33833,27342,464 -"45",560.2,34136,27702,435 -"46",562.5,34318,27951,416 -"47",563.1,34371,28016,403 -"48",565.2,34530,28195,382 -"49",569.2,34832,28551,396 -"50",571.4,34985,28743,425 -"51",574.3,35210,28943,435 -"52",577.8,35464,29130,436 -"53",581.8,35766,29410,421 -"54",582.8,35839,29493,416 -"55",583.3,35876,29542,429 -"56",589.2,36346,30175,481 -"57",591.7,36558,30385,489 -"58",593.8,36729,30591,482 -"59",599.1,37157,31088,394 -"60",602.6,37444,31479,429 -"61",609.7,38013,32176,469 -"62",612,38203,32384,505 -"63",615.5,38491,32715,548 -"64",617.7,38678,32952,532 -"65",619.5,38826,33161,520 -"66",622.2,39039,33474,530 -"67",625.1,39268,33823,509 -"68",627.6,39464,34108,500 -"69",627.6,39464,34108,483 -"70",629.2,39593,34285,484 -"71",633.4,39917,34644,418 -"72",635.1,40060,34784,403 -"73",639.5,40424,35038,459 -"74",641.3,40573,35163,414 -"75",644.6,40841,35387,375 -"76",648,41112,35573,423 -"77",649.2,41209,35645,443 -"78",653.8,41551,35883,431 -"79",664.1,42305,36641,484 -"80",682,43702,38109,520 -"81",683,43785,38201,493 -"82",694.6,44764,39388,424 -"83",699.5,45181,39828,448 -"84",706.1,45770,40626,537 -"85",712.9,46360,41358,522 -"86",724.8,47360,42131,441 -"87",748.3,49296,43546,419 -"88",765.3,50634,44788,402 -"89",788.2,52446,47024,466 -"90",812,54457,49398,504 -"91",834.8,56300,51174,480 -"92",860.6,58258,52870,514 -"93",885.3,60288,55564,528 -"94",911.4,62633,57737,442 -"95",937.3,65016,59604,411 -"96",962.4,67405,61582,414 -"97",986.3,69627,63694,415 -"98",1011.3,71767,65701,434 -"99",1037.5,74017,68495,424 -"100",1062.2,76023,71014,458 -"101",1087.2,78042,72849,430 -"102",1112.6,80064,75367,462 -"103",1137.7,81921,76875,402 -"104",1162.1,83615,78995,438 -"105",1186.5,85262,81122,497 -"106",1209.7,86826,82843,545 -"107",1237.2,88808,84929,594 -"108",1261.2,90609,86323,529 -"109",1289.2,92632,88051,425 -"110",1309.2,94039,89363,417 -"111",1338.2,96047,91691,454 -"112",1363.7,97841,93660,443 -"113",1387.2,99498,95349,406 -"114",1413,101234,96900,407 -"115",1442.8,103125,99067,476 -"116",1451.4,103726,99833,480 -"117",1463.3,104574,100842,521 -"118",1476.1,105492,101829,493 -"119",1505,107599,103372,559 -"120",1526.2,109395,105204,591 -"121",1532,109872,105675,564 -"122",1542.1,110674,106203,437 -"123",1557.4,111923,107007,451 -"124",1582.8,113952,108994,468 -"125",1614.8,116215,111442,448 -"126",1627.7,117059,112559,443 -"127",1630.3,117221,112793,463 -"128",1637.7,117677,113479,505 -"129",1638.8,117747,113574,483 -"130",1643.4,118037,114031,497 -"131",1649,118376,114508,511 -"132",1654.5,118705,115060,485 -"133",1658.6,118958,115401,503 -"134",1664.5,119314,115768,520 -"135",1667.6,119504,116037,550 -"136",1669.5,119620,116200,531 -"137",1671.3,119728,116353,548 -"138",1674.2,119907,116605,575 -"139",1680,120259,117052,541 -"140",1684.5,120528,117342,555 -"141",1686.2,120623,117446,572 -"142",1688.4,120749,117589,590 -"143",1694,121079,117964,560 -"144",1694.6,121116,118010,573 -"145",1697.7,121296,118205,575 -"146",1704.7,121710,118631,563 -"147",1708.8,121941,118853,559 -"148",1714.2,122245,119164,589 -"149",1716,122345,119273,573 -"150",1719.4,122538,119499,584 -"151",1722.6,122718,119704,591 -"152",1731.2,123222,120320,603 -"153",1735.2,123443,120571,601 -"154",1736.8,123535,120652,578 -"155",1739,123658,120765,606 -"156",1744.3,123953,121090,592 -"157",1751.5,124348,121561,598 -"158",1754.3,124505,121752,594 -"159",1759.4,124787,122020,618 -"160",1765.5,125136,122367,592 -"161",1768.5,125298,122528,594 -"162",1770,125380,122606,600 -"163",1775.7,125692,122968,598 -"164",1780,125933,123279,604 -"165",1783.1,126109,123445,601 -"166",1786.8,126316,123677,622 -"167",1789.2,126447,123815,602 -"168",1789.4,126458,123826,630 -"169",1794.2,126710,124077,618 -"170",1797.8,126893,124244,619 -"171",1804.5,127236,124597,610 -"172",1814.8,127750,125176,649 -"173",1818.4,127930,125354,645 -"174",1819.6,127992,125424,623 -"175",1820.4,128032,125468,677 -"176",1824.6,128239,125679,672 -"177",1831,128549,126093,633 -"178",1832.3,128614,126200,644 -"179",1834.2,128712,126343,644 -"180",1834.7,128738,126380,636 -"181",1838.5,128932,126652,632 -"182",1844.8,129266,127008,638 -"183",1848.4,129450,127214,655 -"184",1852.3,129669,127440,666 -"185",1853.9,129752,127526,683 -"186",1857.4,129937,127716,653 -"187",1860.6,130111,127890,687 -"188",1863.8,130286,128080,708 -"189",1869.4,130605,128364,710 -"190",1870.2,130653,128399,699 -"191",1874.4,130904,128576,700 -"192",1875.5,130973,128632,704 -"193",1878.8,131178,128812,676 -"194",1883.3,131459,129062,552 -"195",1884.2,131519,129125,565 -"196",1888.6,131813,129348,540 -"197",1893.4,132149,129675,560 -"198",1897.9,132470,129898,524 -"199",1903.6,132880,130172,542 -"200",1910.9,133444,130549,492 -"201",1921.5,134310,131146,477 -"202",1922.3,134383,131195,491 -"203",1932.1,135318,131795,453 -"204",1954.6,137611,133340,431 -"205",1969.9,139296,134211,399 -"206",1980.2,140452,135003,352 -"207",1987.4,141257,135683,357 -"208",1994.7,142075,136367,374 -"209",1998,142440,136659,377 -"210",2005.9,143326,137393,348 -"211",2009.4,143720,137686,339 -"212",2016.4,144496,138408,318 -"213",2030.9,146122,140072,319 -"214",2042.5,147403,141422,345 -"215",2063.7,149756,143980,355 -"216",2088.6,152467,146784,356 -"217",2102.4,154026,148566,400 -"218",2109,154786,149406,418 -"219",2116,155625,150303,410 -"220",2119,155987,150633,376 -"221",2127.2,156981,151441,395 -"222",2137.1,158157,152562,445 -"223",2143,158819,153173,414 -"224",2153.4,159908,154129,382 -"225",2164,161077,155299,377 -"226",2167.2,161450,155706,406 -"227",2177.3,162574,157299,403 -"228",2180.4,162912,157806,381 -"229",2196.4,164820,159791,376 -"230",2225,168391,162996,405 -"231",2247,170922,165278,420 -"232",2273,174105,169266,478 -"233",2302,177644,172596,456 -"234",2312.3,179000,174189,402 -"235",2325,180546,175440,468 -"236",2348,183525,178550,503 -"237",2363,185640,180779,522 -"238",2373,187067,181718,464 -"239",2386,188892,183355,470 -"240",2399,190587,185063,510 -"241",2414,192382,187199,445 -"242",2425,193816,189335,440 -"243",2437,195298,191057,414 -"244",2475,199904,195625,460 -"245",2501,202717,199292,558 -"246",2525,205458,202212,612 -"247",2543,207803,204283,482 -"248",2552,208947,205148,425 -"249",2554.9,209310,205439,421 -"250",2557.7,209648,205715,413 -"251",2560.9,210056,206122,436 -"252",2564.9,210526,206675,466 -"253",2567.5,210840,207033,463 -"254",2570.4,211178,207418,455 -"255",2574.2,211628,207991,496 -"256",2575.5,211784,208183,475 -"257",2579.9,212295,208796,476 -"258",2581.9,212531,209078,485 -"259",2584.7,212846,209414,515 -"260",2588.5,213282,209975,473 -"261",2590.4,213503,210237,498 -"262",2595.1,214036,210830,567 -"263",2596.7,214219,211005,503 -"264",2600.4,214642,211481,509 -"265",2603.7,215011,211929,586 -"266",2606.6,215343,212281,551 -"267",2609.7,215685,212662,554 -"268",2612.5,216019,213010,545 -"269",2615.5,216377,213385,569 -"270",2621.7,217099,214153,581 -"271",2629,217944,214996,558 -"272",2633.5,218492,215504,568 -"273",2636.7,218908,215879,586 -"274",2639.5,219276,216310,544 -"275",2643.7,219835,216923,557 -"276",2646.4,220230,217253,541 -"277",2649.4,220678,217577,483 -"278",2656.2,221718,218342,440 -"279",2659.5,222273,218767,436 -"280",2666.7,223548,219680,476 -"281",2669.4,224060,220047,473 -"282",2674.6,224993,220760,498 -"283",2676.9,225380,220997,480 -"284",2682.6,226339,221612,482 -"285",2691,227885,222958,494 -"286",2693.6,228349,223446,532 -"287",2698,229167,224630,532 -"288",2700.5,229641,225136,512 -"289",2702.9,230076,225535,506 -"290",2705.6,230547,225888,497 -"291",2707.9,230945,226213,483 -"292",2711.8,231619,226726,484 -"293",2714.7,232092,227224,476 -"294",2717.7,232571,227840,445 -"295",2732.5,234771,230668,439 -"296",2735.7,235233,231383,460 -"297",2738.7,235652,231990,495 -"298",2741.9,236109,232615,502 -"299",2744.8,236498,233139,514 -"300",2747.6,236866,233646,541 -"301",2751.1,237301,234126,540 -"302",2753.6,237602,234470,550 -"303",2756.2,237889,234781,540 -"304",2759.2,238213,235222,554 -"305",2765.2,238907,236234,582 -"306",2771.2,239672,237466,619 -"307",2773.5,240010,237834,631 -"308",2776.5,240465,238199,650 -"309",2780,241055,238623,500 -"310",2782.8,241549,238943,554 -"311",2785.5,242091,239249,538 -"312",2788.5,242675,239545,522 -"313",2794.6,243821,240205,498 -"314",2797.5,244444,240576,484 -"315",2800.5,245091,240966,470 -"316",2806.5,246378,242067,509 -"317",2815.6,248369,243657,402 -"318",2818.5,249027,244198,437 -"319",2821.5,249668,244861,401 -"320",2824.5,250307,245481,380 -"321",2830.4,251542,246709,405 -"322",2833.8,252268,247436,399 -"323",2836.5,252876,248083,424 -"324",2839.5,253557,248977,447 -"325",2842.4,254218,249751,465 -"326",2845.5,254871,250460,467 -"327",2851.5,256180,251519,421 -"328",2854.4,256860,252183,410 -"329",2857.5,257602,252957,511 -"330",2860.5,258358,253889,486 -"331",2866.5,259879,255230,398 -"332",2870.4,260916,256038,408 -"333",2872.7,261510,256489,385 -"334",2876.2,262453,257245,402 -"335",2881.5,263865,258495,457 -"336",2884.5,264663,259226,445 -"337",2887.5,265454,259956,426 -"338",2890.5,266260,260759,448 -"339",2893.5,267040,261596,454 -"340",2896.4,267804,262388,448 -"341",2899.5,268556,263204,441 -"342",2902.5,269304,264042,442 -"343",2905.5,270050,264831,443 -"344",2911.4,271448,266485,417 -"345",2914.5,272177,267443,453 -"346",2917.5,272836,268273,429 -"347",2919.4,273254,268677,441 -"348",2926.5,274800,270677,484 -"349",2935.5,276729,273010,472 -"350",2941.5,278016,274443,508 -"351",2944.5,278704,275209,516 -"352",2951.2,280356,276867,522 -"353",2956.5,281738,277924,430 -"354",2964.5,283807,279541,430 -"355",2973.9,286496,282325,507 -"356",2979.5,288010,283491,464 -"357",2988.6,290551,286214,482 -"358",2994.5,292129,287852,522 -"359",2997.5,292853,288492,454 -"360",3000.4,293619,289444,433 -"361",3003.5,294493,290568,438 -"362",3009.5,296156,292472,475 -"363",3015.6,297835,293700,429 -"364",3018.5,298620,294611,468 -"365",3021.5,299407,295514,464 -"366",3027.7,300970,297181,460 -"367",3030.4,301671,298058,487 -"368",3033.5,302450,299016,486 -"369",3036.5,303199,299875,511 -"370",3039.5,303931,300639,545 -"371",3042.5,304738,301489,539 -"372",3045.5,305609,302452,603 -"373",3048.5,306552,303328,568 -"374",3051.5,307461,303951,588 -"375",3054.5,308352,304584,435 -"376",3057.7,309277,305303,443 -"377",3060.5,310076,306088,457 -"378",3063.5,310900,307124,478 -"379",3066.5,311701,308097,478 -"380",3072.5,313289,310035,488 -"381",3075.6,314077,310980,522 -"382",3078.5,314816,311769,570 -"383",3081.6,315590,312666,561 -"384",3084.6,316319,313510,589 -"385",3087.8,317098,314366,624 -"386",3090.5,317773,315139,620 -"387",3093.5,318507,315937,621 -"388",3096.4,319224,316674,639 -"389",3099.5,319976,317442,627 -"390",3102.5,320731,318261,637 -"391",3105.5,321446,318978,639 -"392",3109.5,322330,319871,636 -"393",3111.5,322753,320388,604 -"394",3114.8,323439,321383,604 -"395",3117.5,324019,322109,647 -"396",3119.7,324496,322618,665 -"397",3120.6,324718,322833,731 -"398",3123.5,325403,323488,773 -"399",3126.5,326197,324186,575 -"400",3129.9,327237,324991,581 -"401",3132.4,328055,325525,588 -"402",3135.5,329132,326236,558 -"403",3138.5,330287,327121,537 -"404",3141.5,331496,328084,517 -"405",3145,333066,329234,471 -"406",3147.5,334351,330204,451 -"407",3153.5,337299,332289,458 -"408",3156.5,338745,333600,371 -"409",3159.5,340342,335404,383 -"410",3162.8,341844,336967,342 -"411",3165.5,343109,338273,369 -"412",3169,344841,340163,422 -"413",3171.5,346049,341572,397 -"414",3174.5,347584,342993,442 -"415",3177.8,349293,344729,406 -"416",3180.5,350757,346095,384 -"417",3183.4,352372,347604,398 -"418",3186.5,354121,349160,391 -"419",3189.5,355789,350759,386 -"420",3192.5,357445,352406,392 -"421",3195.7,359181,354326,384 -"422",3199,360896,356202,399 -"423",3200,361445,356838,399 -"424",3201.4,362204,357728,396 -"425",3204.7,363957,359682,454 -"426",3207.5,365473,361167,422 -"427",3210.6,367094,362814,386 -"428",3213.7,368664,364471,397 -"429",3216.5,370069,366191,432 -"430",3219.5,371827,368105,463 -"431",3222.5,373615,369552,517 -"432",3225.5,375314,370919,405 -"433",3228.9,377171,373007,432 -"434",3231.5,378475,374567,482 -"435",3237.5,381820,378183,521 -"436",3240.5,383388,379625,445 -"437",3243.5,384986,381612,516 -"438",3246.5,386818,383527,542 -"439",3249.5,388758,384910,578 -"440",3252.5,390609,386543,567 -"441",3255.5,392628,388652,544 -"442",3258.5,394611,390567,439 -"443",3261.5,396400,392427,448 -"444",3264.5,398086,394620,478 -"445",3267.5,399720,396698,550 -"446",3270.6,401444,398575,574 -"447",3273.8,403146,400362,566 -"448",3276.5,404597,401860,598 -"449",3280.5,406690,404164,600 -"450",3283.5,408217,405823,672 -"451",3286.5,409724,407442,634 -"452",3289.5,411177,408995,644 -"453",3292.8,412968,410793,623 -"454",3295.5,414399,412182,626 -"455",3299,416327,414080,653 -"456",3301.4,417656,415452,678 -"457",3304.4,419336,417173,695 -"458",NA,NA,NA,NA +149.2,5683,2347,668 +173.1,6828,3634,636 +177.4,7043,3833,595 +228.7,9528,6225,588 +236.4,9901,6614,574 +266,11334,8113,616 +303.8,13526,10189,667 +321.2,14538,11013,621 +325,14775,11143,511 +331.7,15215,11329,477 +342.1,15922,11719,501 +356,16974,12626,662 +365.6,17755,13412,610 +366.2,17803,13457,642 +381.7,19089,14241,445 +426.3,22829,16417,395 +443.5,24315,17695,363 +458.3,25557,18950,349 +471,26595,20004,379 +491.3,28356,21636,348 +506.4,29630,22977,406 +507.4,29716,23059,339 +510.2,29967,23392,371 +513.6,30250,23714,377 +517.6,30591,24146,403 +519.7,30761,24327,403 +522.5,30998,24643,340 +522.6,31011,24654,360 +522.7,31020,24662,381 +525.6,31266,24875,358 +528.2,31487,25073,392 +532.2,31828,25423,377 +532.4,31845,25440,381 +532.4,31845,25440,379 +535,32058,25684,360 +540,32465,25999,363 +541.5,32583,26099,382 +541.5,32583,26099,386 +545.2,32887,26336,387 +547,33042,26471,412 +549.4,33240,26672,426 +552,33461,26884,418 +554.2,33646,27064,448 +556.5,33833,27342,464 +560.2,34136,27702,435 +562.5,34318,27951,416 +563.1,34371,28016,403 +565.2,34530,28195,382 +569.2,34832,28551,396 +571.4,34985,28743,425 +574.3,35210,28943,435 +577.8,35464,29130,436 +581.8,35766,29410,421 +582.8,35839,29493,416 +583.3,35876,29542,429 +589.2,36346,30175,481 +591.7,36558,30385,489 +593.8,36729,30591,482 +599.1,37157,31088,394 +602.6,37444,31479,429 +609.7,38013,32176,469 +612,38203,32384,505 +615.5,38491,32715,548 +617.7,38678,32952,532 +619.5,38826,33161,520 +622.2,39039,33474,530 +625.1,39268,33823,509 +627.6,39464,34108,500 +627.6,39464,34108,483 +629.2,39593,34285,484 +633.4,39917,34644,418 +635.1,40060,34784,403 +639.5,40424,35038,459 +641.3,40573,35163,414 +644.6,40841,35387,375 +648,41112,35573,423 +649.2,41209,35645,443 +653.8,41551,35883,431 +664.1,42305,36641,484 +682,43702,38109,520 +683,43785,38201,493 +694.6,44764,39388,424 +699.5,45181,39828,448 +706.1,45770,40626,537 +712.9,46360,41358,522 +724.8,47360,42131,441 +748.3,49296,43546,419 +765.3,50634,44788,402 +788.2,52446,47024,466 +812,54457,49398,504 +834.8,56300,51174,480 +860.6,58258,52870,514 +885.3,60288,55564,528 +911.4,62633,57737,442 +937.3,65016,59604,411 +962.4,67405,61582,414 +986.3,69627,63694,415 +1011.3,71767,65701,434 +1037.5,74017,68495,424 +1062.2,76023,71014,458 +1087.2,78042,72849,430 +1112.6,80064,75367,462 +1137.7,81921,76875,402 +1162.1,83615,78995,438 +1186.5,85262,81122,497 +1209.7,86826,82843,545 +1237.2,88808,84929,594 +1261.2,90609,86323,529 +1289.2,92632,88051,425 +1309.2,94039,89363,417 +1338.2,96047,91691,454 +1363.7,97841,93660,443 +1387.2,99498,95349,406 +1413,101234,96900,407 +1442.8,103125,99067,476 +1451.4,103726,99833,480 +1463.3,104574,100842,521 +1476.1,105492,101829,493 +1505,107599,103372,559 +1526.2,109395,105204,591 +1532,109872,105675,564 +1542.1,110674,106203,437 +1557.4,111923,107007,451 +1582.8,113952,108994,468 +1614.8,116215,111442,448 +1627.7,117059,112559,443 +1630.3,117221,112793,463 +1637.7,117677,113479,505 +1638.8,117747,113574,483 +1643.4,118037,114031,497 +1649,118376,114508,511 +1654.5,118705,115060,485 +1658.6,118958,115401,503 +1664.5,119314,115768,520 +1667.6,119504,116037,550 +1669.5,119620,116200,531 +1671.3,119728,116353,548 +1674.2,119907,116605,575 +1680,120259,117052,541 +1684.5,120528,117342,555 +1686.2,120623,117446,572 +1688.4,120749,117589,590 +1694,121079,117964,560 +1694.6,121116,118010,573 +1697.7,121296,118205,575 +1704.7,121710,118631,563 +1708.8,121941,118853,559 +1714.2,122245,119164,589 +1716,122345,119273,573 +1719.4,122538,119499,584 +1722.6,122718,119704,591 +1731.2,123222,120320,603 +1735.2,123443,120571,601 +1736.8,123535,120652,578 +1739,123658,120765,606 +1744.3,123953,121090,592 +1751.5,124348,121561,598 +1754.3,124505,121752,594 +1759.4,124787,122020,618 +1765.5,125136,122367,592 +1768.5,125298,122528,594 +1770,125380,122606,600 +1775.7,125692,122968,598 +1780,125933,123279,604 +1783.1,126109,123445,601 +1786.8,126316,123677,622 +1789.2,126447,123815,602 +1789.4,126458,123826,630 +1794.2,126710,124077,618 +1797.8,126893,124244,619 +1804.5,127236,124597,610 +1814.8,127750,125176,649 +1818.4,127930,125354,645 +1819.6,127992,125424,623 +1820.4,128032,125468,677 +1824.6,128239,125679,672 +1831,128549,126093,633 +1832.3,128614,126200,644 +1834.2,128712,126343,644 +1834.7,128738,126380,636 +1838.5,128932,126652,632 +1844.8,129266,127008,638 +1848.4,129450,127214,655 +1852.3,129669,127440,666 +1853.9,129752,127526,683 +1857.4,129937,127716,653 +1860.6,130111,127890,687 +1863.8,130286,128080,708 +1869.4,130605,128364,710 +1870.2,130653,128399,699 +1874.4,130904,128576,700 +1875.5,130973,128632,704 +1878.8,131178,128812,676 +1883.3,131459,129062,552 +1884.2,131519,129125,565 +1888.6,131813,129348,540 +1893.4,132149,129675,560 +1897.9,132470,129898,524 +1903.6,132880,130172,542 +1910.9,133444,130549,492 +1921.5,134310,131146,477 +1922.3,134383,131195,491 +1932.1,135318,131795,453 +1954.6,137611,133340,431 +1969.9,139296,134211,399 +1980.2,140452,135003,352 +1987.4,141257,135683,357 +1994.7,142075,136367,374 +1998,142440,136659,377 +2005.9,143326,137393,348 +2009.4,143720,137686,339 +2016.4,144496,138408,318 +2030.9,146122,140072,319 +2042.5,147403,141422,345 +2063.7,149756,143980,355 +2088.6,152467,146784,356 +2102.4,154026,148566,400 +2109,154786,149406,418 +2116,155625,150303,410 +2119,155987,150633,376 +2127.2,156981,151441,395 +2137.1,158157,152562,445 +2143,158819,153173,414 +2153.4,159908,154129,382 +2164,161077,155299,377 +2167.2,161450,155706,406 +2177.3,162574,157299,403 +2180.4,162912,157806,381 +2196.4,164820,159791,376 +2225,168391,162996,405 +2247,170922,165278,420 +2273,174105,169266,478 +2302,177644,172596,456 +2312.3,179000,174189,402 +2325,180546,175440,468 +2348,183525,178550,503 +2363,185640,180779,522 +2373,187067,181718,464 +2386,188892,183355,470 +2399,190587,185063,510 +2414,192382,187199,445 +2425,193816,189335,440 +2437,195298,191057,414 +2475,199904,195625,460 +2501,202717,199292,558 +2525,205458,202212,612 +2543,207803,204283,482 +2552,208947,205148,425 +2554.9,209310,205439,421 +2557.7,209648,205715,413 +2560.9,210056,206122,436 +2564.9,210526,206675,466 +2567.5,210840,207033,463 +2570.4,211178,207418,455 +2574.2,211628,207991,496 +2575.5,211784,208183,475 +2579.9,212295,208796,476 +2581.9,212531,209078,485 +2584.7,212846,209414,515 +2588.5,213282,209975,473 +2590.4,213503,210237,498 +2595.1,214036,210830,567 +2596.7,214219,211005,503 +2600.4,214642,211481,509 +2603.7,215011,211929,586 +2606.6,215343,212281,551 +2609.7,215685,212662,554 +2612.5,216019,213010,545 +2615.5,216377,213385,569 +2621.7,217099,214153,581 +2629,217944,214996,558 +2633.5,218492,215504,568 +2636.7,218908,215879,586 +2639.5,219276,216310,544 +2643.7,219835,216923,557 +2646.4,220230,217253,541 +2649.4,220678,217577,483 +2656.2,221718,218342,440 +2659.5,222273,218767,436 +2666.7,223548,219680,476 +2669.4,224060,220047,473 +2674.6,224993,220760,498 +2676.9,225380,220997,480 +2682.6,226339,221612,482 +2691,227885,222958,494 +2693.6,228349,223446,532 +2698,229167,224630,532 +2700.5,229641,225136,512 +2702.9,230076,225535,506 +2705.6,230547,225888,497 +2707.9,230945,226213,483 +2711.8,231619,226726,484 +2714.7,232092,227224,476 +2717.7,232571,227840,445 +2732.5,234771,230668,439 +2735.7,235233,231383,460 +2738.7,235652,231990,495 +2741.9,236109,232615,502 +2744.8,236498,233139,514 +2747.6,236866,233646,541 +2751.1,237301,234126,540 +2753.6,237602,234470,550 +2756.2,237889,234781,540 +2759.2,238213,235222,554 +2765.2,238907,236234,582 +2771.2,239672,237466,619 +2773.5,240010,237834,631 +2776.5,240465,238199,650 +2780,241055,238623,500 +2782.8,241549,238943,554 +2785.5,242091,239249,538 +2788.5,242675,239545,522 +2794.6,243821,240205,498 +2797.5,244444,240576,484 +2800.5,245091,240966,470 +2806.5,246378,242067,509 +2815.6,248369,243657,402 +2818.5,249027,244198,437 +2821.5,249668,244861,401 +2824.5,250307,245481,380 +2830.4,251542,246709,405 +2833.8,252268,247436,399 +2836.5,252876,248083,424 +2839.5,253557,248977,447 +2842.4,254218,249751,465 +2845.5,254871,250460,467 +2851.5,256180,251519,421 +2854.4,256860,252183,410 +2857.5,257602,252957,511 +2860.5,258358,253889,486 +2866.5,259879,255230,398 +2870.4,260916,256038,408 +2872.7,261510,256489,385 +2876.2,262453,257245,402 +2881.5,263865,258495,457 +2884.5,264663,259226,445 +2887.5,265454,259956,426 +2890.5,266260,260759,448 +2893.5,267040,261596,454 +2896.4,267804,262388,448 +2899.5,268556,263204,441 +2902.5,269304,264042,442 +2905.5,270050,264831,443 +2911.4,271448,266485,417 +2914.5,272177,267443,453 +2917.5,272836,268273,429 +2919.4,273254,268677,441 +2926.5,274800,270677,484 +2935.5,276729,273010,472 +2941.5,278016,274443,508 +2944.5,278704,275209,516 +2951.2,280356,276867,522 +2956.5,281738,277924,430 +2964.5,283807,279541,430 +2973.9,286496,282325,507 +2979.5,288010,283491,464 +2988.6,290551,286214,482 +2994.5,292129,287852,522 +2997.5,292853,288492,454 +3000.4,293619,289444,433 +3003.5,294493,290568,438 +3009.5,296156,292472,475 +3015.6,297835,293700,429 +3018.5,298620,294611,468 +3021.5,299407,295514,464 +3027.7,300970,297181,460 +3030.4,301671,298058,487 +3033.5,302450,299016,486 +3036.5,303199,299875,511 +3039.5,303931,300639,545 +3042.5,304738,301489,539 +3045.5,305609,302452,603 +3048.5,306552,303328,568 +3051.5,307461,303951,588 +3054.5,308352,304584,435 +3057.7,309277,305303,443 +3060.5,310076,306088,457 +3063.5,310900,307124,478 +3066.5,311701,308097,478 +3072.5,313289,310035,488 +3075.6,314077,310980,522 +3078.5,314816,311769,570 +3081.6,315590,312666,561 +3084.6,316319,313510,589 +3087.8,317098,314366,624 +3090.5,317773,315139,620 +3093.5,318507,315937,621 +3096.4,319224,316674,639 +3099.5,319976,317442,627 +3102.5,320731,318261,637 +3105.5,321446,318978,639 +3109.5,322330,319871,636 +3111.5,322753,320388,604 +3114.8,323439,321383,604 +3117.5,324019,322109,647 +3119.7,324496,322618,665 +3120.6,324718,322833,731 +3123.5,325403,323488,773 +3126.5,326197,324186,575 +3129.9,327237,324991,581 +3132.4,328055,325525,588 +3135.5,329132,326236,558 +3138.5,330287,327121,537 +3141.5,331496,328084,517 +3145,333066,329234,471 +3147.5,334351,330204,451 +3153.5,337299,332289,458 +3156.5,338745,333600,371 +3159.5,340342,335404,383 +3162.8,341844,336967,342 +3165.5,343109,338273,369 +3169,344841,340163,422 +3171.5,346049,341572,397 +3174.5,347584,342993,442 +3177.8,349293,344729,406 +3180.5,350757,346095,384 +3183.4,352372,347604,398 +3186.5,354121,349160,391 +3189.5,355789,350759,386 +3192.5,357445,352406,392 +3195.7,359181,354326,384 +3199,360896,356202,399 +3200,361445,356838,399 +3201.4,362204,357728,396 +3204.7,363957,359682,454 +3207.5,365473,361167,422 +3210.6,367094,362814,386 +3213.7,368664,364471,397 +3216.5,370069,366191,432 +3219.5,371827,368105,463 +3222.5,373615,369552,517 +3225.5,375314,370919,405 +3228.9,377171,373007,432 +3231.5,378475,374567,482 +3237.5,381820,378183,521 +3240.5,383388,379625,445 +3243.5,384986,381612,516 +3246.5,386818,383527,542 +3249.5,388758,384910,578 +3252.5,390609,386543,567 +3255.5,392628,388652,544 +3258.5,394611,390567,439 +3261.5,396400,392427,448 +3264.5,398086,394620,478 +3267.5,399720,396698,550 +3270.6,401444,398575,574 +3273.8,403146,400362,566 +3276.5,404597,401860,598 +3280.5,406690,404164,600 +3283.5,408217,405823,672 +3286.5,409724,407442,634 +3289.5,411177,408995,644 +3292.8,412968,410793,623 +3295.5,414399,412182,626 +3299,416327,414080,653 +3301.4,417656,415452,678 +3304.4,419336,417173,695 +0,0,0,0 Modified: trunk/octave-forge/extra/lssa/data/co2.csv =================================================================== --- trunk/octave-forge/extra/lssa/data/co2.csv 2012-08-15 14:40:58 UTC (rev 10879) +++ trunk/octave-forge/extra/lssa/data/co2.csv 2012-08-16 16:29:54 UTC (rev 10880) @@ -1,284 +1,283 @@ -"","Depth..corrected.","Ice.age..GT4.","Gas.age","CO2..ppmv." -"1",149.1,5679,2342,284.7 -"2",173.1,6828,3634,272.8 -"3",177.4,7043,3833,268.1 -"4",228.6,9523,6220,262.2 -"5",250.3,10579,7327,254.6 -"6",266,11334,8113,259.6 -"7",302.6,13449,10123,261.6 -"8",321.2,14538,11013,263.7 -"9",331.6,15208,11326,244.8 -"10",342.1,15922,11719,238.3 -"11",365.5,17747,13405,236.2 -"12",375.6,18580,13989,225.3 -"13",443.5,24315,17695,182.2 -"14",470.8,26578,19988,189.2 -"15",506.4,29630,22977,191.6 -"16",544.7,32844,26303,188.5 -"17",554.2,33645,27062,191.7 -"18",602.3,37421,31447,205.4 -"19",625.6,39310,33884,209.1 -"20",700.2,45242,39880,209.1 -"21",765,50610,44766,189.3 -"22",788.2,52446,47024,188.4 -"23",800,53436,48229,210.1 -"24",812.2,54474,49414,215.7 -"25",834.8,56300,51174,190.4 -"26",902.2,61783,57068,221.8 -"27",912,62689,57799,210.4 -"28",986.2,69618,63687,195.4 -"29",1011.3,71767,65701,191.4 -"30",1023.5,72797,66883,195 -"31",1087.2,78042,72849,227.4 -"32",1112.5,80057,75360,229.2 -"33",1162.1,83615,78995,217.1 -"34",1175,84515,80059,221.8 -"35",1209.9,86840,82858,231 -"36",1237.2,88808,84929,241.1 -"37",1251.5,89864,85727,236.4 -"38",1261.2,90609,86323,228.1 -"39",1274.2,91560,87180,214.2 -"40",1289.2,92632,88051,217 -"41",1309.2,94039,89363,208 -"42",1338.2,96047,91691,224.3 -"43",1349,96791,92460,228.4 -"44",1387.2,99498,95349,232.1 -"45",1451.5,103733,99842,225.9 -"46",1463.2,104566,100833,230.9 -"47",1476.1,105492,101829,236.9 -"48",1505,107599,103372,228.2 -"49",1526.3,109404,105213,236.9 -"50",1542.1,110674,106203,230.7 -"51",1575.2,113363,108308,238.2 -"52",1582.8,113952,108994,245.7 -"53",1598,115077,110253,251.3 -"54",1615,116228,111456,256.8 -"55",1627.9,117072,112577,266.3 -"56",1637.6,117671,113472,261.4 -"57",1644,118074,114082,274.6 -"58",1651,118499,114738,273.3 -"59",1669.2,119601,116175,262.5 -"60",1687.2,120680,117519,267.6 -"61",1700.9,121485,118396,273.8 -"62",1716,122345,119273,272 -"63",1726.8,122965,120002,265.2 -"64",1736.8,123535,120652,277.7 -"65",1758.2,124721,121961,272.2 -"66",1770,125380,122606,276.5 -"67",1789.2,126447,123815,268.7 -"68",1790,126491,123858,266.6 -"69",1799,126955,124306,266.3 -"70",1804,127210,124571,279.8 -"71",1810,127510,124876,277.2 -"72",1825.7,128293,125746,273.8 -"73",1830,128501,126023,267.1 -"74",1836,128804,126475,262.5 -"75",1841.6,129097,126809,262.6 -"76",1852.4,129674,127445,275.4 -"77",1869.3,130599,128300,274.1 -"78",1870.2,130653,128399,287.1 -"79",1875.9,130998,128652,286.8 -"80",1882.5,131406,129007,282.7 -"81",1890,131908,129411,264.1 -"82",1895,132264,129755,263.4 -"83",1903.5,132873,130167,259 -"84",1932,135308,131789,240.4 -"85",1954.5,137601,133334,224 -"86",1969.8,139285,134205,208.9 -"87",1980.2,140452,135003,204.6 -"88",1987.4,141257,135683,198.1 -"89",1990.6,141615,135976,201.8 -"90",1994.6,142064,136359,202.5 -"91",1998,142440,136659,195.9 -"92",2005.8,143315,137383,194.4 -"93",2009.5,143732,137694,193.4 -"94",2015,144346,138226,190.2 -"95",2025.7,145527,139445,192.3 -"96",2041.5,147292,141312,196.5 -"97",2050.3,148287,142357,190.4 -"98",2077.5,151234,145435,197 -"99",2116,155625,150303,191.9 -"100",2157,160293,154471,189 -"101",2164,161077,155299,185.5 -"102",2203,165646,160494,204.4 -"103",2225,168391,162996,191.6 -"104",2247,170922,165278,183.8 -"105",2280,174920,169870,197.9 -"106",2302,177644,172596,197.8 -"107",2325,180546,175440,190.3 -"108",2333,181502,176271,190.1 -"109",2348,183525,178550,207.7 -"110",2363,185640,180779,213.2 -"111",2372,186927,181617,217.7 -"112",2386,188892,183355,199.8 -"113",2399,190587,185063,203.5 -"114",2414,192382,187199,210.7 -"115",2425,193816,189335,231.4 -"116",2437,195298,191057,231.5 -"117",2451,197086,192632,218 -"118",2475,199904,195625,220.1 -"119",2499,202496,199025,242.6 -"120",2525,205458,202212,251 -"121",2533,206496,203191,239.1 -"122",2543,207803,204283,247.7 -"123",2552.01,208947,205148,244.4 -"124",2557.71,209648,205715,232.2 -"125",2560.91,210053,206119,228.7 -"126",2574.21,211628,207991,238.2 -"127",2584.71,212846,209414,242.2 -"128",2588.81,213315,210022,244.6 -"129",2595.11,214036,210830,247.3 -"130",2596.71,214219,211005,252 -"131",2606.61,215343,212281,257.4 -"132",2621.71,217099,214153,251.2 -"133",2629.41,217989,215041,241.4 -"134",2634.41,218602,215593,240.3 -"135",2636.71,218908,215879,242.7 -"136",2640.41,219393,216459,247.5 -"137",2644.41,219935,217009,251.7 -"138",2646.61,220255,217271,251.2 -"139",2650.41,220822,217676,245.4 -"140",2656.21,221718,218342,240.5 -"141",2666.71,223548,219680,212.2 -"142",2670.41,224240,220182,216.2 -"143",2674.61,224993,220760,207.2 -"144",2677.41,225469,221054,208.9 -"145",2682.61,226339,221612,205.7 -"146",2691.01,227885,222958,203.4 -"147",2693.61,228349,223446,215.7 -"148",2698.01,229167,224630,236.9 -"149",2701.41,229802,225299,234.5 -"150",2702.71,230039,225509,233.1 -"151",2705.61,230547,225888,224.5 -"152",2711.71,231601,226710,232.4 -"153",2715.41,232206,227384,233.9 -"154",2717.71,232571,227840,241.7 -"155",2732.71,234795,230703,245.2 -"156",2735.71,235232,231382,252.2 -"157",2738.71,235652,231990,241.4 -"158",2741.71,236077,232570,247.4 -"159",2744.61,236467,233102,243.1 -"160",2747.61,236866,233646,239.2 -"161",2751.11,237301,234126,245.7 -"162",2753.61,237602,234470,245.9 -"163",2756.21,237889,234781,247.4 -"164",2759.11,238206,235213,252.9 -"165",2765.21,238908,236236,259.8 -"166",2773.51,240006,237831,279 -"167",2782.71,241535,238935,263.8 -"168",2785.51,242092,239250,252.4 -"169",2788.51,242675,239545,249.9 -"170",2794.51,243813,240201,230.4 -"171",2797.51,244446,240577,219.4 -"172",2806.51,246379,242068,214.7 -"173",2815.61,248364,243653,200.2 -"174",2818.61,249046,244215,213.9 -"175",2821.51,249670,244863,195.4 -"176",2824.51,250309,245483,196.7 -"177",2833.81,252279,247447,199 -"178",2836.51,252879,248087,201.9 -"179",2839.51,253559,248980,204 -"180",2845.51,254873,250461,203.9 -"181",2851.51,256182,251521,209.7 -"182",2857.51,257604,252959,208.9 -"183",2860.51,258351,253880,214.7 -"184",2866.51,259882,255233,228.2 -"185",2870.51,260936,256053,199.9 -"186",2872.71,261526,256501,211.7 -"187",2876.21,262455,257247,188.7 -"188",2881.42,263844,258477,194.2 -"189",2884.51,264666,259228,198.9 -"190",2887.51,265457,259958,184.7 -"191",2890.51,266255,260754,190.4 -"192",2893.51,267039,261595,193.9 -"193",2896.51,267825,262411,194.2 -"194",2899.51,268558,263207,198.4 -"195",2902.51,269307,264046,193.2 -"196",2905.51,270052,264834,202.2 -"197",2911.46,271454,266492,211 -"198",2914.51,272171,267434,215.4 -"199",2919.41,273256,268679,223.7 -"200",2926.51,274802,270680,231.4 -"201",2935.51,276731,273012,226.4 -"202",2941.51,278017,274445,230.4 -"203",2944.51,278711,275218,231 -"204",2956.51,281740,277925,220.4 -"205",2959.51,282539,278602,217.2 -"206",2964.51,283810,279543,207.7 -"207",2973.81,286475,282301,212.7 -"208",2979.51,288013,283492,213.2 -"209",2988.61,290554,286217,224.4 -"210",2994.51,292121,287846,236.2 -"211",3003.51,294495,290571,240.2 -"212",3007.01,295477,291769,240.7 -"213",3009.51,296158,292474,250.2 -"214",3015.51,297810,293676,244.9 -"215",3018.51,298623,294615,225.9 -"216",3022.71,299716,295849,227.9 -"217",3027.51,300928,297131,233.2 -"218",3030.41,301665,298051,237.9 -"219",3033.51,302452,299020,239 -"220",3036.51,303201,299877,241.9 -"221",3039.51,303939,300646,251.7 -"222",3042.51,304745,301496,256.8 -"223",3045.51,305612,302456,257.2 -"224",3048.56,306561,303334,246.9 -"225",3051.51,307464,303953,272.7 -"226",3054.51,308358,304590,251.7 -"227",3057.71,309281,305306,244.7 -"228",3063.51,310905,307131,255.9 -"229",3066.51,311704,308101,249.2 -"230",3072.51,313292,310039,256.3 -"231",3075.41,314032,310930,260.4 -"232",3078.51,314822,311774,260.3 -"233",3084.51,316304,313493,266.3 -"234",3090.51,317775,315143,266.2 -"235",3093.51,318509,315940,270.2 -"236",3096.46,319231,316681,271.9 -"237",3099.51,319978,317445,275.2 -"238",3105.51,321448,318980,265 -"239",3109.01,322216,319754,271.8 -"240",3111.51,322746,320378,272.7 -"241",3114.81,323441,321386,273.2 -"242",3117.51,324021,322111,282.4 -"243",3119.51,324461,322582,289.2 -"244",3120.61,324711,322827,288.4 -"245",3123.51,325400,323485,298.7 -"246",3126.51,326200,324189,278.2 -"247",3129.91,327237,324991,285.8 -"248",3132.41,328058,325527,278.7 -"249",3135.51,329135,326239,270.5 -"250",3138.51,330278,327114,255.7 -"251",3141.51,331513,328097,241.9 -"252",3145.01,333111,329267,239.7 -"253",3147.51,334356,330208,234.2 -"254",3153.51,337304,332293,250.2 -"255",3156.51,338770,333627,200.7 -"256",3159.51,340242,335290,205.2 -"257",3162.81,341849,336972,204.9 -"258",3169.01,344844,340165,220.4 -"259",3174.51,347589,342998,221.2 -"260",3177.81,349298,344735,216.2 -"261",3183.41,352377,347610,209.2 -"262",3189.51,355795,350765,193 -"263",3192.51,357450,352412,186.2 -"264",3200.01,361445,356838,201.2 -"265",3204.71,363962,359688,206.4 -"266",3210.51,367048,362766,201.9 -"267",3216.45,370095,366221,214.7 -"268",3222.51,373629,369563,229.7 -"269",3228.91,377177,373014,227 -"270",3231.51,378469,374561,240 -"271",3237.51,381834,378194,246.9 -"272",3240.51,383395,379633,245.9 -"273",3249.51,388757,384909,264.7 -"274",3252.45,390641,386579,259.3 -"275",3258.51,394634,390589,255.2 -"276",3261.51,396423,392451,250.2 -"277",3264.51,398091,394628,266.3 -"278",3267.51,399733,396713,274.7 -"279",3273.81,403173,400390,278 -"280",3283.51,408236,405844,279.7 -"281",3289.45,411202,409022,283.7 -"282",3292.91,413010,410831,276.3 -"283",3299.01,416332,414085,285.5 +149.1,5679,2342,284.7 +173.1,6828,3634,272.8 +177.4,7043,3833,268.1 +228.6,9523,6220,262.2 +250.3,10579,7327,254.6 +266,11334,8113,259.6 +302.6,13449,10123,261.6 +321.2,14538,11013,263.7 +331.6,15208,11326,244.8 +342.1,15922,11719,238.3 +365.5,17747,13405,236.2 +375.6,18580,13989,225.3 +443.5,24315,17695,182.2 +470.8,26578,19988,189.2 +506.4,29630,22977,191.6 +544.7,32844,26303,188.5 +554.2,33645,27062,191.7 +602.3,37421,31447,205.4 +625.6,39310,33884,209.1 +700.2,45242,39880,209.1 +765,50610,44766,189.3 +788.2,52446,47024,188.4 +800,53436,48229,210.1 +812.2,54474,49414,215.7 +834.8,56300,51174,190.4 +902.2,61783,57068,221.8 +912,62689,57799,210.4 +986.2,69618,63687,195.4 +1011.3,71767,65701,191.4 +1023.5,72797,66883,195 +1087.2,78042,72849,227.4 +1112.5,80057,75360,229.2 +1162.1,83615,78995,217.1 +1175,84515,80059,221.8 +1209.9,86840,82858,231 +1237.2,88808,84929,241.1 +1251.5,89864,85727,236.4 +1261.2,90609,86323,228.1 +1274.2,91560,87180,214.2 +1289.2,92632,88051,217 +1309.2,94039,89363,208 +1338.2,96047,91691,224.3 +1349,96791,92460,228.4 +1387.2,99498,95349,232.1 +1451.5,103733,99842,225.9 +1463.2,104566,100833,230.9 +1476.1,105492,101829,236.9 +1505,107599,103372,228.2 +1526.3,109404,105213,236.9 +1542.1,110674,106203,230.7 +1575.2,113363,108308,238.2 +1582.8,113952,108994,245.7 +1598,115077,110253,251.3 +1615,116228,111456,256.8 +1627.9,117072,112577,266.3 +1637.6,117671,113472,261.4 +1644,118074,114082,274.6 +1651,118499,114738,273.3 +1669.2,119601,116175,262.5 +1687.2,120680,117519,267.6 +1700.9,121485,118396,273.8 +1716,122345,119273,272 +1726.8,122965,120002,265.2 +1736.8,123535,120652,277.7 +1758.2,124721,121961,272.2 +1770,125380,122606,276.5 +1789.2,126447,123815,268.7 +1790,126491,123858,266.6 +1799,126955,124306,266.3 +1804,127210,124571,279.8 +1810,127510,124876,277.2 +1825.7,128293,125746,273.8 +1830,128501,126023,267.1 +1836,128804,126475,262.5 +1841.6,129097,126809,262.6 +1852.4,129674,127445,275.4 +1869.3,130599,128300,274.1 +1870.2,130653,128399,287.1 +1875.9,130998,128652,286.8 +1882.5,131406,129007,282.7 +1890,131908,129411,264.1 +1895,132264,129755,263.4 +1903.5,132873,130167,259 +1932,135308,131789,240.4 +1954.5,137601,133334,224 +1969.8,139285,134205,208.9 +1980.2,140452,135003,204.6 +1987.4,141257,135683,198.1 +1990.6,141615,135976,201.8 +1994.6,142064,136359,202.5 +1998,142440,136659,195.9 +2005.8,143315,137383,194.4 +2009.5,143732,137694,193.4 +2015,144346,138226,190.2 +2025.7,145527,139445,192.3 +2041.5,147292,141312,196.5 +2050.3,148287,142357,190.4 +2077.5,151234,145435,197 +2116,155625,150303,191.9 +2157,160293,154471,189 +2164,161077,155299,185.5 +2203,165646,160494,204.4 +2225,168391,162996,191.6 +2247,170922,165278,183.8 +2280,174920,169870,197.9 +2302,177644,172596,197.8 +2325,180546,175440,190.3 +2333,181502,176271,190.1 +2348,183525,178550,207.7 +2363,185640,180779,213.2 +2372,186927,181617,217.7 +2386,188892,183355,199.8 +2399,190587,185063,203.5 +2414,192382,187199,210.7 +2425,193816,189335,231.4 +2437,195298,191057,231.5 +2451,197086,192632,218 +2475,199904,195625,220.1 +2499,202496,199025,242.6 +2525,205458,202212,251 +2533,206496,203191,239.1 +2543,207803,204283,247.7 +2552.01,208947,205148,244.4 +2557.71,209648,205715,232.2 +2560.91,210053,206119,228.7 +2574.21,211628,207991,238.2 +2584.71,212846,209414,242.2 +2588.81,213315,210022,244.6 +2595.11,214036,210830,247.3 +2596.71,214219,211005,252 +2606.61,215343,212281,257.4 +2621.71,217099,214153,251.2 +2629.41,217989,215041,241.4 +2634.41,218602,215593,240.3 +2636.71,218908,215879,242.7 +2640.41,219393,216459,247.5 +2644.41,219935,217009,251.7 +2646.61,220255,217271,251.2 +2650.41,220822,217676,245.4 +2656.21,221718,218342,240.5 +2666.71,223548,219680,212.2 +2670.41,224240,220182,216.2 +2674.61,224993,220760,207.2 +2677.41,225469,221054,208.9 +2682.61,226339,221612,205.7 +2691.01,227885,222958,203.4 +2693.61,228349,223446,215.7 +2698.01,229167,224630,236.9 +2701.41,229802,225299,234.5 +2702.71,230039,225509,233.1 +2705.61,230547,225888,224.5 +2711.71,231601,226710,232.4 +2715.41,232206,227384,233.9 +2717.71,232571,227840,241.7 +2732.71,234795,230703,245.2 +2735.71,235232,231382,252.2 +2738.71,235652,231990,241.4 +2741.71,236077,232570,247.4 +2744.61,236467,233102,243.1 +2747.61,236866,233646,239.2 +2751.11,237301,234126,245.7 +2753.61,237602,234470,245.9 +2756.21,237889,234781,247.4 +2759.11,238206,235213,252.9 +2765.21,238908,236236,259.8 +2773.51,240006,237831,279 +2782.71,241535,238935,263.8 +2785.51,242092,239250,252.4 +2788.51,242675,239545,249.9 +2794.51,243813,240201,230.4 +2797.51,244446,240577,219.4 +2806.51,246379,242068,214.7 +2815.61,248364,243653,200.2 +2818.61,249046,244215,213.9 +2821.51,249670,244863,195.4 +2824.51,250309,245483,196.7 +2833.81,252279,247447,199 +2836.51,252879,248087,201.9 +2839.51,253559,248980,204 +2845.51,254873,250461,203.9 +2851.51,256182,251521,209.7 +2857.51,257604,252959,208.9 +2860.51,258351,253880,214.7 +2866.51,259882,255233,228.2 +2870.51,260936,256053,199.9 +2872.71,261526,256501,211.7 +2876.21,262455,257247,188.7 +2881.42,263844,258477,194.2 +2884.51,264666,259228,198.9 +2887.51,265457,259958,184.7 +2890.51,266255,260754,190.4 +2893.51,267039,261595,193.9 +2896.51,267825,262411,194.2 +2899.51,268558,263207,198.4 +2902.51,269307,264046,193.2 +2905.51,270052,264834,202.2 +2911.46,271454,266492,211 +2914.51,272171,267434,215.4 +2919.41,273256,268679,223.7 +2926.51,274802,270680,231.4 +2935.51,276731,273012,226.4 +2941.51,278017,274445,230.4 +2944.51,278711,275218,231 +2956.51,281740,277925,220.4 +2959.51,282539,278602,217.2 +2964.51,283810,279543,207.7 +2973.81,286475,282301,212.7 +2979.51,288013,283492,213.2 +2988.61,290554,286217,224.4 +2994.51,292121,287846,236.2 +3003.51,294495,290571,240.2 +3007.01,295477,291769,240.7 +3009.51,296158,292474,250.2 +3015.51,297810,293676,244.9 +3018.51,298623,294615,225.9 +3022.71,299716,295849,227.9 +3027.51,300928,297131,233.2 +3030.41,301665,298051,237.9 +3033.51,302452,299020,239 +3036.51,303201,299877,241.9 +3039.51,303939,300646,251.7 +3042.51,304745,301496,256.8 +3045.51,305612,302456,257.2 +3048.56,306561,303334,246.9 +3051.51,307464,303953,272.7 +3054.51,308358,304590,251.7 +3057.71,309281,305306,244.7 +3063.51,310905,307131,255.9 +3066.51,311704,308101,249.2 +3072.51,313292,310039,256.3 +3075.41,314032,310930,260.4 +3078.51,314822,311774,260.3 +3084.51,316304,313493,266.3 +3090.51,317775,315143,266.2 +3093.51,318509,315940,270.2 +3096.46,319231,316681,271.9 +3099.51,319978,317445,275.2 +3105.51,321448,318980,265 +3109.01,322216,319754,271.8 +3111.51,322746,320378,272.7 +3114.81,323441,321386,273.2 +3117.51,324021,322111,282.4 +3119.51,324461,322582,289.2 +3120.61,324711,322827,288.4 +3123.51,325400,323485,298.7 +3126.51,326200,324189,278.2 +3129.91,327237,324991,285.8 +3132.41,328058,325527,278.7 +3135.51,329135,326239,270.5 +3138.51,330278,327114,255.7 +3141.51,331513,328097,241.9 +3145.01,333111,329267,239.7 +3147.51,334356,330208,234.2 +3153.51,337304,332293,250.2 +3156.51,338770,333627,200.7 +3159.51,340242,335290,205.2 +3162.81,341849,336972,204.9 +3169.01,344844,340165,220.4 +3174.51,347589,342998,221.2 +3177.81,349298,344735,216.2 +3183.41,352377,347610,209.2 +3189.51,355795,350765,193 +3192.51,357450,352412,186.2 +3200.01,361445,356838,201.2 +3204.71,363962,359688,206.4 +3210.51,367048,362766,201.9 +3216.45,370095,366221,214.7 +3222.51,373629,369563,229.7 +3228.91,377177,373014,227 +3231.51,378469,374561,240 +3237.51,381834,378194,246.9 +3240.51,383395,379633,245.9 +3249.51,388757,384909,264.7 +3252.45,390641,386579,259.3 +3258.51,394634,390589,255.2 +3261.51,396423,392451,250.2 +3264.51,398091,394628,266.3 +3267.51,399733,396713,274.7 +3273.81,403173,400390,278 +3283.51,408236,405844,279.7 +3289.45,411202,409022,283.7 +3292.91,413010,410831,276.3 +3299.01,416332,414085,285.5 Modified: trunk/octave-forge/extra/lssa/data/deut.csv =================================================================== --- trunk/octave-forge/extra/lssa/data/deut.csv 2012-08-15 14:40:58 UTC (rev 10879) +++ trunk/octave-forge/extra/lssa/data/deut.csv 2012-08-16 16:29:54 UTC (rev 10880) @@ -1,3312 +1,3311 @@ -"","Depth.corrected","Ice.age..GT4.","deut","deltaTS" -"1",0,0,-438,0 -"2",1,17,-438,0 -"3",2,35,-438,0 -"4",3,53,-438,0 -"5",4,72,-438,0 -"6",5,91,-438,0 -"7",6,110,-438,0 -"8",7,129,-438,0 -"9",8,149,-442.9,-0.81 -"10",9,170,-437.9,0.02 -"11",10,190,-435.8,0.36 -"12",11,211,-443.7,-0.95 -"13",12,234,-449.1,-1.84 -"14",13,258,-444.6,-1.09 -"15",14,281,-442.5,-0.75 -"16",15,304,-439.3,-0.22 -"17",16,327,-440.9,-0.48 -"18",17,351,-442.5,-0.75 -"19",18,375,-436.6,0.23 -"20",19,397,-430,1.33 -"21",20,420,-435.9,0.35 -"22",21,444,-436.9,0.18 -"23",22,469,-438.5,-0.08 -"24",23,495,-444.5,-1.08 -"25",24,523,-446.4,-1.39 -"26",25,552,-447.7,-1.61 -"27",26,581,-443.4,-0.9 -"28",27,609,-441.6,-0.6 -"29",28,637,-438.1,-0.02 -"30",29,665,-439.1,-0.18 -"31",30,695,-445.4,-1.23 -"32",31,726,-447.3,-1.54 -"33",32,757,-443.1,-0.85 -"34",33,788,-438.6,-0.1 -"35",34,817,-439,-0.17 -"36",35,848,-442.7,-0.78 -"37",36,881,-442.7,-0.78 -"38",37,912,-439,-0.17 -"39",38,944,-439.5,-0.25 -"40",39,976,-439.7,-0.28 -"41",40,1009,-442.9,-0.81 -"42",41,1042,-438.3,-0.05 -"43",42,1074,-436.4,0.27 -"44",43,1107,-443,-0.83 -"45",44,1142,-441.9,-0.65 -"46",45,1176,-439.6,-0.27 -"47",46,1211,-441.9,-0.65 -"48",47,1247,-446.9,-1.48 -"49",48,1285,-447.9,-1.64 -"50",49,1321,-440.4,-0.4 -"51",50,1356,-436,0.33 -"52",51,1390,-438.3,-0.05 -"53",52,1426,-438.8,-0.13 -"54",53,1461,-438.2,-0.03 -"55",54,1497,-440.8,-0.46 -"56",55,1535,-444,-1 -"57",56,1573,-443.8,-0.96 -"58",57,1612,-446,-1.33 -"59",58,1652,-447.1,-1.51 -"60",59,1692,-443.3,-0.88 -"61",60,1732,-444.4,-1.06 -"62",61,1772,-445.3,-1.21 -"63",62,1812,-445.5,-1.24 -"64",63,1853,-443.8,-0.96 -"65",64,1893,-441.2,-0.53 -"66",65,1931,-437.1,0.15 -"67",66,1970,-439.7,-0.28 -"68",67,2009,-440.7,-0.45 -"69",68,2049,-440.3,-0.38 -"70",69,2089,-441.2,-0.53 -"71",70,2129,-441.7,-0.61 -"72",71,2171,-443.7,-0.95 -"73",72,2212,-442.4,-0.73 -"74",73,2253,-437.3,0.12 -"75",74,2291,-431,1.16 -"76",75,2331,-443.9,-0.98 -"77",76,2374,-446.7,-1.44 -"78",77,2418,-442.4,-0.73 -"79",78,2460,-441.8,-0.63 -"80",79,2501,-436.2,0.3 -"81",80,2542,-439.6,-0.27 -"82",81,2585,-446.2,-1.36 -"83",82,2628,-439,-0.17 -"84",83,2670,-438.1,-0.02 -"85",84,2713,-445.2,-1.19 -"86",85,2760,-449.9,-1.97 -"87",86,2805,-441.7,-0.61 -"88",87,2847,-434.5,0.58 -"89",88,2889,-440.3,-0.38 -"90",89,2934,-446.1,-1.34 -"91",90,2980,-446.5,-1.41 -"92",91,3026,-442.4,-0.73 -"93",92,3070,-439.5,-0.25 -"94",93,3114,-441.2,-0.53 -"95",94,3158,-438.5,-0.08 -"96",95,3201,-437.1,0.15 -"97",96,3245,-440.6,-0.43 -"98",97,3289,-441.7,-0.61 -"99",98,3334,-439.8,-0.3 -"100",99,3379,-438.8,-0.13 -"101",100,3422,-436.7,0.22 -"102",101,3466,-437,0.17 -"103",102,3511,-443.5,-0.91 -"104",103,3558,-443.4,-0.9 -"105",104,3603,-436.2,0.3 -"106",105,3646,-434.1,0.65 -"107",106,3689,-434.5,0.58 -"108",107,3732,-437.8,0.03 -"109",108,3778,-441.8,-0.63 -"110",109,3824,-440.8,-0.46 -"111",110,3870,-438,0 -"112",111,3915,-439.4,-0.23 -"113",112,3962,-442,-0.66 -"114",113,4009,-442.4,-0.73 -"115",114,4057,-442.5,-0.75 -"116",115,4104,-443.5,-0.91 -"117",116,4153,-444.6,-1.09 -"118",117,4202,-444,-1 -"119",118,4250,-441.2,-0.53 -"120",119,4295,-434.7,0.55 -"121",120,4339,-431.2,1.13 -"122",121,4381,-431.2,1.13 -"123",122,4423,-431.2,1.13 -"124",123,4466,-431.2,1.13 -"125",124,4509,-431.2,1.13 -"126",125,4552,-432.7,0.88 -"127",126,4596,-436.8,0.2 -"128",127,4642,-440,-0.33 -"129",128,4690,-443.3,-0.88 -"130",129,4739,-441.5,-0.58 -"131",130,4786,-436.5,0.25 -"132",131,4831,-438,0 -"133",132,4880,-444.9,-1.14 -"134",133,4929,-442,-0.66 -"135",134,4977,-440.2,-0.36 -"136",135,5025,-442,-0.66 -"137",136,5072,-437.2,0.13 -"138",137,5118,-436.9,0.18 -"139",138,5165,-440.3,-0.38 -"140",139,5212,-439.3,-0.22 -"141",140,5259,-436.3,0.28 -"142",141,5305,-437.4,0.1 -"143",142,5351,-437.5,0.08 -"144",143,5397,-435,0.5 -"145",144,5442,-435,0.5 -"146",145,5488,-436.8,0.2 -"147",146,5534,-437.9,0.02 -"148",147,5581,-437.5,0.08 -"149",148,5627,-437.8,0.03 -"150",149,5674,-438.37,-0.06 -"151",150,5721,-438.93,-0.15 -"152",151,5769,-439.5,-0.25 -"153",152,5816,-439.3,-0.22 -"154",153,5863,-437.1,0.15 -"155",154,5909,-435.3,0.45 -"156",155,5955,-438.8,-0.13 -"157",156,6004,-442.4,-0.73 -"158",157,6052,-439.25,-0.21 -"159",158,6099,-436.1,0.32 -"160",159,6145,-439,-0.17 -"161",160,6193,-440.2,-0.33 -"162",161,6241,-437.6,0.09 -"163",162,6287,-436.4,0.28 -"164",163,6334,-441.3,-0.55 -"165",164,6385,-447.5,-1.59 -"166",165,6436,-444.4,-1.09 -"167",166,6486,-439.6,-0.31 -"168",167,6534,-441.4,-0.62 -"169",168,6583,-441.5,-0.65 -"170",169,6631,-435.3,0.37 -"171",170,6677,-435.2,0.37 -"172",171,6724,-439.5,-0.36 -"173",172,6773,-442.3,-0.84 -"174",173,6823,-444.9,-1.28 -"175",174,6874,-444,-1.14 -"176",175,6924,-440.5,-0.58 -"177",176,6973,-440.5,-0.59 -"178",177,7023,-443.2,-1.05 -"179",178,7074,-444,-1.2 -"180",179,7124,-440.5,-0.63 -"181",180,7172,-436.5,0.02 -"182",181,7220,-436.8,-0.04 -"183",182,7267,-437.1,-0.11 -"184",183,7315,-438.1,-0.29 -"185",184,7364,-441.2,-0.81 -"186",185,7413,-439.7,-0.58 -"187",186,7462,-436,0.02 -"188",187,7509,-436.2,-0.03 -"189",188,7555,-433.1,0.48 -"190",189,7602,-436,-0.02 -"191",190,7649,-435.7,0.02 -"192",191,7697,-436,-0.04 -"193",192,7745,-440,-0.72 -"194",193,7794,-439,-0.57 -"195",194,7844,-440.9,-0.9 -"196",195,7894,-441,-0.93 -"197",196,7944,-439.5,-0.69 -"198",197,7994,-438.5,-0.54 -"199",198,8043,-439,-0.64 -"200",199,8091,-433.3,0.3 -"201",200,8135,-422.6,2.06 -"202",201,8178,-431.35,0.59 -"203",202,8226,-440.1,-0.87 -"204",203,8276,-439.5,-0.78 -"205",204,8325,-438,-0.55 -"206",205,8374,-435.9,-0.21 -"207",206,8422,-436.1,-0.26 -"208",207,8471,-437.6,-0.52 -"209",208,8520,-438.3,-0.65 -"210",209,8569,-438.4,-0.68 -"211",210,8619,-438.6,-0.73 -"212",211,8668,-437.5,-0.56 -"213",212,8716,-432,0.34 -"214",213,8763,-433.2,0.13 -"215",214,8811,-438.8,-0.81 -"216",215,8861,-437,-0.53 -"217",216,8910,-437,-0.54 -"218",217,8960,-439,-0.88 -"219",218,9009,-436.5,-0.48 -"220",219,9058,-436,-0.41 -"221",220,9107,-437.1,-0.6 -"222",221,9156,-436.5,-0.51 -"223",222,9204,-434.1,-0.13 -"224",223,9252,-431.7,0.26 -"225",224,9298,-433,0.03 -"226",225,9346,-435.5,-0.39 -"227",226,9396,-438,-0.82 -"228",227,9445,-437.2,-0.7 -"229",228,9494,-433.9,-0.16 -"230",229,9542,-433.8,-0.16 -"231",230,9589,-430.2,0.43 -"232",231,9635,-429.6,0.51 -"233",232,9682,-435.4,-0.46 -"234",233,9732,-437.4,-0.8 -"235",234,9782,-437.6,-0.85 -"236",235,9831,-436.9,-0.74 -"237",236,9881,-434.5,-0.36 -"238",237,9929,-434.5,-0.37 -"239",238,9978,-436.1,-0.65 -"240",239,10027,-433.8,-0.28 -"241",240,10075,-434.9,-0.47 -"242",241,10124,-435.5,-0.58 -"243",242,10172,-430,0.31 -"244",243,10218,-428.7,0.52 -"245",244,10265,-432.8,-0.18 -"246",245,10315,-439.5,-1.3 -"247",246,10366,-437.4,-0.97 -"248",247,10415,-434.1,-0.43 -"249",248,10465,-436,-0.76 -"250",249,10515,-436,-0.77 -"251",250,10564,-436,-0.79 -"252",251,10614,-436.6,-0.9 -"253",252,10665,-436.9,-0.96 -"254",253,10715,-435.2,-0.7 -"255",254,10764,-432.5,-0.26 -"256",255,10812,-433.5,-0.44 -"257",256,10861,-434.5,-0.62 -"258",257,10910,-431.6,-0.15 -"259",258,10957,-431.3,-0.12 -"260",259,11005,-431.9,-0.23 -"261",260,11053,-430.3,0.02 -"262",261,11100,-429.8,0.09 -"263",262,11146,-425.8,0.74 -"264",263,11191,-425.3,0.81 -"265",264,11237,-431.2,-0.18 -"266",265,11286,-433,-0.48 -"267",266,11334,-431.7,-0.27 -"268",267,11383,-434.5,-0.73 -"269",268,11434,-437.4,-1.22 -"270",269,11485,-437.8,-1.29 -"271",270,11537,-439.5,-1.57 -"272",271,11590,-439.6,-1.59 -"273",272,11642,-439.7,-1.61 -"274",273,11695,-441,-1.83 -"275",274,11749,-443.2,-2.2 -"276",275,11805,-444.2,-2.37 -"277",276,11861,-447.1,-2.85 -"278",277,11918,-445.3,-2.55 -"279",278,11973,-443.1,-2.19 -"280",279,12029,-447,-2.84 -"281",280,12087,-448.5,-3.09 -"282",281,12144,-446.5,-2.77 -"283",282,12202,-447.3,-2.9 -"284",283,12261,-453.2,-3.88 -"285",284,12323,-455,-4.18 -"286",285,12385,-453.6,-3.96 -"287",286,12446,-451.5,-3.61 -"288",287,12507,-452.4,-3.76 -"289",288,12569,-455.3,-4.25 -"290",289,12632,-455.3,-4.25 -"291",290,12694,-453.27,-3.91 -"292",291,12755,-451.23,-3.57 -"293",292,12815,-449.2,-3.24 -"294",293,12874,-450.2,-3.4 -"295",294,12934,-450.8,-3.5 -"296",295,12994,-451.8,-3.67 -"297",296,13055,-452.9,-3.85 -"298",297,13116,-452.3,-3.75 -"299",298,13177,-452.1,-3.72 -"300",299,13237,-450.5,-3.45 -"301",300,13296,-448.8,-3.17 -"302",301,13355,-448.8,-3.17 -"303",302,13414,-451.8,-3.67 -"304",303,13476,-455.5,-4.28 -"305",304,13539,-453.9,-4.02 -"306",305,13600,-451.2,-3.57 -"307",306,13659,-449.4,-3.27 -"308",307,13718,-447.2,-2.91 -"309",308,13774,-442.9,-2.19 -"310",309,13828,-442,-2.04 -"311",310,13883,-443.2,-2.24 -"312",311,13938,-442.1,-2.06 -"313",312,13992,-443.65,-2.32 -"314",313,14048,-445.2,-2.57 -"315",314,14105,-446.75,-2.83 -"316",315,14163,-448.3,-3.08 -"317",316,14221,-449.85,-3.34 -"318",317,14281,-451.4,-3.6 -"319",318,14342,-452.95,-3.85 -"320",319,14404,-454.5,-4.11 -"321",320,14466,-451.7,-3.64 -"322",321,14526,-452.8,-3.82 -"323",322,14589,-456,-4.34 -"324",323,14651,-453.8,-3.98 -"325",324,14713,-453.5,-3.92 -"326",325,14775,-454.8,-4.14 -"327",326,14839,-457.1,-4.52 -"328",327,14904,-458.1,-4.68 -"329",328,14968,-456.7,-4.44 -"330",329,15032,-458,-4.66 -"331",330,15099,-462,-5.32 -"332",331,15167,-462.5,-5.4 -"333",332,15234,-460.1,-5 -"334",333,15300,-459,-4.81 -"335",334,15366,-458.6,-4.74 -"336",335,15432,-461.1,-5.15 -"337",336,15501,-464.5,-5.71 -"338",337,15570,-463.8,-5.6 -"339",338,15639,-462.9,-5.44 -"340",339,15708,-463.7,-5.57 -"341",340,15777,-462,-5.29 -"342",341,15845,-462.4,-5.35 -"343",342,15915,-467.5,-6.19 -"344",343,15987,-466.3,-5.99 -"345",344,16057,-464.9,-5.75 -"346",345,16128,-466.9,-6.08 -"347",346,16201,-468.5,-6.34 -"348",347,16275,-470.9,-6.74 -"349",348,16350,-471.8,-6.88 -"350",349,16426,-471.8,-6.88 -"351",350,16502,-471,-6.74 -"352",351,16577,-471.2,-6.77 -"353",352,16653,-472.4,-6.97 -"354",353,16729,-473.6,-7.16 -"355",354,16808,-475.6,-7.49 -"356",355,16889,-480.7,-8.33 -"357",356,16974,-481.8,-8.51 -"358",357,17058,-479,-8.04 -"359",358,17139,-476.4,-7.6 -"360",359,17219,-476,-7.53 -"361",360,17298,-475.5,-7.45 -"362",361,17379,-479.4,-8.09 -"363",362,17462,-480.5,-8.27 -"364",363,17544,-477,-7.68 -"365",364,17625,-477.6,-7.78 -"366",365,17706,-478,-7.84 -"367",366,17787,-477.9,-7.82 -"368",367,17868,-477.3,-7.72 -"369",368,17949,-477.5,-7.75 -"370",369,18031,-480.15,-8.19 -"371",370,18116,-482.8,-8.63 -"372",371,18201,-480,-8.16 -"373",372,18283,-478.4,-7.89 -"374",373,18365,-477.5,-7.74 -"375",374,18446,-478.9,-7.97 -"376",375,18530,-482.1,-8.5 -"377",376,18615,-481.7,-8.43 -"378",377,18701,-483.5,-8.73 -"379",378,18787,-481.9,-8.46 -"380",379,18870,-476.6,-7.58 -"381",380,18950,-476.9,-7.63 -"382",381,19032,-479.8,-8.11 -"383",382,19116,-480.7,-8.26 -"384",383,19199,-479.35,-8.03 -"385",384,19282,-478,-7.81 -"386",385,19362,-476.4,-7.54 -"387",386,19443,-477.4,-7.7 -"388",387,19525,-480.1,-8.15 -"389",388,19610,-481.9,-8.45 -"390",389,19696,-483.5,-8.71 -"391",390,19782,-482.4,-8.52 -"392",391,19868,-482.9,-8.61 -"393",392,19953,-479.2,-7.99 -"394",393,20035,-477,-7.62 -"395",394,20116,-478.3,-7.84 -"396",395,20197,-476.4,-7.52 -"397",396,20278,-478.2,-7.82 -"398",397,20361,-480,-8.11 -"399",398,20444,-479.8,-8.08 -"400",399,20528,-479.5,-8.03 -"401",400,20611,-479.6,-8.04 -"402",401,20694,-479.1,-7.96 -"403",402,20777,-478.6,-7.87 -"404",403,20859,-479,-7.94 -"405",404,20943,-480.1,-8.12 -"406",405,21026,-480,-8.1 -"407",406,21110,-479,-7.93 -"408",407,21192,-478.9,-7.91 -"409",408,21275,-478.9,-7.91 -"410",409,21358,-479.45,-8 -"411",410,21442,-480,-8.09 -"412",411,21525,-477.8,-7.73 -"413",412,21605,-475.6,-7.36 -"414",413,21686,-477.4,-7.66 -"415",414,21769,-480.9,-8.24 -"416",415,21854,-481.5,-8.33 -"417",416,21939,-480.2,-8.12 -"418",417,22023,-480.4,-8.15 -"419",418,22108,-482,-8.41 -"420",419,22196,-484.5,-8.82 -"421",420,22284,-484.5,-8.82 -"422",421,22371,-482.3,-8.45 -"423",422,22457,-481.4,-8.3 -"424",423,22543,-481.85,-8.37 -"425",424,22629,-482.3,-8.45 -"426",425,22716,-482.75,-8.52 -"427",426,22803,-483.2,-8.59 -"428",427,22888,-479.5,-7.97 -"429",428,22972,-479.2,-7.92 -"430",429,23057,-482.7,-8.5 -"431",430,23145,-484.5,-8.8 -"432",431,23234,-485.1,-8.89 -"433",432,23324,-485.8,-9.01 -"434",433,23412,-483,-8.54 -"435",434,23497,-478.3,-7.76 -"436",435,23581,-480.95,-8.2 -"437",436,23668,-483.6,-8.63 -"438",437,23755,-483.6,-8.63 -"439",438,23843,-483.6,-8.63 -"440",439,23931,-482.5,-8.44 -"441",440,24017,-481.4,-8.26 -"442",441,24102,-480,-8.03 -"443",442,24186,-479.1,-7.87 -"444",443,24272,-484,-8.68 -"445",444,24363,-488.3,-9.39 -"446",445,24453,-482.7,-8.46 -"447",446,24537,-477.1,-7.53 -"448",447,24619,-477,-7.51 -"449",448,24700,-477,-7.5 -"450",449,24781,-475.5,-7.25 -"451",450,24860,-474,-7 -"452",451,24941,-477.45,-7.57 -"453",452,25024,-480.9,-8.14 -"454",453,25109,-480,-7.98 -"455",454,25193,-479.1,-7.83 -"456",455,25277,-478.2,-7.68 -"457",456,25360,-479.5,-7.89 -"458",457,25445,-481.8,-8.27 -"459",458,25531,-481,-8.13 -"460",459,25615,-478.4,-7.7 -"461",460,25697,-474.5,-7.05 -"462",461,25776,-474.1,-6.98 -"463",462,25855,-475.8,-7.26 -"464",463,25936,-476,-7.29 -"465",464,26017,-477.1,-7.47 -"466",465,26099,-477.2,-7.48 -"467",466,26180,-475.3,-7.16 -"468",467,26261,-475.8,-7.24 -"469",468,26342,-477.7,-7.55 -"470",469,26425,-479.3,-7.82 -"471",470,26510,-480.7,-8.05 -"472",471,26595,-481,-8.09 -"473",472,26681,-481,-8.09 -"474",473,26766,-478.9,-7.74 -"475",474,26849,-477.8,-7.56 -"476",475,26933,-479.9,-7.9 -"477",476,27019,-484.4,-8.64 -"478",477,27110,-486.7,-9.02 -"479",478,27202,-486.7,-9.02 -"480",479,27293,-485.5,-8.82 -"481",480,27382,-484.3,-8.62 -"482",481,27470,-481.4,-8.14 -"483",482,27555,-479.6,-7.84 -"484",483,27641,-482.3,-8.28 -"485",484,27730,-484.6,-8.66 -"486",485,27819,-483.8,-8.52 -"487",486,27907,-482.3,-8.27 -"488",487,27993,-481.2,-8.09 -"489",488,28079,-480.1,-7.9 -"490",489,28163,-478.85,-7.69 -"491",490,28247,-477.6,-7.49 -"492",491,28331,-481.7,-8.16 -"493",492,28420,-485.7,-8.82 -"494",493,28510,-483.58,-8.47 -"495",494,28597,-481.47,-8.12 -"496",495,28683,-479.35,-7.77 -"497",496,28766,-477.23,-7.42 -"498",497,28848,-475.12,-7.07 -"499",498,28927,-473,-6.71 -"500",499,29006,-473,-6.71 -"501",500,29085,-474.62,-6.98 -"502",501,29166,-476.24,-7.25 -"503",502,29249,-477.86,-7.52 -"504",503,29332,-479.48,-7.79 -"505",504,29418,-481.1,-8.05 -"506",505,29505,-482.9,-8.35 -"507",506,29594,-483,-8.37 -"508",507,29682,-482.8,-8.33 -"509",508,29771,-484.3,-8.58 -"510",509,29861,-483.4,-8.43 -"511",510,29949,-482.6,-8.3 -"512",511,30036,-480.5,-7.95 -"513",512,30120,-475.6,-7.14 -"514",513,30201,-474.9,-7.02 -"515",514,30283,-478.5,-7.62 -"516",515,30368,-479.8,-7.83 -"517",516,30453,-479.3,-7.75 -"518",517,30538,-478.63,-7.64 -"519",518,30622,-477.95,-7.52 -"520",519,30705,-477.27,-7.41 -"521",520,30788,-476.6,-7.3 -"522",521,30871,-478.6,-7.63 -"523",522,30957,-480.5,-7.95 -"524",523,31043,-480.8,-8 -"525",524,31130,-481.1,-8.05 -"526",525,31216,-479.9,-7.85 -"527",526,31302,-478.7,-7.65 -"528",527,31387,-479.4,-7.77 -"529",528,31473,-481,-8.03 -"530",529,31560,-482,-8.2 -"531",530,31648,-480.4,-7.93 -"532",531,31733,-477.2,-7.4 -"533",532,31815,-475.6,-7.14 -"534",533,31896,-473.4,-6.77 -"535",534,31976,-473.2,-6.74 -"536",535,32056,-473.5,-6.79 -"537",536,32137,-475.3,-... [truncated message content] |
From: <be...@us...> - 2012-08-16 21:00:29
|
Revision: 10881 http://octave.svn.sourceforge.net/octave/?rev=10881&view=rev Author: benjf5 Date: 2012-08-16 21:00:23 +0000 (Thu, 16 Aug 2012) Log Message: ----------- Fixing some errors; minor improvement in accelerated complex transform. Modified Paths: -------------- trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m trunk/octave-forge/extra/lssa/src/fastlscomplex.cc Modified: trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m 2012-08-16 16:29:54 UTC (rev 10880) +++ trunk/octave-forge/extra/lssa/inst/lscorrcoeff.m 2012-08-16 21:00:23 UTC (rev 10881) @@ -88,7 +88,7 @@ ry2 = y2(mask); windowed_element_count = length (rx1); - if (windowed_element_count = 0) + if (windowed_element_count == 0) error("lscorrcoeff: No time-series elements contained in window.\n"); endif Modified: trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m 2012-08-16 16:29:54 UTC (rev 10880) +++ trunk/octave-forge/extra/lssa/inst/lswaveletcoeff.m 2012-08-16 21:00:23 UTC (rev 10881) @@ -36,7 +36,7 @@ function coeff = lswaveletcoeff (x, y, t, o, wgt = @cubicwgt, wgtrad = 1) - if (! (ncoeff >= 4) && (ncoeff <= 6)) + if (! (nargin >= 4) && (nargin <= 6)) print_usage (); endif if (! isvector (x)) Modified: trunk/octave-forge/extra/lssa/src/fastlscomplex.cc =================================================================== --- trunk/octave-forge/extra/lssa/src/fastlscomplex.cc 2012-08-16 16:29:54 UTC (rev 10880) +++ trunk/octave-forge/extra/lssa/src/fastlscomplex.cc 2012-08-16 21:00:23 UTC (rev 10881) @@ -312,7 +312,7 @@ */ double *exp_pse_ptr, *exp_ptr, exp_power_series_elements[12]; { - double t = mu * dtaud, tt; + double t = mu * loop_delta_tau, tt; exp_ptr = exp_power_series_elements; *exp_ptr++ = 1; *exp_ptr++ = t; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |