A high-performance general-purpose compute library

- Main Page
- Tutorials
- Release Notes
- Examples

Functions
fft
ArrayFire Functions | ArrayFire Functions by Category » Signal Processing » Fast Fourier Transforms

Fast Fourier Transform More...

## Functions
AFAPI array | fftNorm (const array &in, const double norm_factor, const dim_t odim0=0)
| C++ Interface for fast fourier transform on one dimensional signals.
AFAPI void | fftInPlace (array &in, const double norm_factor=1.0)
| C++ Interface for fast fourier transform on one dimensional signals.
AFAPI array | fft (const array &in, const dim_t odim0=0)
| C++ Interface for fast fourier transform on one dimensional signals.
AFAPI array | dft (const array &in, const double norm_factor, const dim4 outDims)
| C++ Interface for fast fourier transform on any(1d, 2d, 3d) dimensional signals.
AFAPI array | dft (const array &in, const dim4 outDims)
| C++ Interface for fast fourier transform on any(1d, 2d, 3d) dimensional signals.
AFAPI array | dft (const array &in)
| C++ Interface for fast fourier transform on any(1d, 2d, 3d) dimensional signals.
AFAPI array | idft (const array &in, const double norm_factor, const dim4 outDims)
| C++ Interface for inverse fast fourier transform on any(1d, 2d, 3d) dimensional signals.
AFAPI array | idft (const array &in, const dim4 outDims)
| C++ Interface for inverse fast fourier transform on any(1d, 2d, 3d) dimensional signals.
AFAPI array | idft (const array &in)
| C++ Interface for inverse fast fourier transform on any(1d, 2d, 3d) dimensional signals.
AFAPI af_err | af_fft (af_array *out, const af_array in, const double norm_factor, const dim_t odim0)
| C Interface for fast fourier transform on one dimensional signals.
AFAPI af_err | af_fft_inplace (af_array in, const double norm_factor)
| C Interface for fast fourier transform on one dimensional signals.
AFAPI af_err | af_set_fft_plan_cache_size (size_t cache_size)
| C Interface for setting plan cache size.

## Detailed Description

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.

Note
  There are some convenience functions provided for fft where normalization factor is not required as input paramter. In such cases, the normalization factor is calculated internally based on the input data provided.

## Function Documentation

## ◆ af_fft()

AFAPI af_err af_fft | ( | af_array * | out,
|  | const af_array | in,
|  | const double | norm_factor,
|  | const dim_t | odim0 )

C Interface for fast fourier transform on one dimensional signals.

Parameters

  [out] | out | is the transformed array
  [in] | in | is the input array
  [in] | norm_factor | is the normalization factor with which the input is scaled after the transformation is applied
  [in] | odim0 | is the length of output signals - used to either truncate or pad the input signals

Returns
  AF_SUCCESS if the fft transform is successful, otherwise an appropriate error code is returned.

## ◆ af_fft_inplace()

AFAPI af_err af_fft_inplace | ( | af_array | in,
|  | const double | norm_factor )

C Interface for fast fourier transform on one dimensional signals.

Parameters

  [in,out] | in | is the input array on entry and the output of 1D forward fourier transform at exit
  [in] | norm_factor | is the normalization factor with which the input is scaled after the transformation is applied

Returns
  AF_SUCCESS if the fft transform is successful, otherwise an appropriate error code is returned.

Note
  The input `in` must be a complex array

## ◆ af_set_fft_plan_cache_size()

AFAPI af_err af_set_fft_plan_cache_size | ( | size_t | cache_size | ) |

C Interface for setting plan cache size.

This function doesn't do anything if called when CPU backend is active. The plans associated with the most recently used array sizes are cached.

Parameters

  [in] | cache_size | is the number of plans that shall be cached

## ◆ dft() [1/3]

AFAPI array dft | ( | const array & | in | ) |

C++ Interface for fast fourier transform on any(1d, 2d, 3d) dimensional signals.

This version of fft function uses a default norm_factor parameter that is calculated internally based on the input signals.

Parameters

  [in] | in | is the input array

Returns
  the transformed array

## ◆ dft() [2/3]

AFAPI array dft | ( | const array & | in,
|  | const dim4 | outDims )

C++ Interface for fast fourier transform on any(1d, 2d, 3d) dimensional signals.

This version of fft function uses a default norm_factor parameter that is calculated internally based on the input signals.

Parameters

  [in] | in | is the input array
  [in] | outDims | is an object of dim4 that has the output array dimensions - used to either truncate or pad the input signals

Returns
  the transformed array

## ◆ dft() [3/3]

AFAPI array dft | ( | const array & | in,
|  | const double | norm_factor,
|  | const dim4 | outDims )

C++ Interface for fast fourier transform on any(1d, 2d, 3d) dimensional signals.

Parameters

  [in] | in | is the input array
  [in] | norm_factor | is the normalization factor with which the input is scaled after the transformation is applied
  [in] | outDims | is an object of dim4 that has the output array dimensions - used to either truncate or pad the input signals

Returns
  the transformed array

## ◆ fft()

AFAPI array fft | ( | const array & | in,
|  | const dim_t | odim0 = 0 )

C++ Interface for fast fourier transform on one dimensional signals.

This version of fft function uses a default norm_factor parameter that is calculated internally based on the input signals.

Parameters

  [in] | in | is the input array
  [in] | odim0 | is the length of output signals - used to either truncate or pad the input signals

Returns
  the transformed array

## ◆ fftInPlace()

AFAPI void fftInPlace | ( | array & | in,
|  | const double | norm_factor = 1.0 )

C++ Interface for fast fourier transform on one dimensional signals.

Parameters

  [in,out] | in | is the input array on entry and the output of 1D forward fourier transform on exit
  [in] | norm_factor | is the normalization factor with which the input is scaled after the transformation is applied

Note
  The input `in` must be complex

## ◆ fftNorm()

AFAPI array fftNorm | ( | const array & | in,
|  | const double | norm_factor,
|  | const dim_t | odim0 = 0 )

C++ Interface for fast fourier transform on one dimensional signals.

Parameters

  [in] | in | is the input array
  [in] | norm_factor | is the normalization factor with which the input is scaled after the transformation is applied
  [in] | odim0 | is the length of output signals - used to either truncate or pad the input signals

Returns
  the transformed array

## ◆ idft() [1/3]

AFAPI array idft | ( | const array & | in | ) |

C++ Interface for inverse fast fourier transform on any(1d, 2d, 3d) dimensional signals.

This version of fft function uses a default norm_factor parameter that is calculated internally based on the input signals.

Parameters

  [in] | in | is the input array

Returns
  the transformed array

## ◆ idft() [2/3]

AFAPI array idft | ( | const array & | in,
|  | const dim4 | outDims )

C++ Interface for inverse fast fourier transform on any(1d, 2d, 3d) dimensional signals.

This version of fft function uses a default norm_factor parameter that is calculated internally based on the input signals.

Parameters

  [in] | in | is the input array
  [in] | outDims | is an object of dim4 that has the output array dimensions - used to either truncate or pad the input signals

Returns
  the transformed array

## ◆ idft() [3/3]

AFAPI array idft | ( | const array & | in,
|  | const double | norm_factor,
|  | const dim4 | outDims )

C++ Interface for inverse fast fourier transform on any(1d, 2d, 3d) dimensional signals.

Parameters

  [in] | in | is the input array
  [in] | norm_factor | is the normalization factor with which the input is scaled after the transformation is applied
  [in] | outDims | is an object of dim4 that has the output array dimensions - used to either truncate or pad the input signals

Returns
  the transformed array