YAKL
Public Member Functions | List of all members
yakl::RealFFT1D< T > Class Template Reference

Compute batched real-to-complex forward and inverse FFTs on yakl::Array objects using vendor libraries. More...

#include <YAKL_fft.h>

Public Member Functions

 RealFFT1D ()
 
 ~RealFFT1D ()
 
template<int N>
void forward_real (Array< T, N, memDevice, styleC > &arr, int trdim_in=-1, int transform_size_in=-1)
 Perform a forward transform (real-to-complex) More...
 
template<int N>
void init (Array< T, N, memDevice, styleC > &arr, int trdim, int tr_size)
 Setup FFT plans, allocate, compute needed data. More...
 
template<int N>
void inverse_real (Array< T, N, memDevice, styleC > &arr, int trdim_in=-1, int transform_size_in=-1)
 Perform an inverse transform (complex-to-real) More...
 
void nullify ()
 

Detailed Description

template<class T>
class yakl::RealFFT1D< T >

Compute batched real-to-complex forward and inverse FFTs on yakl::Array objects using vendor libraries.

This class uses metadata from the yakl::Array object to provide a simplified interface for computing 1-D real-to-complex FFTs batched over the non-transformed dimensions of the Array object. If the user calls init(), then calls to forward_real() and reverse_real() do not need the optional transform dimension and transform size parameters. The user can avoid calling init(), though, and then provide these parameters to forward_real() and reverse_real().

Complex results of a forward transform are stored in interleaved real,imag,real,imag format in-place in the array.

Since it's real-to-complex, for even-element transforms, you'll need n+2 elements available in the transform dimension(s). For odd-element transforms, you'll need n+1.

Example Usage:

int nz = 100, ny = 50, nx = 40;
// Allocate space for forward transforms (even numbers add 2, odd numbers add 1)
Array<float,3,memDevice,styleC> data("data",nz,ny+2,nx+2);
// Initialize data
RealFFT<float> fft_y;
RealFFT<float> fft_x;
fft_x.init(data , 2 , nx );
fft_y.init(data , 1 , ny );
// Forward transform
fft_x.forward_real( data ); // Batched over y and z dimensions
fft_y.forward_real( data ); // Batched over x and z dimensions
// Do stuff in Fourier space
fft_y.inverse_real( data ); // Batched over x and z dimensions
fft_x.inverse_real( data ); // Batched over y and z dimensions
// Do stuff in physical space

Twiddle and chirp factors are not re-computed unless init() is called or forward_real() is called with a different dimension to transform or a different transform size (or the batch size changes).

Constructor & Destructor Documentation

◆ RealFFT1D()

template<class T >
yakl::RealFFT1D< T >::RealFFT1D ( )
inline

◆ ~RealFFT1D()

template<class T >
yakl::RealFFT1D< T >::~RealFFT1D ( )
inline

Member Function Documentation

◆ forward_real()

template<class T >
template<int N>
void yakl::RealFFT1D< T >::forward_real ( Array< T, N, memDevice, styleC > &  arr,
int  trdim_in = -1,
int  transform_size_in = -1 
)
inline

Perform a forward transform (real-to-complex)

trdim_in and transform_size_in are only needed if you did not call init() or you're changing the parameters of the transform (batch size, transform dim, transform size).

◆ init()

template<class T >
template<int N>
void yakl::RealFFT1D< T >::init ( Array< T, N, memDevice, styleC > &  arr,
int  trdim,
int  tr_size 
)
inline

Setup FFT plans, allocate, compute needed data.

This is not a necessary call. You can pass the trdim and tr_size parameters to forward_real() and inverse_real() if you want.

◆ inverse_real()

template<class T >
template<int N>
void yakl::RealFFT1D< T >::inverse_real ( Array< T, N, memDevice, styleC > &  arr,
int  trdim_in = -1,
int  transform_size_in = -1 
)
inline

Perform an inverse transform (complex-to-real)

trdim_in and transform_size_in are only needed if you did not call init() or you're changing the parameters of the transform (batch size, transform dim, transform size).

◆ nullify()

template<class T >
void yakl::RealFFT1D< T >::nullify ( )
inline

The documentation for this class was generated from the following file: