Docs
FFT Ops

Fast Fourier Transform Operations

Fast Fourier Transform (FFT) operations take an array as input, perform FFT or inverse FFT along specified dimensions, and return a new array. All FFT ops work on real valued as well as complex valued arrays and return a complex valued array.

fft

def fft(x: Array, dim: Int = -1, norm: String = "backward") -> Array
Computes the one-dimensional discrete Fourier Transform.
Args

x: The input array. dim: The dimension along which to compute the FFT. Default is the last dimension. norm: Normalization mode. Options are "backward" (default), "ortho" or "forward".

Returns

An array containing the FFT result.

Note

This function supports:

  • Automatic differentiation (forward and reverse modes).
  • Complex valued arguments.
Example
a = Array('[1, 2, 3, 4]')
result = fft(a)
print(result)

fft2

def fft2(x: Array, dims: List[Int] = List(-2, -1), norm: String = "backward") -> Array
Computes the 2-dimensional discrete Fourier Transform.
Args

x: The input array. dims: The dimensions along which to compute the FFT. Default is the last two dimensions. norm: Normalization mode. Options are "backward" (default), "ortho" or "forward".

Returns

An array containing the 2D FFT result.

Note

This function supports:

  • Automatic differentiation (forward and reverse modes).
  • Complex valued arguments.
Example
a = Array('[[1, 2], [3, 4]]')
result = fft2(a)
print(result)

fftn

def fftn(x: Array, dims: List[Int] = List[Int](), norm: String = "backward") -> Array
Computes the n-dimensional discrete Fourier Transform.
Args

x: The input array. dims: The dimensions along which to compute the FFT. Default is all dimensions. norm: Normalization mode. Options are "backward" (default), "ortho" or "forward".

Returns

An array containing the n-dimensional FFT result.

Note

This function supports:

  • Automatic differentiation (forward and reverse modes).
  • Complex valued arguments.
Example
a = Array('[[[1, 2], [3, 4]], [[5, 6], [7, 8]]]')
result = fftn(a)
print(result)

ifft

def ifft(x: Array, dim: Int = -1, norm: String = "backward") -> Array
Computes the one-dimensional inverse discrete Fourier Transform.
Args

x: The input array. dim: The dimension along which to compute the inverse FFT. Default is the last dimension. norm: Normalization mode. Options are "backward" (default), "ortho" or "forward".

Returns

An array containing the inverse FFT result.

Note

This function supports:

  • Automatic differentiation (forward and reverse modes).
  • Complex valued arguments.
Example
a = Array('[1+1j, 2+2j, 3+3j, 4+4j]')
result = ifft(a)
print(result)

ifft2

def ifft2(x: Array, dims: List[Int] = List(-2, -1), norm: String = "backward") -> Array
Computes the 2-dimensional inverse discrete Fourier Transform.
Args

x: The input array. dims: The dimensions along which to compute the inverse FFT. Default is the last two dimensions. norm: Normalization mode. Options are "backward" (default), "ortho" or "forward".

Returns

An array containing the 2D inverse FFT result.

Note

This function supports:

  • Automatic differentiation (forward and reverse modes).
  • Complex valued arguments.
Example
a = Array('[[1+1j, 2+2j], [3+3j, 4+4j]]')
result = ifft2(a)
print(result)

ifftn

def ifftn(x: Array, dims: List[Int] = List[Int](), norm: String = "backward") -> Array
Computes the n-dimensional inverse discrete Fourier Transform.
Args

x: The input array. dims: The dimensions along which to compute the inverse FFT. Default is all dimensions. norm: Normalization mode. Options are "backward" (default), "ortho" or "forward".

Returns

An array containing the n-dimensional inverse FFT result.

Note

This function supports:

  • Automatic differentiation (forward and reverse modes).
  • Complex valued arguments.
Example
a = Array('[[[1+1j, 2+2j], [3+3j, 4+4j]], [[5+5j, 6+6j], [7+7j, 8+8j]]]')
result = ifftn(a)
print(result)