SigPack - the C++ signal processing library
 
Loading...
Searching...
No Matches
sp::FFTW Class Reference

#include <fftw.h>

Collaboration diagram for sp::FFTW:
Collaboration graph

Public Member Functions

 FFTW (unsigned int _N, int _alg=FFTW_ESTIMATE)
 
 FFTW (unsigned int _R, unsigned int _C, int _alg)
 
 ~FFTW ()
 
void fft_cx (arma::cx_vec &x, arma::cx_vec &Pxx)
 
arma::cx_vec fft_cx (arma::cx_vec &x)
 
void ifft_cx (arma::cx_vec &Pxx, arma::cx_vec &x)
 
arma::cx_vec ifft_cx (arma::cx_vec &Pxx)
 
void fft (arma::vec &x, arma::cx_vec &Pxx)
 
arma::cx_vec fft (arma::vec &x)
 
void ifft (arma::cx_vec &Pxx, arma::vec &x)
 
arma::vec ifft (arma::cx_vec &Pxx)
 
void fft2 (arma::mat &x, arma::cx_mat &Pxx)
 
arma::cx_mat fft2 (arma::mat &x)
 
void ifft2 (arma::cx_mat &Pxx, arma::mat &x)
 
arma::mat ifft2 (arma::cx_mat &Pxx)
 
void import_wisdom_string (const std::string wisd)
 
void import_wisdom_file (const std::string fname)
 
void export_wisdom_fft (const std::string fname)
 
void export_wisdom_ifft (const std::string fname)
 
void export_wisdom_fft_cx (const std::string fname)
 
void export_wisdom_ifft_cx (const std::string fname)
 

Private Attributes

fftw_plan pl_fft
 
fftw_plan pl_ifft
 
fftw_plan pl_fft_cx
 
fftw_plan pl_ifft_cx
 
unsigned int N
 
unsigned int R
 
unsigned int C
 
int alg
 
int export_alg
 

Detailed Description

Implements FFT functions for Armadillo types. For more info see fftw.org

Examples
fftw_loop.cpp, fftw_wisdom.cpp, and image.cpp.

Definition at line 25 of file fftw.h.

Constructor & Destructor Documentation

◆ FFTW() [1/2]

sp::FFTW::FFTW ( unsigned int  _N,
int  _alg = FFTW_ESTIMATE 
)
inline

Constructor.

Parameters
_NFFT length
_algFFTW algorithm selection

Definition at line 44 of file fftw.h.

References alg, C, export_alg, N, pl_fft, pl_fft_cx, pl_ifft, pl_ifft_cx, and R.

◆ FFTW() [2/2]

sp::FFTW::FFTW ( unsigned int  _R,
unsigned int  _C,
int  _alg 
)
inline

Constructor.

Parameters
_RFFT Nr of rows
_CFFT Nr of cols
_algFFTW algorithm selection

Definition at line 63 of file fftw.h.

References alg, C, export_alg, N, pl_fft, pl_fft_cx, pl_ifft, pl_ifft_cx, and R.

◆ ~FFTW()

sp::FFTW::~FFTW ( )
inline

Destructor.

Definition at line 79 of file fftw.h.

References pl_fft, pl_fft_cx, pl_ifft, and pl_ifft_cx.

Member Function Documentation

◆ export_wisdom_fft()

void sp::FFTW::export_wisdom_fft ( const std::string  fname)
inline

Export real FFT wisdom to file.

Parameters
fnameFile name

Definition at line 353 of file fftw.h.

References C, err_handler, export_alg, N, and R.

◆ export_wisdom_fft_cx()

void sp::FFTW::export_wisdom_fft_cx ( const std::string  fname)
inline

Export complex FFT wisdom to file.

Parameters
fnameFile name

Definition at line 438 of file fftw.h.

References C, err_handler, export_alg, N, and R.

◆ export_wisdom_ifft()

void sp::FFTW::export_wisdom_ifft ( const std::string  fname)
inline

Export real IFFT wisdom to file.

Parameters
fnameFile name

Definition at line 395 of file fftw.h.

References C, err_handler, export_alg, N, and R.

◆ export_wisdom_ifft_cx()

void sp::FFTW::export_wisdom_ifft_cx ( const std::string  fname)
inline

Export complex IFFT wisdom to file.

Parameters
fnameFile name

Definition at line 480 of file fftw.h.

References C, err_handler, export_alg, N, and R.

◆ fft() [1/2]

arma::cx_vec sp::FFTW::fft ( arma::vec &  x)
inline

FFT of real input.

Returns
Complex FFT of length N
Parameters
xReal input data

Definition at line 188 of file fftw.h.

References fft(), and N.

Here is the call graph for this function:

◆ fft() [2/2]

void sp::FFTW::fft ( arma::vec &  x,
arma::cx_vec &  Pxx 
)
inline

FFT of real input.

Parameters
xInput data
[out]PxxVector to hold complex FFT of length N
Examples
fftw_loop.cpp.

Definition at line 162 of file fftw.h.

References alg, err_handler, N, and pl_fft.

Referenced by fft(), and main().

◆ fft2() [1/2]

arma::cx_mat sp::FFTW::fft2 ( arma::mat &  x)
inline

FFT of real 2D input.

Returns
Complex FFT of size [RxC]
Parameters
xReal input matrix

Definition at line 275 of file fftw.h.

References C, fft2(), and R.

Here is the call graph for this function:

◆ fft2() [2/2]

void sp::FFTW::fft2 ( arma::mat &  x,
arma::cx_mat &  Pxx 
)
inline

FFT of real 2D input.

