Re: Fast Fourier Transform in Multiple Dimensions
by fglock (Vicar) on Oct 08, 2002 at 16:32 UTC

PDL::FFT  These work for arrays of any dimension, although ones with small prime factors are likely to be the quickest.
 [reply] 
Re: Fast Fourier Transform in Multiple Dimensions
by Helter (Chaplain) on Oct 08, 2002 at 15:53 UTC

You may have seen this already, but cpan does have a fft module: math::fft.
From what I saw it only handles a single array, and I don't remember much of the tiny bit I learned about fft in school...but it might be easier to use those as a base and build up to multiple dimensions.....
Or if it's possible to flatten the data, I don't recall.
Just me flailing about :)
 [reply] 

Hello,
Math::FFT is the module that I noticed, but it doesn't support multiple dimensions. I have a tendency to reinvent the wheel, but before I do I just wanted to make sure someone out there hasn't been doing this type of application in perl.
Thanks,
Enigmae
 [reply] 
Re: Fast Fourier Transform in Multiple Dimensions
by zengargoyle (Deacon) on Oct 09, 2002 at 01:46 UTC

take a look at The Perl Data Language. last i looked it did lots of really fancy math stuff over large matrices of many dimensions.
The PDL concept is to give standard perl5 the ability
to COMPACTLY store and SPEEDILY manipulate the large
Ndimensional data sets which are the bread and butter
of scientific computing. e.g. $a=$b+$c can add two
2048x2048 images in only a fraction of a second.
 [reply] 
Re: Fast Fourier Transform in Multiple Dimensions
by diskcrash (Hermit) on Oct 09, 2002 at 04:43 UTC

Hi Enigmae,
Take a look at Bill Pratt's book on image processing ISBN 0 471 018880 on page 232. It describes Two dimensional unitary transforms. (Such as the Fourier transform.) In particular on page 233 he describes the fact that such transforms are separable by dimension (equations 10.15 and 10.16). This process says take the one dimensional transform along columns and leave the data in place. Then run over the rows with one dimensional transforms. You should be able to extend this into further dimensions in order. You are left with the Ndimensional transform in place. So handling Ndimensions as single dimension arrays is not so punishing as you have to work that way anyway.
Here's another ref  Digital Image Processing by Gonzalez and Wintz ISBN 0201025973 page 50 where they describe the separability of using one dimensional FT's as applied to each dimension in succesion.
So you may have to the reinvent part of the wheel, but it is a reasonable extension from the Math::FFT module that exists.
It sounds like a great module to put back into CPAN when you have it nailed.
Its interesting that MATLAB has a foundation in Perl. It installs Perl in order to run.
Best of Luck,
Diskcrash
 [reply] 

Original Matlab had nothing to do with Perl. However Matlab has two nice properties that make it a good match with Perl. Matlab is a scripting language similar to Perl. You generate a text document with all the commands then “run” the file from within the Matlab environment. You could also compile the scripts you generate into an executable.
So the marriage between Matlab and Perl is obvious. Text scripts could be easily manipulated with Perl. Making script generation simpler, and convertion of scripts into executables is easier.
As a side note. If you are doing any major number crunching especially with anything in matrix format you should consider Matlab. It can generate graphical user interfaces, model any type of mechanical system, and as Perl specializes in text manipulation Matlab specializes in matrix manipulation.
 [reply] 

 [reply] 
Re: Fast Fourier Transform in Multiple Dimensions
by Anonymous Monk on Oct 09, 2002 at 03:43 UTC

Use the right tools for the job! While I love Perl, you may want to consider using tools designed for this particular subject. The biggest problem with Matlab is the cost, but there are alternatives  http://www.octave.org/ for one!
On the other hand, if you know the math (I had a great book, but I can't find it now) and you want to take on this challenge go for it. If anything you will learn much more about FFT, then you do now. There are many more applications for FFT then you probably realize.
Just my 2 cents.
 [reply] 