Fast Fourier Transform


The Fast Fourier Transform (FFT) module nvmath.fft in nvmath-python leverages the NVIDIA cuFFT library and provides a powerful suite of APIs that can be directly called from the host to efficiently perform discrete Fourier Transformations. Both stateless function-form APIs and stateful class-form APIs are provided to support a spectrum of N-dimensional FFT operations. These include forward and inverse transformations, as well as complex-to-complex (C2C), complex-to-real (C2R), and real-to-complex (R2C) transforms:

Furthermore, the nvmath.fft.FFT class includes utility APIs designed to help users cache FFT plans, facilitating the efficient execution of repeated calculations across various computational tasks (see create_key()).


The API fft() and related function-form APIs perform N-D FFT operations, similar to numpy.fft.fftn(). There are no special 1-D (numpy.fft.fft()) or 2-D FFT (numpy.fft.fft2()) APIs. This not only reduces the API surface, but also avoids the potential for incorrect use because the number of batch dimensions is \(N - 1\) for numpy.fft.fft() and \(N - 2\) for numpy.fft.fft2(), where \(N\) is the operand dimension.

Host API Reference

FFT support (nvmath.fft)

fft(operand[, axes, direction, options, ...])

Perform an N-D complex-to-complex (C2C) FFT on the provided complex operand.

ifft(operand[, axes, options, prolog, ...])

Perform an N-D complex-to-complex (C2C) inverse FFT on the provided complex operand.

rfft(operand[, axes, options, prolog, ...])

Perform an N-D real-to-complex (R2C) FFT on the provided real operand.

irfft(operand[, axes, options, prolog, ...])

Perform an N-D complex-to-real (C2R) FFT on the provided complex operand.

UnsupportedLayoutError(message, permutation, ...)

Error type for layouts not supported by the library.

FFT(operand, *[, axes, options, stream])

Create a stateful object that encapsulates the specified FFT computations and required resources.

FFTOptions([fft_type, inplace, ...])

A data class for providing options to the FFT object and the family of wrapper functions fft(), ifft(), rfft(), and irfft().

FFTDirection(value[, names, module, ...])

An IntEnum class specifying the direction of the transform.

DeviceCallable([ltoir, size, data])

A data class capturing LTO-IR callables.