Parameters
xInput data matrix
[out]PxxMatrix to hold complex FFT of length [RxC]
Examples
fftw_wisdom.cpp, and image.cpp.

Definition at line 233 of file fftw.h.

References alg, C, err_handler, pl_fft, and R.

Referenced by fft2(), and main().

◆ fft_cx() [1/2]

arma::cx_vec sp::FFTW::fft_cx ( arma::cx_vec &  x)
inline

FFT of complex input.

Returns
Complex FFT of length N
Parameters
xComplex input data

Definition at line 117 of file fftw.h.

References fft_cx(), and N.

Here is the call graph for this function:

◆ fft_cx() [2/2]

void sp::FFTW::fft_cx ( arma::cx_vec &  x,
arma::cx_vec &  Pxx 
)
inline

FFT of complex input.

Parameters
xComplex input data
[out]PxxVector to hold complex FFT of length N

Definition at line 97 of file fftw.h.

References alg, err_handler, N, and pl_fft_cx.

Referenced by fft_cx().

◆ ifft() [1/2]

arma::vec sp::FFTW::ifft ( arma::cx_vec &  Pxx)
inline

Inverse FFT.

Returns
Real data vector of length N
Parameters
PxxComplex FFT

Definition at line 221 of file fftw.h.

References ifft(), and N.

Here is the call graph for this function:

◆ ifft() [2/2]

void sp::FFTW::ifft ( arma::cx_vec &  Pxx,
arma::vec &  x 
)
inline

Inverse FFT.

Parameters
PxxComplex FFT
[out]xVector to hold real data of length N

Definition at line 200 of file fftw.h.

References alg, err_handler, N, and pl_ifft.

Referenced by ifft().

◆ ifft2() [1/2]

arma::mat sp::FFTW::ifft2 ( arma::cx_mat &  Pxx)
inline

Inverse FFT.

Returns
Real data vector of length N
Parameters
PxxComplex FFT

Definition at line 320 of file fftw.h.

References C, ifft2(), and R.

Here is the call graph for this function:

◆ ifft2() [2/2]

void sp::FFTW::ifft2 ( arma::cx_mat &  Pxx,
arma::mat &  x 
)
inline

Inverse 2D FFT.

Parameters
PxxComplex FFT
[out]xMatrix to hold real data of size[RxC]

Definition at line 287 of file fftw.h.

References alg, C, err_handler, pl_ifft, and R.

Referenced by ifft2().

◆ ifft_cx() [1/2]

arma::cx_vec sp::FFTW::ifft_cx ( arma::cx_vec &  Pxx)
inline

Inverse FFT.

Returns
Complex data vector of length N
Parameters
PxxComplex FFT

Definition at line 150 of file fftw.h.

References ifft_cx(), and N.

Here is the call graph for this function:

◆ ifft_cx() [2/2]

void sp::FFTW::ifft_cx ( arma::cx_vec &  Pxx,
arma::cx_vec &  x 
)
inline

Inverse FFT.

Parameters
PxxComplex FFT
[out]xVector to hold complex data of length N

Definition at line 129 of file fftw.h.

References alg, err_handler, N, and pl_ifft_cx.

Referenced by ifft_cx().

◆ import_wisdom_file()

void sp::FFTW::import_wisdom_file ( const std::string  fname)
inline

Import wisdom from file.

Parameters
fnameFile name

Definition at line 342 of file fftw.h.

References err_handler.

◆ import_wisdom_string()

void sp::FFTW::import_wisdom_string ( const std::string  wisd)
inline

Import wisdom from string.

Parameters
wisdWisdom string
Examples
fftw_wisdom.cpp.

Definition at line 331 of file fftw.h.

References err_handler.

Referenced by main().

Member Data Documentation

◆ alg

int sp::FFTW::alg
private

plans](http://fftw.org/fftw3_doc/Planner-Flags.html#Planner-Flags)

One of FFTW_ESTIMATE, FFTW_MEASURE, FFTW_PATIENT, FFTW_EXHAUSTIVE, FFTW_WISDOM_ONLY see [FFTW

Definition at line 34 of file fftw.h.

Referenced by fft(), fft2(), fft_cx(), FFTW(), FFTW(), ifft(), ifft2(), and ifft_cx().

◆ C

unsigned int sp::FFTW::C
private

◆ export_alg

int sp::FFTW::export_alg
private

Alg used for exporting wisdom.

Definition at line 37 of file fftw.h.

Referenced by export_wisdom_fft(), export_wisdom_fft_cx(), export_wisdom_ifft(), export_wisdom_ifft_cx(), FFTW(), and FFTW().

◆ N

unsigned int sp::FFTW::N
private

◆ pl_fft

fftw_plan sp::FFTW::pl_fft
private

Real FFTW plan.

Definition at line 28 of file fftw.h.

Referenced by fft(), fft2(), FFTW(), FFTW(), and ~FFTW().

◆ pl_fft_cx

fftw_plan sp::FFTW::pl_fft_cx
private

Complex FFTW plan.

Definition at line 30 of file fftw.h.

Referenced by fft_cx(), FFTW(), FFTW(), and ~FFTW().

◆ pl_ifft

fftw_plan sp::FFTW::pl_ifft
private

Real IFFTW plan.

Definition at line 29 of file fftw.h.

Referenced by FFTW(), FFTW(), ifft(), ifft2(), and ~FFTW().

◆ pl_ifft_cx

fftw_plan sp::FFTW::pl_ifft_cx
private

Complex IFFTW plan.

Definition at line 31 of file fftw.h.

Referenced by FFTW(), FFTW(), ifft_cx(), and ~FFTW().

◆ R

unsigned int sp::FFTW::R
private

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