Each routine works inplace, as this is what the original routines do. fftnd and ifftnd FFT each dimension [fftn and ifftn use the facility in the C code to do nD, which seems slower than the pdl threaded approach used in (i)fftnd].
use PDL::FFT qw/:Func/;
fft($real,$imag); ifft($real,$imag); realfft($real); realifft($real);
fftnd($real,$imag); ifftnd($real,$imag); fftn($real,$imag); ifftn($real,$imag);
$kernel = kernctr($image,$smallk); fftconvolve($image,$kernel);
Signature: ([o,nc]real(n); [o,nc]imag(n))
Complex FFT of the ``real'' and ``imag'' arrays [inplace]
Signature: ([o,nc]real(n); [o,nc]imag(n))
Complex Inverse FFT of the ``real'' and ``imag'' arrays [inplace]
The real part of the transform ends up in the first half of the array and the imaginary part of the transform ends up in the second half of the array.
realfft($real);
realifft($real);
fftnd($real,$imag);
ifftnd($real,$imag);
Signature: (int dims(n); [o,nc]real(m); [o,nc]imag(m))
N-dimensional FFT [inplace].
Signature: (int dims(n); [o,nc]real(m); [o,nc]imag(m))
N-dimensional inverse FFT [inplace].
$kernel = kernctr($image,$smallk); fftconvolve($image,$kernel);
fftconvolve works inplace, and returns an error array in kernel as an accuracy check -- all the values in it should be negligible.
The sizes of the image and the kernel must be the same. kernctr centres a small kernel to emulate the behaviour of the direct convolution routines.
The speed cross-over between using straight convolution (conv2d) and these fft routines is for kernel sizes roughly 7x7.
Signature: ([o,nc]a(m); [o,nc]b(m))
Internal routine doing maths for convolution