BornAgain
1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Convolution of two real vectors (in 1D or 2D) using Fast Fourier Transform. More...
Public Types | |
enum | EConvolutionMode { FFTW_LINEAR_FULL , FFTW_LINEAR_SAME_UNPADDED , FFTW_LINEAR_SAME , FFTW_LINEAR_VALID , FFTW_CIRCULAR_SAME , FFTW_CIRCULAR_SAME_SHIFTED , FFTW_UNDEFINED } |
convolution modes use LINEAR_SAME or CIRCULAR_SAME_SHIFTED for maximum performance | |
typedef std::vector< double > | double1d_t |
definition of 1d vector of double | |
typedef std::vector< double1d_t > | double2d_t |
definition of 2d vector of double | |
Public Member Functions | |
void | fftconvolve (const double1d_t &source, const double1d_t &kernel, double1d_t &result) |
convolution in 1D | |
void | fftconvolve (const double2d_t &source, const double2d_t &kernel, double2d_t &result) |
convolution in 2D | |
void | init (int h_src, int w_src, int h_kernel, int w_kernel) |
prepare arrays for 2D convolution of given vectors | |
void | setMode (EConvolutionMode mode) |
Sets convolution mode. | |
Convolution of two real vectors (in 1D or 2D) using Fast Fourier Transform.
Usage: std::vector<double> signal, kernel, result; Convolve cv; cv.fftconvolve(signal, kernel, result)
Given code rely on code from Jeremy Fix page, http://jeremy.fix.free.fr/spip.php?article15, see also "Efficient convolution using the Fast Fourier Transform, Application in C++" by Jeremy Fix, May 30, 2011
Definition at line 33 of file Convolve.h.