dspp
Digital Signal Processing library for C++
 All Classes Namespaces Functions Variables Groups Pages
Functions
dspp::FFT Namespace Reference

Fast Fourier/Cosine/Sine Transforms. More...

Functions

template<typename T >
void dft (size_t n,::std::complex< T > *data, int isgn=-1)
 Complex discrete Fourier transform. In-place unsafe version.
 
template<typename T >
void dft (size_t insize, const ::std::complex< T > *in,::std::complex< T > *out, int isgn=-1)
 Complex discrete Fourier transform. Out-of-place unsafe version.
 
template<typename T >
void dft (size_t n, T *data, int isgn=-1)
 Real discrete Fourier transform. In-place unsafe version. More...
 
template<typename T >
void dft (size_t insize, const T *in,::std::complex< T > *out, int unused=0)
 Real to complex discrete Fourier transform. Out-of-place unsafe version.
 
template<typename T >
void dft (size_t insize, const ::std::complex< T > *in, T *out, int unused=0)
 Complex to real discrete Fourier transform. Out-of-place unsafe version.
 
template<typename T , size_t N>
void dft (T(&data)[N], int isgn=-1)
 Discrete Fourier transform. In-place for C-style array.
 
template<typename T >
void dft (T &data, int isgn=-1)
 Discrete Fourier transform. In-place for STL container.
 
template<typename T1 , size_t N1, typename T2 , size_t N2>
void dft (const T1(&in)[N1], T2(&out)[N2], int isgn=-1)
 Discrete Fourier transform. Out-of-place for C-style arrays.
 
template<typename T1 , typename T2 >
void dft (const T1 &in, T2 &out, int isgn=-1)
 Discrete Fourier transform. Out-of-place for STL containers.
 
template<typename T >
void dct (size_t n, T *data, int isgn=-1)
 Discrete cosine transform. In-place unsafe version.
 
template<typename T >
void dst (size_t n, T *data, int isgn=-1)
 Discrete sine transform. In-place unsafe version.
 
template<typename T >
void czt (size_t n,::std::complex< T > *data, size_t m=0,::std::complex< T > w=0, T a=1)
 Chirp z-transform. In-place unsafe version.
 

Detailed Description

Fast Fourier/Cosine/Sine Transforms.

Performs a transform on arrays with power-of-two sizes. Uses Sande-Tukey decimation in frequency algorithm.

Example usage:

std::vector<std::complex<float>> data(512);
dspp::FFT::dft(data);

C-style arrays are supported:

std::complex<float> data[512];
dspp::FFT::dft(data, 1); // 1 = inverse DFT

Out-of-place transform:

std::array<double,64> in;
std::array<std::complex<double>,32> out;
dspp::FFT::dft(in, out); // real transform

Planning is automatically performed as necessary. The first transform of a specific size and type will take longer than subsequent transforms.

Each of the transform types has an unsafe version. If possible, always use the convenience overloads which engage the type safety of your compiler.

Function Documentation

template<typename T >
void dspp::FFT::dft ( size_t  n,
T *  data,
int  isgn = -1 
)
inline

Real discrete Fourier transform. In-place unsafe version.

Value for data[n].real() is packed in data[0].imag().

Parameters
isgn-1 is real to complex.
1 is complex to real.