Closed medlin01GA closed 4 years ago
Cool, I did not know of this function. It was not yet in SciPy when I was looking for it some years ago. I think I will completely switch to it after some tests.
Apparently the performance of the Toeplitz library may be better than the scipy implementation. Just in case you want to factor that into your decision.
From: Tom Eulenfeld notifications@github.com Sent: Wednesday, 25 September 2019 5:54 PM To: trichter/rf rf@noreply.github.com Cc: Medlin Andrew Andrew.Medlin@ga.gov.au; Author author@noreply.github.com Subject: Re: [trichter/rf] Consider using scipy if Fortran90 Toeplitz package not available (#16)
Cool, I did not know of this function. It was not yet in SciPy when I was looking for it some years ago. I think I will completely switch to it after some tests.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/trichter/rf/issues/16?email_source=notifications&email_token=AK3ZLR6Q57Z6TOLB5W47LBDQLMKNHA5CNFSM4I2FY6OKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7Q656A#issuecomment-534900472, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AK3ZLR67IAD3HP666X7XJHDQLMKNHANCNFSM4I2FY6OA.
Did you already check that? If the difference is big enough I would indeed just use it as a fall-back.
I ran some tests. The scipy solution is indeed a bit slower...
deconvt with fortran toeplitz 0.21400373301003128
fortran toeplitz 0.1458939230069518
scipy toeplitz 0.2063790750107728
fortran toeplitz large arrays 14.265187995013548
scipy toeplitz large arrays 19.300329937017523
```py import matplotlib.pyplot as plt import timeit setup1 = """ import numpy as np from rf import read_rf from rf.deconvolve import deconvt stream = read_rf()[:3] rsp = stream[1].data src = stream.select(component='Z')[0].data """ setup2 = """ import numpy as np from rf.deconvolve import _toeplitz_real_sym from scipy.linalg import solve_toeplitz STS=np.array([ 2.00000000e+00, 9.44668881e-01, 8.32262931e-01, 7.23680511e-01, 6.30296618e-01, 5.38136055e-01, 4.51284134e-01, 3.81690164e-01, 3.12464118e-01, 2.27815207e-01, 1.39917950e-01, 7.16370440e-02, 2.77204094e-02, 4.53152245e-04, -8.85378190e-03, 7.70541010e-03, 4.04970454e-02, 7.18194288e-02, 1.01732032e-01, 1.45289593e-01, 2.04720572e-01, 2.62125862e-01, 3.06925116e-01, 3.45063357e-01, 3.83526995e-01, 4.18289709e-01, 4.44526847e-01, 4.64205518e-01, 4.79616089e-01, 4.88054883e-01, 4.86668423e-01, 4.79398291e-01, 4.66845724e-01, 4.48132637e-01, 4.22540155e-01, 3.95572059e-01, 3.75903054e-01, 3.61933083e-01, 3.44232759e-01, 3.22908463e-01, 3.03463344e-01, 2.88322294e-01, 2.72955105e-01, 2.58623356e-01, 2.50910802e-01, 2.42247479e-01, 2.28030646e-01, 2.13648103e-01, 2.06687575e-01, 2.04455021e-01, 2.02738936e-01, 2.07403890e-01, 2.21914159e-01, 2.40091110e-01, 2.53521004e-01, 2.62140322e-01, 2.72956207e-01, 2.89481540e-01, 3.09425858e-01, 3.32338589e-01, 3.57849985e-01, 3.80285370e-01, 3.95124919e-01, 4.04493099e-01, 4.16892174e-01, 4.32268243e-01, 4.41559058e-01, 4.39157352e-01, 4.25323047e-01, 4.04475685e-01, 3.78299246e-01, 3.48444197e-01, 3.20055945e-01, 2.98288019e-01, 2.81202826e-01, 2.63577585e-01, 2.41583136e-01, 2.20490935e-01, 2.08635170e-01, 2.09467072e-01, 2.24286628e-01, 2.47270414e-01, 2.71643296e-01, 2.90590194e-01, 3.03980955e-01, 3.19125840e-01, 3.37081944e-01, 3.52177254e-01, 3.61455756e-01, 3.66724211e-01, 3.68069044e-01, 3.60460666e-01, 3.43526387e-01, 3.25883856e-01, 3.10433395e-01, 2.99785731e-01, 2.92661872e-01, 2.87130004e-01, 2.79920495e-01, 2.68034015e-01, 2.55833253e-01, 2.49971587e-01, 2.55011361e-01, 2.66483611e-01, 2.77525099e-01, 2.84250387e-01, 2.87554083e-01, 2.89635254e-01, 2.91136140e-01, 2.95231732e-01, 3.03931302e-01, 3.14705340e-01, 3.22684663e-01, 3.25038222e-01, 3.21986864e-01, 3.12847634e-01, 2.97088336e-01, 2.81631661e-01, 2.75792731e-01, 2.80962830e-01, 2.84949394e-01, 2.80568383e-01, 2.74090953e-01, 2.71066521e-01, 2.70513402e-01, 2.71233630e-01, 2.80584713e-01, 3.01630569e-01, 3.21103612e-01, 3.26632238e-01, 3.23449624e-01, 3.19448926e-01, 3.11715755e-01, 2.95013897e-01, 2.77626043e-01, 2.63774152e-01, 2.42877866e-01, 2.09859247e-01, 1.78382355e-01, 1.63887850e-01, 1.59259037e-01, 1.52749282e-01, 1.46292182e-01, 1.46089909e-01, 1.49140078e-01, 1.50630886e-01, 1.60929075e-01, 1.91213658e-01, 2.35997934e-01, 2.78481976e-01, 3.11879192e-01, 3.41800463e-01, 3.66412134e-01, 3.76509258e-01, 3.71398592e-01, 3.65392035e-01, 3.66066629e-01, 3.64555079e-01, 3.52686800e-01, 3.34931837e-01, 3.15609411e-01, 2.88412633e-01, 2.53296273e-01, 2.21626084e-01, 2.03720112e-01, 1.96198697e-01, 1.89484235e-01, 1.83900164e-01, 1.81613374e-01, 1.82430078e-01, 1.86886700e-01, 1.97135255e-01, 2.14455909e-01, 2.32949175e-01, 2.45786347e-01, 2.54476903e-01, 2.63073678e-01, 2.70277980e-01, 2.74230196e-01, 2.77094193e-01, 2.81199950e-01, 2.82016951e-01, 2.75925281e-01, 2.68727221e-01, 2.67047229e-01, 2.69434580e-01, 2.71139926e-01, 2.71332906e-01, 2.70743531e-01, 2.67375388e-01, 2.61613708e-01, 2.57938876e-01, 2.62797128e-01, 2.76116594e-01, 2.91702798e-01, 3.01680567e-01, 3.01297233e-01, 2.89339113e-01, 2.67626545e-01, 2.41634323e-01, 2.20251534e-01, 2.08682674e-01, 2.00857093e-01, 1.88033490e-01, 1.68871364e-01, 1.46624060e-01, 1.24040581e-01, 1.03195367e-01, 8.93838081e-02, 8.52581348e-02, 8.69580718e-02, 8.90616142e-02, 9.44231215e-02, 1.08635697e-01, 1.33058903e-01, 1.65136946e-01, 2.02170983e-01, 2.42434773e-01, 2.79360683e-01, 3.06267131e-01, 3.20609169e-01, 3.26114167e-01, 3.26911310e-01, 3.25807470e-01, 3.24184437e-01, 3.19788179e-01, 3.07104509e-01, 2.84050608e-01, 2.54114473e-01, 2.24472782e-01, 1.98116432e-01, 1.74406645e-01, 1.56239562e-01, 1.45343551e-01, 1.40306021e-01, 1.38617994e-01, 1.37663744e-01, 1.40009267e-01, 1.47813723e-01, 1.61736285e-01, 1.78410173e-01, 1.92632654e-01, 2.02980466e-01, 2.09745377e-01, 2.15004204e-01, 2.23019073e-01, 2.34504757e-01, 2.44975444e-01, 2.48699027e-01, 2.44303008e-01, 2.34483383e-01, 2.20757148e-01, 2.05567136e-01, 1.93980287e-01, 1.90929830e-01, 1.95457258e-01, 2.01212705e-01, 2.03886099e-01, 2.04781597e-01, 2.04944870e-01, 2.07403171e-01, 2.14558963e-01, 2.25764290e-01, 2.36753987e-01, 2.38990415e-01, 2.30768162e-01, 2.17857921e-01, 2.07284544e-01, 1.99137518e-01, 1.91267894e-01, 1.84363232e-01, 1.78047321e-01, 1.70449903e-01, 1.60636252e-01, 1.52952025e-01, 1.50174838e-01, 1.52490434e-01, 1.58447156e-01, 1.65209286e-01, 1.71016485e-01, 1.75452500e-01, 1.80299552e-01, 1.87135509e-01, 1.97672092e-01, 2.11000629e-01, 2.23925627e-01, 2.32028908e-01, 2.33845094e-01, 2.30526536e-01, 2.23203577e-01, 2.12771094e-01, 2.00677202e-01, 1.88182581e-01, 1.74054764e-01, 1.61109973e-01, 1.51304760e-01, 1.41740637e-01, 1.31021410e-01, 1.21533347e-01, 1.18458765e-01, 1.21610252e-01, 1.25649038e-01, 1.28691354e-01, 1.32045469e-01, 1.39520817e-01, 1.51939607e-01, 1.67107507e-01, 1.81434595e-01, 1.91824522e-01, 1.95637044e-01, 1.93863741e-01, 1.92620782e-01, 1.93972347e-01, 1.93961080e-01, 1.91414512e-01, 1.88905331e-01, 1.86833059e-01, 1.81904624e-01, 1.74029487e-01, 1.66920414e-01, 1.61511929e-01, 1.54781932e-01, 1.47253959e-01, 1.42438570e-01, 1.40189072e-01, 1.39520961e-01, 1.40841783e-01, 1.46409322e-01, 1.56011006e-01, 1.64522457e-01, 1.68442338e-01, 1.68075028e-01, 1.65750658e-01, 1.62898724e-01, 1.59394885e-01, 1.55677296e-01, 1.52622236e-01, 1.51416253e-01, 1.49139215e-01, 1.41540273e-01, 1.28218937e-01, 1.14075116e-01, 1.03843533e-01, 1.00893474e-01, 1.05742981e-01, 1.16373432e-01, 1.30575642e-01, 1.46057038e-01, 1.61526485e-01, 1.76812839e-01, 1.91048371e-01, 2.02286704e-01, 2.11483881e-01, 2.21621443e-01, 2.32382603e-01, 2.37901246e-01, 2.33563827e-01, 2.20679783e-01, 2.04252345e-01, 1.87396629e-01, 1.70347501e-01, 1.52656766e-01, 1.35441076e-01, 1.19778494e-01, 1.04131657e-01, 8.78022485e-02, 7.33404235e-02, 6.49391993e-02, 6.20094982e-02, 6.21565567e-02, 6.44644045e-02, 6.85412021e-02, 7.36060033e-02, 7.87649408e-02, 8.68981879e-02, 1.01521570e-01, 1.19834743e-01, 1.36394089e-01, 1.48416628e-01, 1.58356807e-01, 1.67696613e-01, 1.74732435e-01, 1.79519085e-01, 1.81728722e-01, 1.80754603e-01, 1.78686425e-01, 1.77744679e-01, 1.77619896e-01, 1.76249872e-01, 1.73116259e-01, 1.68296076e-01, 1.60682577e-01, 1.49972566e-01, 1.37128729e-01, 1.24453057e-01, 1.13759136e-01, 1.04272415e-01, 9.55390342e-02, 8.55812780e-02, 7.29080988e-02, 5.80031134e-02, 4.49350453e-02, 3.84851845e-02, 3.84478733e-02, 4.38191326e-02, 5.18097706e-02, 6.00078976e-02, 6.67705167e-02, 7.30569217e-02, 8.18191756e-02, 9.50931313e-02, 1.12691916e-01, 1.31803526e-01, 1.50458781e-01, 1.66540417e-01, 1.77616780e-01, 1.83011302e-01, 1.84413747e-01, 1.83169561e-01, 1.80185183e-01, 1.75496524e-01, 1.69744702e-01, 1.60740658e-01, 1.46437677e-01, 1.28262079e-01, 1.08855287e-01, 8.94982444e-02, 7.25283799e-02, 5.97483781e-02, 5.13652581e-02, 4.65507421e-02, 4.41569088e-02, 4.33344035e-02, 4.50809435e-02, 5.25265561e-02, 6.54242929e-02, 7.99079235e-02, 9.28854321e-02, 1.02645940e-01, 1.10120934e-01, 1.15261125e-01, 1.19204241e-01, 1.22656845e-01, 1.25799568e-01, 1.27126115e-01, 1.23813358e-01, 1.16394883e-01, 1.07439332e-01, 9.83981403e-02, 8.70955700e-02, 7.74367829e-02, 7.42403992e-02, 7.55547680e-02, 7.44760322e-02, 7.00920381e-02, 6.78719402e-02, 6.87540226e-02, 6.97487962e-02, 7.00491173e-02, 7.28009789e-02, 7.82795883e-02, 8.29156704e-02, 8.64914085e-02, 9.00735810e-02, 9.38065326e-02, 9.81755772e-02, 1.04881189e-01, 1.14039885e-01, 1.21918484e-01, 1.23871535e-01, 1.18409218e-01, 1.09010909e-01, 9.97479408e-02, 8.95428529e-02, 7.57967298e-02, 6.08753566e-02, 4.90378390e-02, 4.09810554e-02, 3.51232161e-02, 3.04737573e-02, 2.49680395e-02, 1.73756562e-02, 9.42914727e-03, 2.76263019e-03, -1.23644772e-03, -1.37441574e-03, 1.85964353e-03, 7.32307338e-03, 1.43659052e-02, 2.26738850e-02, 3.20374907e-02, 4.20477664e-02, 5.27751152e-02, 6.38757678e-02, 7.47941028e-02, 8.50997228e-02, 9.41426210e-02, 1.01489763e-01, 1.07095092e-01, 1.10840874e-01, 1.12785381e-01, 1.13126226e-01, 1.11973798e-01, 1.09328059e-01, 1.05198234e-01, 9.94895337e-02, 9.19576864e-02, 8.26121081e-02, 7.17268364e-02, 5.97030888e-02, 4.69225979e-02, 3.41183165e-02, 2.20814702e-02, 1.11183637e-02, 1.69415479e-03, -5.88889835e-03, -1.13404952e-02, -1.45703545e-02, -1.54302094e-02, -1.38368744e-02, -9.77523718e-03, -3.62415357e-03, 4.09179495e-03, 1.30359254e-02, 2.29855692e-02, 3.36051652e-02, 4.44157187e-02, 5.49690732e-02, 6.46234781e-02, 7.29416990e-02, 7.95017195e-02, 8.42030650e-02, 8.68791248e-02, 8.76696025e-02, 8.66959345e-02, 8.41208097e-02, 7.99794966e-02, 7.43360409e-02, 6.72808295e-02, 5.91049780e-02, 4.99317256e-02, 4.03863200e-02, 3.11834181e-02, 2.29851856e-02, 1.62417064e-02, 1.09743449e-02, 7.15001883e-03, 4.69428789e-03, 3.28253218e-03, 2.80573321e-03, 3.18659321e-03, 4.28098795e-03, 5.84231449e-03, 7.78366677e-03, 9.78829754e-03, 1.16444410e-02, 1.36471540e-02, 1.61011685e-02, 1.89449417e-02, 2.20654180e-02, 2.51490243e-02, 2.78414143e-02, 2.97672322e-02, 3.08819271e-02, 3.13607973e-02, 3.14840844e-02, 3.14946324e-02, 3.14636212e-02, 3.11867167e-02, 3.07475070e-02, 2.99391744e-02, 2.85615175e-02, 2.64795794e-02, 2.39029587e-02, 2.08820172e-02, 1.75722136e-02, 1.43352776e-02, 1.12815223e-02, 8.45741633e-03, 6.19801268e-03, 4.53834030e-03, 3.38469449e-03, 2.51537517e-03, 1.87995325e-03, 1.37280477e-03, 7.31293769e-04, -2.51646833e-04, -1.67179300e-03, -2.87617476e-03, -3.39825348e-03, -3.40128364e-03, -3.47486082e-03, -3.21439202e-03, -2.42238005e-03, -1.42295578e-03, -5.37344570e-04, 2.23454869e-04, 7.16699155e-04, 6.93570238e-04, 4.57428985e-04, 2.40897448e-04]) STR=np.array([ 6.52624700e+06, 6.13545500e+06, 5.42683900e+06, 4.67454700e+06, 4.03932900e+06, 3.46156600e+06, 2.82055900e+06, 2.03627900e+06, 1.06724000e+06, -7.88550000e+04, -1.41758100e+06, -2.69178600e+06, -3.76577200e+06, -4.35164200e+06, -4.29641900e+06, -3.82027000e+06, -3.22730300e+06, -2.65538700e+06, -1.90986600e+06, -8.96180000e+05, 2.33910000e+04, 6.83462000e+05, 1.34388000e+06, 2.29626200e+06, 3.50326900e+06, 4.66774300e+06, 5.66857100e+06, 6.45371700e+06, 6.99640100e+06, 7.12312500e+06, 6.74596800e+06, 6.08368800e+06, 5.48092300e+06, 5.01268200e+06, 4.42071900e+06, 3.53820100e+06, 2.57193400e+06, 1.64857300e+06, 8.74896000e+05, 4.75768000e+05, 2.13711000e+05, -2.46807000e+05, -9.87618000e+05, -1.93675800e+06, -2.90985100e+06, -3.62970200e+06, -3.71725700e+06, -3.01092500e+06, -1.99590200e+06, -1.15404300e+06, -5.78838000e+05, -2.51412000e+05, -5.12510000e+04, 1.73231000e+05, 5.89347000e+05, 1.29170700e+06, 1.91368600e+06, 2.03471500e+06, 1.72929600e+06, 1.44651600e+06, 1.24066500e+06, 1.10248000e+06, 1.09127500e+06, 1.44071300e+06, 2.10169900e+06, 2.66997800e+06, 3.10462500e+06, 3.52271300e+06, 4.16310900e+06, 4.84454600e+06, 5.17701100e+06, 4.95157500e+06, 4.47432600e+06, 4.24546400e+06, 4.37974100e+06, 4.52769700e+06, 4.36458400e+06, 3.81730500e+06, 3.01642000e+06, 1.74276300e+06, -9.99500000e+04, -1.96753800e+06, -3.42080700e+06, -4.17318800e+06, -4.29780700e+06, -4.17703600e+06, -4.02283800e+06, -3.74884300e+06, -3.18352200e+06, -2.17579800e+06, -7.36147000e+05, 9.28881000e+05, 2.66866300e+06, 4.51131200e+06, 6.37185300e+06, 7.97372000e+06, 9.17534000e+06, 9.88155500e+06, 1.00770050e+07, 9.68925800e+06, 8.88287700e+06, 7.80910900e+06, 6.24134300e+06, 4.30124800e+06, 2.52909000e+06, 1.36533500e+06, 8.05608000e+05, 4.64383000e+05, 2.58217000e+05, 1.32161000e+05, -1.30086000e+05, -7.46278000e+05, -1.55907300e+06, -2.17392200e+06, -2.01409200e+06, -9.87824000e+05, 6.45786000e+05, 2.41243200e+06, 3.89363600e+06, 4.98504500e+06, 5.52600800e+06, 5.71607500e+06, 5.76657500e+06, 5.80391100e+06, 5.85259300e+06, 5.98772900e+06, 6.21223100e+06, 6.07211900e+06, 5.24625500e+06, 4.33983400e+06, 3.68932200e+06, 2.97410700e+06, 1.78179200e+06, 2.97970000e+05, -1.07567400e+06, -2.34458100e+06, -3.52181900e+06, -4.22138200e+06, -4.13334800e+06, -3.77701200e+06, -3.68847100e+06, -3.78738100e+06, -3.70888100e+06, -3.30623100e+06, -2.75888900e+06, -1.93856000e+06, -5.57966000e+05, 1.08842400e+06, 2.55609000e+06, 4.08654700e+06, 6.02994700e+06, 7.99877200e+06, 9.16309000e+06, 9.64686800e+06, 1.00501360e+07, 1.02931110e+07, 9.89538600e+06, 9.18528000e+06, 8.92473700e+06, 9.06302100e+06, 8.81080800e+06, 7.79187400e+06, 6.37545500e+06, 4.93987300e+06, 3.00234200e+06, 2.58584000e+05, -2.45011800e+06, -4.12092600e+06, -5.20097900e+06, -6.45750100e+06, -7.48761000e+06, -7.56856200e+06, -7.11602800e+06, -7.08328800e+06, -7.03328200e+06, -5.94521900e+06, -3.98829700e+06, -2.25530500e+06, -8.86475000e+05, 1.08769700e+06, 3.89104800e+06, 6.83836200e+06, 9.46742400e+06, 1.19109060e+07, 1.42834260e+07, 1.61391690e+07, 1.72585250e+07, 1.76085260e+07, 1.74565930e+07, 1.68465840e+07, 1.57071710e+07, 1.42149090e+07, 1.22658970e+07, 9.83921800e+06, 7.30005800e+06, 4.81467400e+06, 2.30435000e+06, -2.83261000e+05, -2.80222800e+06, -5.03785100e+06, -6.99345600e+06, -8.61501400e+06, -9.52922900e+06, -9.69406800e+06, -9.48757300e+06, -9.01826100e+06, -7.96180300e+06, -6.05823400e+06, -4.05842100e+06, -2.48251000e+06, -1.07648500e+06, 5.46330000e+05, 2.29533900e+06, 3.85917700e+06, 5.37436300e+06, 7.11649900e+06, 8.77944500e+06, 9.79460100e+06, 1.02831220e+07, 1.04392500e+07, 1.04583760e+07, 1.02862560e+07, 1.02305070e+07, 1.07289950e+07, 1.15634260e+07, 1.19918890e+07, 1.17747330e+07, 1.09579170e+07, 9.74638900e+06, 8.13295000e+06, 6.03985500e+06, 3.77346500e+06, 1.42426200e+06, -8.22885000e+05, -3.02671400e+06, -5.11517800e+06, -6.67782900e+06, -7.95932900e+06, -8.89037000e+06, -9.34707900e+06, -9.27405200e+06, -8.56797700e+06, -7.51659600e+06, -6.19637600e+06, -4.41974600e+06, -2.11175800e+06, 6.49700000e+05, 3.21528400e+06, 5.23511200e+06, 7.17557100e+06, 9.22482600e+06, 1.08861430e+07, 1.13836890e+07, 1.11496630e+07, 1.11760810e+07, 1.15715900e+07, 1.14563930e+07, 1.07851480e+07, 1.01659560e+07, 9.58022300e+06, 8.40847300e+06, 6.46972300e+06, 4.64583500e+06, 3.26996200e+06, 2.03264200e+06, 1.12805600e+06, 9.61390000e+05, 1.15336800e+06, 9.52419000e+05, 6.04052000e+05, 7.21383000e+05, 9.99856000e+05, 9.69736000e+05, 7.73442000e+05, 8.65741000e+05, 1.08793600e+06, 1.04754700e+06, 1.17066200e+06, 1.80074000e+06, 2.67029400e+06, 3.21169400e+06, 3.21972600e+06, 3.20857900e+06, 3.42408500e+06, 3.71272400e+06, 4.16648700e+06, 5.20461500e+06, 6.47954500e+06, 7.20049900e+06, 7.59908200e+06, 8.19515300e+06, 9.06259600e+06, 9.39825900e+06, 9.19614700e+06, 9.56496500e+06, 1.06213950e+07, 1.11603230e+07, 1.03807050e+07, 8.92949700e+06, 7.69744200e+06, 6.34819000e+06, 4.21318400e+06, 1.94377400e+06, 6.59560000e+05, 1.62623000e+05, -1.13942400e+06, -3.40038700e+06, -5.95788000e+06, -8.82861900e+06, -1.17449460e+07, -1.28071900e+07, -9.94835000e+06, -5.62274600e+06, -2.59661800e+06, -5.13961000e+05, 1.86294500e+06, 4.18471600e+06, 4.89114500e+06, 4.31600400e+06, 4.60007500e+06, 6.42267200e+06, 8.16671500e+06, 8.33936300e+06, 7.54194500e+06, 7.20090900e+06, 7.27776400e+06, 7.06074700e+06, 6.55215600e+06, 6.01933000e+06, 5.34804100e+06, 4.16753800e+06, 3.15388700e+06, 2.55279500e+06, 2.38912700e+06, 2.47455300e+06, 3.00112200e+06, 4.10787100e+06, 4.93518200e+06, 4.78304500e+06, 4.04755600e+06, 3.46600200e+06, 3.51554400e+06, 4.10373600e+06, 4.82875600e+06, 5.59769800e+06, 6.41625200e+06, 7.40553200e+06, 8.04206000e+06, 7.93664800e+06, 6.59809700e+06, 4.41385400e+06, 2.78728200e+06, 2.16590500e+06, 2.11618800e+06, 2.28235300e+06, 3.26495900e+06, 4.91810700e+06, 5.49501200e+06, 4.44828400e+06, 2.90092300e+06, 1.39481300e+06, -1.93172000e+05, -1.69023700e+06, -2.30674300e+06, -1.69636600e+06, -8.68633000e+05, -3.85717000e+05, 1.19212000e+05, 9.51443000e+05, 1.69951200e+06, 1.91914900e+06, 1.86986200e+06, 2.11406400e+06, 2.75144800e+06, 3.51884500e+06, 4.57619100e+06, 5.88457300e+06, 7.27960600e+06, 8.44838600e+06, 9.16915700e+06, 9.56386300e+06, 9.75028200e+06, 9.88786000e+06, 9.74760500e+06, 9.20129600e+06, 8.39048900e+06, 7.72710400e+06, 7.02667600e+06, 5.51207200e+06, 3.48932300e+06, 1.61198800e+06, -4.37522000e+05, -3.04774900e+06, -5.45419700e+06, -6.69296100e+06, -6.97240200e+06, -6.75067400e+06, -5.99078700e+06, -4.67323300e+06, -3.51939000e+06, -2.83352700e+06, -1.96853300e+06, -2.12881000e+05, 2.21704600e+06, 4.77206900e+06, 6.99484700e+06, 8.93953600e+06, 1.05204970e+07, 1.13699160e+07, 1.15098490e+07, 1.12853760e+07, 1.07132970e+07, 9.42776000e+06, 7.44893200e+06, 5.31322200e+06, 3.55699000e+06, 2.30260500e+06, 1.62305400e+06, 1.36707900e+06, 1.03118900e+06, 3.43040000e+04, -1.30699100e+06, -2.30679800e+06, -2.60002600e+06, -2.35275200e+06, -1.87421600e+06, -9.42365000e+05, 3.85240000e+05, 1.57301600e+06, 2.08191700e+06, 2.42276900e+06, 3.45698400e+06, 4.65991900e+06, 4.99675800e+06, 4.67651800e+06, 4.35657400e+06, 3.77620700e+06, 2.66212000e+06, 1.79814100e+06, 1.80370400e+06, 1.82946100e+06, 8.56192000e+05, -3.86297000e+05, -5.70178000e+05, 3.09028000e+05, 1.32362400e+06, 2.25105600e+06, 3.44393200e+06, 4.78199700e+06, 5.56095400e+06, 5.95980700e+06, 6.75422200e+06, 8.02464700e+06, 8.96475800e+06, 9.10873000e+06, 9.01212600e+06, 8.85009000e+06, 8.23182300e+06, 7.23905700e+06, 6.37551300e+06, 5.64313300e+06, 4.60745800e+06, 3.14383400e+06, 1.93065200e+06, 1.24436000e+06, 6.78578000e+05, -2.22099000e+05, -1.35732300e+06, -2.08488500e+06, -2.33446800e+06, -2.24088300e+06, -1.65527000e+06, -3.09857000e+05, 1.46650500e+06, 2.77575800e+06, 3.35170000e+06, 3.81561100e+06, 4.03244200e+06, 3.61390600e+06, 2.88660900e+06, 2.53725300e+06, 2.77666200e+06, 3.02960400e+06, 3.05502600e+06, 3.21685400e+06, 3.36096800e+06, 3.00063800e+06, 2.31030100e+06, 1.76804700e+06, 1.27153300e+06, 6.14960000e+05, -3.02720000e+04, -1.88940000e+05, -8.74710000e+04, 1.74040000e+04, 3.25421000e+05, 1.01744600e+06, 1.87677600e+06, 2.37866000e+06, 2.62850200e+06, 3.08988700e+06, 3.83780700e+06, 4.47601600e+06, 4.91725600e+06, 5.44071500e+06, 6.35031800e+06, 7.14541100e+06, 7.54995600e+06, 7.45325400e+06, 7.12785100e+06, 6.57188400e+06, 5.49458500e+06, 4.39499100e+06, 3.77637200e+06, 3.81180500e+06, 3.96458800e+06, 3.73099500e+06, 3.10206100e+06, 2.31800400e+06, 1.54802300e+06, 8.39034000e+05, 6.65246000e+05, 7.70815000e+05, 5.37143000e+05, -1.95961000e+05, -9.24578000e+05, -1.09680900e+06, -1.06305300e+06, -1.04793300e+06, -3.63633000e+05, 1.40349600e+06, 3.66515600e+06, 5.42305500e+06, 6.31316500e+06, 6.91073800e+06, 7.82029600e+06, 9.18062700e+06, 1.05166730e+07, 1.14747700e+07, 1.17401350e+07, 1.10589030e+07, 9.71301200e+06, 8.15377600e+06, 6.57461400e+06, 5.01097200e+06, 3.58505600e+06, 2.48377700e+06, 1.34598200e+06, -5.93693000e+05, -3.26071100e+06, -5.71344700e+06, -6.96860600e+06, -7.10501200e+06, -6.67462100e+06, -6.05309200e+06, -5.35322500e+06, -4.59725800e+06, -3.92123400e+06, -3.02878200e+06, -1.91024800e+06, -6.12528000e+05, 8.46057000e+05, 2.42191500e+06, 4.04393400e+06, 5.22168100e+06, 5.83042400e+06, 6.35811500e+06, 7.24628700e+06, 8.13523900e+06, 8.67742300e+06, 8.94925200e+06, 9.20077500e+06, 9.42044100e+06, 9.30828900e+06, 9.06721600e+06, 8.89027800e+06, 8.48612100e+06, 7.61866600e+06, 6.57281900e+06, 5.71361900e+06, 4.91002700e+06, 3.72670900e+06, 2.32941300e+06, 1.30115200e+06, 5.76924000e+05, -7.89820000e+04, -8.42945000e+05, -1.62210600e+06, -2.31319000e+06, -3.09777100e+06, -3.81371000e+06, -4.13907600e+06, -3.81034700e+06, -3.12055600e+06, -2.68618300e+06, -2.58190100e+06, -2.49753300e+06, -2.18084900e+06, -1.55995200e+06, -3.57651000e+05, 1.50713900e+06]) x = np.linspace(0, 1, 10 * len(STS)) xp = np.linspace(0, 1, len(STS)) STS2 = np.interp(x, xp, STS) STR2 = np.interp(x, xp, STR) """ stm1 = "deconvt(rsp[:], src[:], 10)" stm2 = "_toeplitz_real_sym(STS[:], STR[:])" stm2b = "_toeplitz_real_sym(STS2[:], STR2[:])" stm3 = "solve_toeplitz(STS[:], STR[:])" stm3b = "solve_toeplitz(STS2[:], STR2[:])" print('deconvt with fortran toeplitz', min(timeit.repeat(stm1, setup1, repeat=5, number=100))) print('fortran toeplitz ', min(timeit.repeat(stm2, setup2, repeat=5, number=100))) print('scipy toeplitz ', min(timeit.repeat(stm3, setup2, repeat=5, number=100))) print('fortran toeplitz large arrays', min(timeit.repeat(stm2b, setup2, repeat=1, number=100))) print('scipy toeplitz large arrays ', min(timeit.repeat(stm3b, setup2, repeat=1, number=100))) exec(setup2) x1 = _toeplitz_real_sym(STS, STR) x2 = solve_toeplitz(STS, STR) np.testing.assert_allclose(x1, x2, rtol=0.01) ```
Great, this change made tests on travis-ci possible for windows, since I did not manage to install toeplitz on travis windows runs. Only batch related tests fail for windows, which is not a high priority for me.
On platforms where the
from toeplitz import sto_sl
import fails due to Toeplitz library not being available, consider reverting to usingscipy
sincerf
is already dependent onscipy
. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.solve_toeplitz.html