Just read a post(
http://mail.python.org/pipermail/python-list/2006-November/414270.html),whichcompare
the speed of matlab and numpy for wavelet
computing.On my machine(P4 2.8G,Debian sid)the results are:matlab --
26.268899 seconds,numpy -- 1.72 seconds.
I translate the code to J as:
D4_Transform=:3 :0
NB. D4 Wavelet transform in Matlab
NB. (C) Sturla Molden
C1 =. 1.7320508075688772
C2 =. 0.4330127018922193
C3 =. -0.066987298107780702
C4 =. 0.51763809020504137
C5 =. 1.9318516525781364
n=.>.-:#y
r =. (#y)$0
oddkey=.2*i.n
odd =.oddkey{y
even =.(<<oddkey){y
d1 =. odd - C2*even
s1 =.even+(C2*.d1)+C3*_1|.d1
d2=.d1+_1|.s1
if.2<#y do.
r=.(D4_Transform odd) oddkey}r
else.
r=.(C4*s1)oddkey}r
end.
r=.(C5*d2)(<<oddkey)}r
r
)
And the timing is:
d=.?(2^23)$0
ts 'D4_Transform d'
150.59277 7.718007e8
How to improve?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm