Home
Manual
Packages
Global Index
Keywords
Quick Reference

functions in fft.i  f
fft

fft(x, direction)
fft(x, ljdir, rjdir)
or fft(x, ljdir, rjdir, setup=workspace)
returns the complex Fast Fourier Transform of array X.
The DIRECTION determines which direction the transform is in 
e.g. from time to frequency or viceversa  as follows:
DIRECTION meaning
 
1 "forward" transform (coefficients of exp(+i * 2*pi*kl/N))
on every dimension of X
1 "backward" transform (coefficients of exp(i * 2*pi*kl/N))
on every dimension of X
[1,1,1] forward transform on first and third dimensions of X,
backward transform on second dimension of X (any other
dimensions remain untransformed)
[1,0,0,1] backward transform on first dimension of X, forward
transform on fourth dimension of X
etc.
The third positional argument, if present, allows the direction
of dimensions of X to be specified relative to the final dimension
of X, instead of relative to the first dimension of X. In this
case, both LJDIR and RJDIR must be vectors of integers  the
scalar form is illegal:
LJDIR RJDIR meaning
  
[] [1] forward transform last dimension of X
[1] [] forward transform first dimension of X
[] [1,1] backward transform last two dimensions of X,
leaving any other dimensions untransformed
[1,0,0,1] [] backward transform on first dimension of X,
forward transform on fourth dimension of X
[] [1,0,0,1] backward transform on 4th to last dimension of X,
forward transform on last dimension of X
etc.
Note that the final element of RJDIR corresponds to the last dimension
of X, while the initial element of LJDIR corresponds to the first
dimension of X.
The explicit meaning of "forward" transform  the coefficients of
exp(+i * 2*pi*kl/N)  is:
result for j=1,...,n
result(j)=the sum from k=1,...,n of
x(k)*exp(i*(j1)*(k1)*2*pi/n)
where i=sqrt(1)
Note that the result is unnormalized. Applying the "backward"
transform to the result of a "forward" transform returns N times
the original vector of length N. Equivalently, applying either
the "forward" or "backward" transform four times in succession
yields N^2 times the original vector of length N.
Performing the transform requires some WORKSPACE, which can be
set up beforehand by calling fft_setup, if fft is to be called
more than once with arrays X of the same shape. If no setup
keyword argument is supplied, the workspace allocation and setup
must be repeated for each call.
interpreted function, defined at i0/fft.i line 20

SEE ALSO:

roll,
fft_setup,
fft_inplace

fft_braw

fft_braw, n, c, wsave
Swarztrauber's cfftb. You can use this to avoid the additional
2*N storage incurred by fft_setup.
builtin function, documented at i0/fft.i line 237

fft_fraw

fft_fraw, n, c, wsave
Swarztrauber's cfftf. You can use this to avoid the additional
2*N storage incurred by fft_setup.
builtin function, documented at i0/fft.i line 228

fft_init

fft_init, n, wsave
Swarztrauber's cffti. This actually requires wsave=array(0.0, 4*n+15),
instead of the 6*n+15 doubles of storage used by fft_raw to handle the
possibility of multidimensional arrays. If the storage matters, you
can call cfftf and/or cfftb as the Yorick functions fft_fraw and/or
fft_braw.
builtin function, documented at i0/fft.i line 216

fft_inplace

fft_inplace, x, direction
or fft_inplace, x, ljdir, rjdir
or fft_inplace, x, ljdir, rjdir, setup=workspace
is the same as the fft function, except that the transform is
performed "in_place" on the array X, which must be of type complex.
interpreted function, defined at i0/fft.i line 94

SEE ALSO:

fft,
fft_setup

fft_setup

workspace= fft_setup(dimsof(x))
or workspace= fft_setup(dimsof(x), direction)
or workspace= fft_setup(dimsof(x), ljdir, rjdir)
allocates and sets up the workspace for a subsequent call to
fft(X, DIRECTION, setup=WORKSPACE)
or
fft(X, LJDIR, RJDIR, setup=WORKSPACE)
The DIRECTION or LJDIR, RJDIR arguments compute WORKSPACE only for
the dimensions which will actually be transformed. If only the
dimsof(x) argument is supplied, then WORKSPACE will be enough to
transform any or all dimensions of X. With DIRECTION or LJDIR, RJDIR
supplied, WORKSPACE will only be enough to compute the dimensions
which are actually to be transformed. The WORKSPACE does not
depend on the sign of any element in the DIRECTION (or LJDIR, RJDIR),
so you can use the same WORKSPACE for both "forward" and "backward"
transforms.
Furthermore, as long as the length of any dimensions of the array
X to be transformed are present in WORKSPACE, it may be used in
a call to fft with the array. Thus, if X were a 25by64 array,
and Y were a 64vector, the following sequence is legal:
ws= fft_setup(dimsof(x));
xf= fft(x, 1, setup=ws);
yf= fft(y, 1, setup=ws);
The WORKSPACE required for a dimension of length N is 6*N+15 doubles.
interpreted function, defined at i0/fft.i line 137

SEE ALSO:

fft,
dimsof,
fft_inplace

