Additionally, we can probably lose these two lines safely enough...

dir=. dir
flag=. flag

(part of the 'crud' removal that didn't go far enough)


"David Hotham" <[email protected]> wrote in message 
news:[email protected]...
> "Therefore I suspect the problem originated from the window binary"
>
> It would be nice to put the blame elsewhere but, alas, this is not so.
>
> The issue seems to be that the definition of FFTW_ESTIMATE has changed
> between FFTW2 and FFTW3.  What was zero is now (1U << 6).
>
> Here's a revised version of the script that:
> -  incorporates your changes
> -  removes some crud (or, at any rate, it seems to me to be crud; and
> removing it makes no difference on Windows)
> -  fixes FFTW_ESTIMATE
>
> ... and (on w32 and w64) gives sensible results first time.
>
> David
>
>
>
>
> NB. built from project: ~Addons/math/fftw/fftw
> NB. z definitions:
>
> script_z_ '~system\main\dll.ijs'
>
> coclass 'jfftw'
>
>
> fftw_z_=: (_1 & fftwnd_jfftw_) :. (1 & fftwnd_jfftw_)
> ifftw_z_=: (1 & fftwnd_jfftw_) :. (_1 & fftwnd_jfftw_)
>
> NB. fftw utils
> NB.
> NB. cd            15!:0
> NB. clean         clean numbers near 0
> NB. info          cover for wdinfo
> NB. matchclean    if clean x-y is all 0
>
> zzero=: 1j1-1j1
>
> 3 : 0''
> if. IFUNIX do.
>  DLL=: 'libfftw3.so.3'
> else.
>  DLL=: '"',~'"',jpath '~addons\math\fftw\libfftw3-3.dll'
> end.
> )
>
> FFTW_FORWARD=: _1
> FFTW_BACKWARD=: 1
> FFTW_ESTIMATE=: 6 (33 b.) 1
> FFTW_MEASURE=: 0
>
> FFTW_VERSION=: 3.2
>
> cd=: 15!:0
>
> info=: wdinfo @ ('FFTW'&;)
>
> matchclean=: 0: *./ . = clean @ , @: -
>
> NB. =========================================================
> NB.*clean v clean numbers to tolerance (default 1e_10)
> NB. sets values less than tolerance to 0
> clean=: (1e_10&$:) : (4 : 0)
> if. L. y do.
>  x clean each y
> else.
>  if. 16 ~: 3!:0 y do.
>    y * x <: |y
>  else.
>    j./"1 y* x <: | y=. +.y
>  end.
> end.
> )
>
>
> NB. fftw
>
> NB. =========================================================
> NB.*createplan v create a plan
> NB. y = shape ; in ; out ; direction; flag
> NB.
> NB.   direction = FFTW_FORWARD | FFTW_BACKWARD
> NB.   flag = FFTW_ESTIMATE | FFTW_MEASURE
> createplan=: 3 : 0
> 'shape in out dir flag'=. y
> assert dir e. FFTW_FORWARD,FFTW_BACKWARD
> assert flag e. FFTW_ESTIMATE, FFTW_MEASURE
> shape=. ,shape
> dir=. dir
> flag=. flag
> cmd=. DLL,' fftw_plan_dft + x i *i *j *j i i'
> 0 pick cmd cd (#shape);shape;in;out;dir;flag
> )
>
> NB. =========================================================
> NB.*destroyplan v destroy a plan
> destroyplan=: 3 : 0
> cmd=. DLL,' fftw_destroy_plan + n x'
> 1 [ cmd cd y
> )
>
> NB. =========================================================
> NB.*fftwnd d n-dimensional FFT
> NB. x =  _1 forward
> NB.        1 backward
> NB. y =  data
> fftwnd=: 4 : 0
> shp=. $y
> in=. zzero + , |: y
> out=. in * 0
> assert x e. _1 1
> dir=. x
> plan=. createplan shp;in;out;dir;FFTW_ESTIMATE
> fftwexecute plan
> destroyplan plan
> res=. |: (|.shp) $ out
> if. dir=1 do. res % */shp end.
> )
>
> NB. =========================================================
> NB.*fftwexecute d one call to n-dimensional FFT
> NB. y =  plan
> fftwexecute=: 3 : 0
> cmd=. DLL,' fftw_execute + n x'
> 1 [ cmd cd y
> )
>
>
>
>
>
>
>
> "bill lam" <[email protected]> wrote in message
> news:[email protected]...
>>I slightly modify your script, it works with 64-bit linux and the first
>>result
>> for fftw i.8 is not all zero
>>
>>   load jpath '~addons/math/fftw/fftw3.ijs'
>>   fftw i.8
>> 28 _4j9.6568542 _4j4 _4j1.6568542 _4 _4j_1.6568542 _4j_4 _4j_9.6568542
>>   fftw i.8
>> 28 _4j9.6568542 _4j4 _4j1.6568542 _4 _4j_1.6568542 _4j_4 _4j_9.6568542
>>
>> Therefore I suspect the problem originated from the window binary.
>>
>>
>> NB. built from project: ~Addons/math/fftw/fftw
>> NB. z definitions:
>>
>> script_z_ '~system\main\dll.ijs'
>>
>> coclass 'jfftw'
>>
>>
>> fftw_z_=: (_1 & fftwnd_jfftw_) :. (1 & fftwnd_jfftw_)
>> ifftw_z_=: (1 & fftwnd_jfftw_) :. (_1 & fftwnd_jfftw_)
>>
>> NB. fftw utils
>> NB.
>> NB. cd            15!:0
>> NB. clean         clean numbers near 0
>> NB. info          cover for wdinfo
>> NB. matchclean    if clean x-y is all 0
>>
>> izero=: 23-23
>> ione=: 23-22
>> dzero=: 1.1-1.1
>> done=: 2.1-1.1
>> zzero=: 1j1-1j1
>> zone=: 2j1-1j1
>>
>> 3 : 0''
>> if. IFUNIX do.
>>  DLL=: 'libfftw3.so.3'
>> else.
>>  DLL=: '"',~'"',jpath '~addons\math\fftw\libfftw3-3.dll'
>> end.
>> )
>>
>> FFTW_FORWARD=: _1
>> FFTW_BACKWARD=: ione
>> FFTW_ESTIMATE=: izero
>> FFTW_MEASURE=: ione
>>
>> FFTW_VERSION=: 3.2
>>
>> cd=: 15!:0
>>
>> info=: wdinfo @ ('FFTW'&;)
>>
>> matchclean=: 0: *./ . = clean @ , @: -
>>
>> NB. =========================================================
>> NB.*clean v clean numbers to tolerance (default 1e_10)
>> NB. sets values less than tolerance to 0
>> clean=: (1e_10&$:) : (4 : 0)
>> if. L. y do.
>>  x clean each y
>> else.
>>  if. 16 ~: 3!:0 y do.
>>    y * x <: |y
>>  else.
>>    j./"1 y* x <: | y=. +.y
>>  end.
>> end.
>> )
>>
>>
>> NB. fftw
>>
>> NB. =========================================================
>> NB.*createplan v create a plan
>> NB. y = shape ; in ; out ; direction; flag
>> NB.
>> NB.   direction = FFTW_FORWARD | FFTW_BACKWARD
>> NB.   flag = FFTW_ESTIMATE | FFTW_MEASURE
>> createplan=: 3 : 0
>> 'shape in out dir flag'=. y
>> assert dir e. FFTW_FORWARD,FFTW_BACKWARD
>> assert flag e. FFTW_ESTIMATE, FFTW_MEASURE
>> shape=. ,shape + izero
>> dir=. dir + izero
>> flag=. flag + izero
>> cmd=. DLL,' fftw_plan_dft + x i *i *j *j i i'
>> 0 pick cmd cd (#shape);shape;in;out;dir;flag
>> )
>>
>> NB. =========================================================
>> NB.*destroyplan v destroy a plan
>> destroyplan=: 3 : 0
>> cmd=. DLL,' fftw_destroy_plan + n x'
>> 1 [ cmd cd y
>> )
>>
>> NB. =========================================================
>> NB.*fftwnd d n-dimensional FFT
>> NB. x =  _1 forward
>> NB.        1 backward
>> NB. y =  data
>> fftwnd=: 4 : 0
>> shp=. $y
>> in=. zzero + , |: y
>> out=. in * 0
>> assert x e. _1 1
>> dir=. x + izero
>> plan=. createplan shp;in;out;dir;FFTW_ESTIMATE
>> fftwexecute plan
>> destroyplan plan
>> res=. |: (|.shp) $ out
>> if. dir=1 do. res % */shp end.
>> )
>>
>> NB. =========================================================
>> NB.*fftwexecute d one call to n-dimensional FFT
>> NB. y =  plan
>> fftwexecute=: 3 : 0
>> cmd=. DLL,' fftw_execute + n x'
>> 1 [ cmd cd y
>> )
>>
>>
>> -- 
>> regards,
>> ====================================================
>> GPG key 1024D/4434BAB3 2008-08-24
>> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to