1FFT(3)                User Contributed Perl Documentation               FFT(3)
2
3
4

NAME

6       PDL::FFT - FFTs for PDL
7

DESCRIPTION

9       !!!!!!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10       As of PDL-2.006_04, the direction of the FFT/IFFT has been reversed to
11       match the usage in the FFTW library and the convention in use
12       generally.
13       !!!!!!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14
15       FFTs for PDL.  These work for arrays of any dimension, although ones
16       with small prime factors are likely to be the quickest.  The forward
17       FFT is unnormalized while the inverse FFT is normalized so that the
18       IFFT of the FFT returns the original values.
19
20       For historical reasons, these routines work in-place and do not
21       recognize the in-place flag.  That should be fixed.
22

SYNOPSIS

24               use PDL::FFT qw/:Func/;
25
26               fft($real, $imag);
27               ifft($real, $imag);
28               realfft($real);
29               realifft($real);
30
31               fftnd($real,$imag);
32               ifftnd($real,$imag);
33
34               $kernel = kernctr($image,$smallk);
35               fftconvolve($image,$kernel);
36

DATA TYPES

38       The underlying C library upon which this module is based performs FFTs
39       on both single precision and double precision floating point ndarrays.
40       The PP functions are defined to only take those data types.  Therefore,
41       if you pass in an ndarray of integer datatype (byte, short, ushort,
42       long) to any of the routines in PDL::FFT, your data will be promoted to
43       a double-precision ndarray.  If you pass in a float, the single-
44       precision FFT will be performed.
45

FREQUENCIES

47       For even-sized input arrays, the frequencies are packed like normal for
48       FFTs (where N is the size of the array and D is the physical step size
49       between elements):
50
51        0, 1/ND, 2/ND, ..., (N/2-1)/ND, 1/2D, -(N/2-1)/ND, ..., -1/ND.
52
53       which can easily be obtained (taking the Nyquist frequency to be
54       positive) using
55
56       "$kx = $real->xlinvals(-($N/2-1)/$N/$D,1/2/$D)->rotate(-($N/2 -1));"
57
58       For odd-sized input arrays the Nyquist frequency is not directly
59       acessible, and the frequencies are
60
61        0, 1/ND, 2/ND, ..., (N/2-0.5)/ND, -(N/2-0.5)/ND, ..., -1/ND.
62
63       which can easily be obtained using
64
65       "$kx =
66       $real->xlinvals(-($N/2-0.5)/$N/$D,($N/2-0.5)/$N/$D)->rotate(-($N-1)/2);"
67

ALTERNATIVE FFT PACKAGES

69       Various other modules - such as PDL::FFTW3 and PDL::Slatec - contain
70       FFT routines.  However, unlike PDL::FFT, these modules are optional,
71       and so may not be installed.
72

FUNCTIONS

74   fft
75         Signature: ([io]real(n); [io]imag(n))
76
77       Complex 1-D FFT of the "real" and "imag" arrays [inplace]. A single
78       cfloat/cdouble input ndarray can also be used.
79
80         fft($real,$imag);
81         fft($complex);
82
83       fft does not process bad values.  It will set the bad-value flag of all
84       output ndarrays if the flag is set for any of the input ndarrays.
85
86   ifft
87         Signature: ([io]real(n); [io]imag(n))
88
89       Complex inverse 1-D FFT of the "real" and "imag" arrays [inplace]. A
90       single cfloat/cdouble input ndarray can also be used.
91
92         ifft($real,$imag);
93         ifft($complex);
94
95       ifft does not process bad values.  It will set the bad-value flag of
96       all output ndarrays if the flag is set for any of the input ndarrays.
97
98   realfft()
99       One-dimensional FFT of real function [inplace].
100
101       The real part of the transform ends up in the first half of the array
102       and the imaginary part of the transform ends up in the second half of
103       the array.
104
105               realfft($real);
106
107   realifft()
108       Inverse of one-dimensional realfft routine [inplace].
109
110               realifft($real);
111
112   fftnd()
113       N-dimensional FFT over all pdl dims of input (inplace)
114
115               fftnd($real,$imag);
116
117   ifftnd()
118       N-dimensional inverse FFT over all pdl dims of input (inplace)
119
120               ifftnd($real,$imag);
121
122   fftconvolve()
123       N-dimensional convolution with periodic boundaries (FFT method)
124
125               $kernel = kernctr($image,$smallk);
126               fftconvolve($image,$kernel);
127
128       fftconvolve works inplace, and returns an error array in kernel as an
129       accuracy check -- all the values in it should be negligible.
130
131       See also PDL::ImageND::convolveND, which performs speed-optimized
132       convolution with a variety of boundary conditions.
133
134       The sizes of the image and the kernel must be the same.  kernctr
135       centres a small kernel to emulate the behaviour of the direct
136       convolution routines.
137
138       The speed cross-over between using straight convolution
139       (PDL::Image2D::conv2d()) and these fft routines is for kernel sizes
140       roughly 7x7.
141

BUGS

143       Where the source is marked `FIX', could re-implement using phase-shift
144       factors on the transforms and some real-space bookkeeping, to save some
145       temporary space and redundant transforms.
146

AUTHOR

148       This file copyright (C) 1997, 1998 R.J.R. Williams
149       (rjrw@ast.leeds.ac.uk), Karl Glazebrook (kgb@aaoepp.aao.gov.au), Tuomas
150       J. Lukka, (lukka@husc.harvard.edu).  All rights reserved. There is no
151       warranty. You are allowed to redistribute this software / documentation
152       under certain conditions. For details, see the file COPYING in the PDL
153       distribution. If this file is separated from the PDL distribution, the
154       copyright notice should be included in the file.
155
156
157
158perl v5.34.0                      2022-02-28                            FFT(3)
Impressum