Documentation

C++ interface for Fast Fourier Transform. More...

 array fft (const array &, int pad=-1) Fast Fourier Transform in one dimension. More... array fft2 (const array &, int nx=-1, int ny=-1) Fast Fourier Transform in two dimensions. More... array fft3 (const array &, const dim4 &dims=dim4(0)) Fast Fourier Transform in three dimensions. More...

## Inverse Fast Fourier Transform

array ifft (const array &, int pad=-1)
Inverse Fast Fourier Transform in one dimension. More...

array ifft2 (const array &, int nx=-1, int ny=-1)
Inverse Fast Fourier Transform in two dimensions. More...

array ifft3 (const array &, const dim4 &dims=dim4(0))
Inverse Fast Fourier Transform in three dimensions. More...

## Detailed Description

C++ interface for Fast Fourier Transform.

The Fast Fourier Transform (FFT) is an efficient algorithm to compute the discrete Fourier transform (DFT) of a signal or array. This is most commonly used to convert data in the time (or space) domain to the frequency domain, Then, the inverse FFT (iFFT) is used to return the data to the original domain.

There are numerous algorithms to compute the FFT of an array, and the specifics of the algorithm depend on the target hardware. Most algorithms, however, use a Cooley-Tukey scheme in a divide-and-conquer approach.

ArrayFire supports up to three-dimensional FFTs. Typically, these multi-dimensional FFTs are implemented using 1D FFTs combined with transpose operations.

array a = randu(4,4);
// a =
// 0.7402 0.9251 0.4702 0.7140
// 0.9210 0.4464 0.5132 0.3585
// 0.0390 0.6673 0.7762 0.6814
// 0.9690 0.1099 0.2948 0.2920
array f = fft(a);
// f =
// 2.6692 + 0.0000i 2.1487 + 0.0000i 2.0544 + 0.0000i 2.0459 + 0.0000i
// 0.7012 + 0.0480i 0.2578 - 0.3364i -0.3060 - 0.2184i 0.0326 - 0.0665i
// -1.1107 + 0.0000i 1.0362 + 0.0000i 0.4384 + 0.0000i 0.7449 + 0.0000i
// 0.7012 - 0.0480i 0.2578 + 0.3364i -0.3060 + 0.2184i 0.0326 + 0.0665i
array i = ifft(f);
// i =
// 0.7402 + 0.0000i 0.9251 + 0.0000i 0.4702 + 0.0000i 0.7140 + 0.0000i
// 0.9210 + 0.0000i 0.4464 - 0.0000i 0.5132 - 0.0000i 0.3585 - 0.0000i
// 0.0390 + 0.0000i 0.6673 + 0.0000i 0.7762 + 0.0000i 0.6814 + 0.0000i
// 0.9690 - 0.0000i 0.1099 + 0.0000i 0.2948 + 0.0000i 0.2920 + 0.0000i

## Function Documentation

 array af::fft ( const array & , int pad = -1 )

Fast Fourier Transform in one dimension.

Applied along each column.

Parameters
 [in] pad zero-pad or truncate signal to this length before performing transform (default: no change)
Examples:
examples/getting_started/gfor.cpp, and examples/helloworld/helloworld.cpp.
 array af::fft2 ( const array & , int nx = -1, int ny = -1 )

Fast Fourier Transform in two dimensions.

Applied to first two dimensions in higher dimensional arrays.

Parameters
 [in] nx Rows are zero-padded or truncated to nx elements before transform (default: no change) [in] ny Columns are zero-padded or truncated to ny elements before transform (default: no change)
Examples:
examples/benchmarks/fft.cpp.
 array af::fft3 ( const array & , const dim4 & dims = dim4(0) )

Fast Fourier Transform in three dimensions.

Applied to first three dimensions in higher dimensional arrays.

Parameters
 [in] dims zero-pad or truncate each dimension before transform
 array af::ifft ( const array & , int pad = -1 )

Inverse Fast Fourier Transform in one dimension.

Applied along each column. Normalized (divided) by number of elements.

Parameters
 [in] pad zero-pad or truncate signal to this length before performing transform (default: no change)
 array af::ifft2 ( const array & , int nx = -1, int ny = -1 )

Inverse Fast Fourier Transform in two dimensions.

Applied to first two dimensions in higher dimensional arrays. Normalized (divided) by number of elements.

Parameters
 [in] nx Rows are zero-padded or truncated to nx elements before transform (default: no change) [in] ny Columns are zero-padded or truncated to ny elements before transform (default: no change)
 array af::ifft3 ( const array & , const dim4 & dims = dim4(0) )

Inverse Fast Fourier Transform in three dimensions.

Applied to first three dimensions in higher dimensional arrays. Normalize (divide) by number of elements.

Parameters
 [in] dims zero-pad or truncate each dimension before transform