# Public Interface

`AbstractFFTs.fft`

— Function.`fft(A [, dims])`

Performs a multidimensional FFT of the array `A`

. The optional `dims`

argument specifies an iterable subset of dimensions (e.g. an integer, range, tuple, or array) to transform along. Most efficient if the size of `A`

along the transformed dimensions is a product of small primes; see `Base.nextprod`

. See also `plan_fft()`

for even greater efficiency.

A one-dimensional FFT computes the one-dimensional discrete Fourier transform (DFT) as defined by

A multidimensional FFT simply performs this operation along each transformed dimension of `A`

.

This performs a multidimensional FFT by default. FFT libraries in other languages such as Python and Octave perform a one-dimensional FFT along the first non-singleton dimension of the array. This is worth noting while performing comparisons.

`AbstractFFTs.fft!`

— Function.`fft!(A [, dims])`

Same as `fft`

, but operates in-place on `A`

, which must be an array of complex floating-point numbers.

`AbstractFFTs.ifft`

— Function.`ifft(A [, dims])`

Multidimensional inverse FFT.

A one-dimensional inverse FFT computes

A multidimensional inverse FFT simply performs this operation along each transformed dimension of `A`

.

`AbstractFFTs.ifft!`

— Function.`ifft!(A [, dims])`

Same as `ifft`

, but operates in-place on `A`

.

`AbstractFFTs.bfft`

— Function.`bfft(A [, dims])`

Similar to `ifft`

, but computes an unnormalized inverse (backward) transform, which must be divided by the product of the sizes of the transformed dimensions in order to obtain the inverse. (This is slightly more efficient than `ifft`

because it omits a scaling step, which in some applications can be combined with other computational steps elsewhere.)

`AbstractFFTs.bfft!`

— Function.`bfft!(A [, dims])`

Same as `bfft`

, but operates in-place on `A`

.

`AbstractFFTs.plan_fft`

— Function.`plan_fft(A [, dims]; flags=FFTW.ESTIMATE, timelimit=Inf)`

Pre-plan an optimized FFT along given dimensions (`dims`

) of arrays matching the shape and type of `A`

. (The first two arguments have the same meaning as for `fft`

.) Returns an object `P`

which represents the linear operator computed by the FFT, and which contains all of the information needed to compute `fft(A, dims)`

quickly.

To apply `P`

to an array `A`

, use `P * A`

; in general, the syntax for applying plans is much like that of matrices. (A plan can only be applied to arrays of the same size as the `A`

for which the plan was created.) You can also apply a plan with a preallocated output array `Â`

by calling `mul!(Â, plan, A)`

. (For `mul!`

, however, the input array `A`

must be a complex floating-point array like the output `Â`

.) You can compute the inverse-transform plan by `inv(P)`

and apply the inverse plan with `P \ Â`

(the inverse plan is cached and reused for subsequent calls to `inv`

or `\`

), and apply the inverse plan to a pre-allocated output array `A`

with `ldiv!(A, P, Â)`

.

The `flags`

argument is a bitwise-or of FFTW planner flags, defaulting to `FFTW.ESTIMATE`

. e.g. passing `FFTW.MEASURE`

or `FFTW.PATIENT`

will instead spend several seconds (or more) benchmarking different possible FFT algorithms and picking the fastest one; see the FFTW manual for more information on planner flags. The optional `timelimit`

argument specifies a rough upper bound on the allowed planning time, in seconds. Passing `FFTW.MEASURE`

or `FFTW.PATIENT`

may cause the input array `A`

to be overwritten with zeros during plan creation.

`plan_fft!`

is the same as `plan_fft`

but creates a plan that operates in-place on its argument (which must be an array of complex floating-point numbers). `plan_ifft`

and so on are similar but produce plans that perform the equivalent of the inverse transforms `ifft`

and so on.

`AbstractFFTs.plan_ifft`

— Function.`AbstractFFTs.plan_bfft`

— Function.`AbstractFFTs.plan_fft!`

— Function.`plan_fft!(A [, dims]; flags=FFTW.ESTIMATE, timelimit=Inf)`

Same as `plan_fft`

, but operates in-place on `A`

.

`AbstractFFTs.plan_ifft!`

— Function.`plan_ifft!(A [, dims]; flags=FFTW.ESTIMATE, timelimit=Inf)`

Same as `plan_ifft`

, but operates in-place on `A`

.

`AbstractFFTs.plan_bfft!`

— Function.`plan_bfft!(A [, dims]; flags=FFTW.ESTIMATE, timelimit=Inf)`

Same as `plan_bfft`

, but operates in-place on `A`

.

`AbstractFFTs.rfft`

— Function.`rfft(A [, dims])`

Multidimensional FFT of a real array `A`

, exploiting the fact that the transform has conjugate symmetry in order to save roughly half the computational time and storage costs compared with `fft`

. If `A`

has size `(n_1, ..., n_d)`

, the result has size `(div(n_1,2)+1, ..., n_d)`

.

The optional `dims`

argument specifies an iterable subset of one or more dimensions of `A`

to transform, similar to `fft`

. Instead of (roughly) halving the first dimension of `A`

in the result, the `dims[1]`

dimension is (roughly) halved in the same way.

`AbstractFFTs.irfft`

— Function.`irfft(A, d [, dims])`

Inverse of `rfft`

: for a complex array `A`

, gives the corresponding real array whose FFT yields `A`

in the first half. As for `rfft`

, `dims`

is an optional subset of dimensions to transform, defaulting to `1:ndims(A)`

.

`d`

is the length of the transformed real array along the `dims[1]`

dimension, which must satisfy `div(d,2)+1 == size(A,dims[1])`

. (This parameter cannot be inferred from `size(A)`

since both `2*size(A,dims[1])-2`

as well as `2*size(A,dims[1])-1`

are valid sizes for the transformed real array.)

`AbstractFFTs.brfft`

— Function.`AbstractFFTs.plan_rfft`

— Function.`AbstractFFTs.plan_brfft`

— Function.`AbstractFFTs.plan_irfft`

— Function.`AbstractFFTs.fftshift`

— Function.`fftshift(x, [dim])`

Circular-shift along the given dimension of a periodic signal `x`

centered at index `1`

so it becomes centered at index `N÷2+1`

, where `N`

is the size of that dimension.

This can be undone with `ifftshift`

. For even `N`

this is equivalent to swapping the first and second halves, so `fftshift`

and `ifftshift`

are the same.

If `dim`

is not given then the signal is shifted along each dimension.

`AbstractFFTs.ifftshift`

— Function.`ifftshift(x, [dim])`

Circular-shift along the given dimension of a periodic signal `x`

centered at index `N÷2+1`

so it becomes centered at index `1`

, where `N`

is the size of that dimension.

This undoes the effect of `fftshift`

. For even `N`

this is equivalent to swapping the first and second halves, so `fftshift`

and `ifftshift`

are the same.

If `dim`

is not given then the signal is shifted along each dimension.