FFT

The API below provides transformations for Fast Fourier Transforms (FFTs) of both 1D and 2D types with batching.

Cached API

template<typename OutputTensor, typename InputTensor>
void matx::fft(OutputTensor &o, const InputTensor &i, cudaStream_t stream = 0)

Run a 1D FFT with a cached plan

Creates a new FFT plan in the cache if none exists, and uses that to execute the 1D FFT. Note that FFTs and IFFTs share the same plans if all dimensions match

Template Parameters
  • T1 – Output view data type

  • T2 – Input view data type

  • RANK – Rank of input and output tensors

Parameters
  • o – Output tensor. The length of the fastest-changing dimension dictates the size of FFT. If this size is longer than the length of the input tensor, the tensor will potentially be copied and zero-padded to a new block of memory. Future releases may remove this restriction to where there is no copy.

  • i – input tensor

  • stream – CUDA stream

template<typename OutputTensor, typename InputTensor>
void matx::ifft(OutputTensor &o, const InputTensor &i, cudaStream_t stream = 0)

Run a 1D IFFT with a cached plan

Creates a new FFT plan in the cache if none exists, and uses that to execute the 1D IFFT. Note that FFTs and IFFTs share the same plans if all dimensions match

Template Parameters
  • T1 – Output view data type

  • T2 – Input view data type

  • RANK – Rank of input and output tensors

Parameters
  • o – Output tensor. The length of the fastest-changing dimension dictates the size of FFT. If this size is longer than the length of the input tensor, the tensor will potentially be copied and zero-padded to a new block of memory. Future releases may remove this restriction to where there is no copy.

  • i – input tensor

  • stream – CUDA stream

template<typename OutputTensor, typename InputTensor>
void matx::fft2(OutputTensor &o, const InputTensor &i, cudaStream_t stream = 0)

Run a 2D FFT with a cached plan

Creates a new FFT plan in the cache if none exists, and uses that to execute the 2D FFT. Note that FFTs and IFFTs share the same plans if all dimensions match

Template Parameters
  • T1 – Output view data type

  • T2 – Input view data type

  • RANK – Rank of input and output tensors

Parameters
  • o – Output tensor

  • i – input tensor

  • stream – CUDA stream

template<typename OutputTensor, typename InputTensor>
void matx::ifft2(OutputTensor &o, const InputTensor &i, cudaStream_t stream = 0)

Run a 2D IFFT with a cached plan

Creates a new FFT plan in the cache if none exists, and uses that to execute the 2D IFFT. Note that FFTs and IFFTs share the same plans if all dimensions match

Template Parameters
  • T1 – Output view data type

  • T2 – Input view data type

  • RANK – Rank of input and output tensors

Parameters
  • o – Output tensor

  • i – input tensor

  • stream – CUDA stream

template<typename OutputTensor, typename InputTensor>
void matx::signal::dct(OutputTensor &out, const InputTensor &in, const cudaStream_t stream = 0)

Discrete Cosine Transform

Computes the DCT of input sequence “in”. The input and output ranks must be 1, and the sizes must match.

Template Parameters
  • T – Input data type

  • RANK – Rank of input and output tensor. Must be 1

Parameters
  • out – Output tensor

  • in – Input tensor

  • stream – CUDA stream

Non-Cached API

template<typename OutTensorType, typename InTensorType = OutTensorType>
class matx::matxFFTPlan1D_t : public matx::matxFFTPlan_t<OutTensorType, OutTensorType>

Create a 1D FFT plan

An FFT plan is used to set up all parameters and memory needed to execute an FFT. All parameters of the FFT normally needed when using cuFFT directly are deduced by matx using the View classes passed in. Because MatX uses cuFFT directly, all limitations and properties of cuFFT must be adhered to. Please see the cuFFT documentation to see these limitations. Once the plan has been created, FFTs can be executed as many times as needed using the Exec() functions. It is not necessary to pass in the same views as were used to create the plans as long as the rank and dimensions are idential.

If a tensor larger than rank 1 is passed, all other dimensions are batch dimensions

tparam T1

Output view data type

tparam T2

Input view data type

Public Functions

inline matxFFTPlan1D_t(OutTensorType &o, const InTensorType &i)

Construct a 1D FFT plan

Parameters
  • o – Output view

  • i – Input view

template<typename OutTensorType, typename InTensorType = OutTensorType>
class matx::matxFFTPlan2D_t : public matx::matxFFTPlan_t<OutTensorType, OutTensorType>

Create a 2D FFT plan

An FFT plan is used to set up all parameters and memory needed to execute an FFT. All parameters of the FFT normally needed when using cuFFT directly are deduced by matx using the View classes passed in. Because MatX uses cuFFT directly, all limitations and properties of cuFFT must be adhered to. Please see the cuFFT documentation to see these limitations. Once the plan has been created, FFTs can be executed as many times as needed using the Exec() functions. It is not necessary to pass in the same views as were used to create the plans as long as the rank and dimensions are idential.

If a tensor larger than rank 2 is passed, all other dimensions are batch dimensions

tparam T1

Output view data type

tparam T2

Input view data type

Public Functions

inline matxFFTPlan2D_t(OutTensorType &o, const InTensorType &i)

Construct a 2D FFT plan

Parameters
  • o – Output view

  • i – Input view