Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
kissfft< scalar_t > Class Template Reference

#include <kissfft.hh>

Public Types

typedef std::complex< scalar_t > cpx_t
 

Public Member Functions

void assign (const std::size_t nfft, const bool inverse)
 
 kissfft (const std::size_t nfft, const bool inverse)
 
void transform (const cpx_t *fft_in, cpx_t *fft_out, const std::size_t stage=0, const std::size_t fstride=1, const std::size_t in_stride=1) const
 
void transform_real (const scalar_t *const src, cpx_t *const dst) const
 

Private Member Functions

void kf_bfly2 (cpx_t *Fout, const size_t fstride, const std::size_t m) const
 
void kf_bfly3 (cpx_t *Fout, const std::size_t fstride, const std::size_t m) const
 
void kf_bfly4 (cpx_t *const Fout, const std::size_t fstride, const std::size_t m) const
 
void kf_bfly5 (cpx_t *const Fout, const std::size_t fstride, const std::size_t m) const
 
void kf_bfly_generic (cpx_t *const Fout, const size_t fstride, const std::size_t m, const std::size_t p) const
 

Private Attributes

bool _inverse
 
std::size_t _nfft
 
std::vector< cpx_t_scratchbuf
 
std::vector< std::size_t > _stageRadix
 
std::vector< std::size_t > _stageRemainder
 
std::vector< cpx_t_twiddles
 

Detailed Description

template<typename scalar_t>
class kissfft< scalar_t >

Definition at line 17 of file kissfft.hh.

Member Typedef Documentation

◆ cpx_t

template<typename scalar_t >
typedef std::complex<scalar_t> kissfft< scalar_t >::cpx_t

Definition at line 21 of file kissfft.hh.

Constructor & Destructor Documentation

◆ kissfft()

template<typename scalar_t >
kissfft< scalar_t >::kissfft ( const std::size_t  nfft,
const bool  inverse 
)
inline

Definition at line 23 of file kissfft.hh.

Member Function Documentation

◆ assign()

template<typename scalar_t >
void kissfft< scalar_t >::assign ( const std::size_t  nfft,
const bool  inverse 
)
inline

Changes the FFT-length and/or the transform direction.

Postcondition
The kissfft object will be in the same state as if it had been newly constructed with the passed arguments. However, the implementation may be faster than constructing a new fft object.

Definition at line 61 of file kissfft.hh.

◆ kf_bfly2()

template<typename scalar_t >
void kissfft< scalar_t >::kf_bfly2 ( cpx_t Fout,
const size_t  fstride,
const std::size_t  m 
) const
inlineprivate

Definition at line 193 of file kissfft.hh.

◆ kf_bfly3()

template<typename scalar_t >
void kissfft< scalar_t >::kf_bfly3 ( cpx_t Fout,
const std::size_t  fstride,
const std::size_t  m 
) const
inlineprivate

Definition at line 202 of file kissfft.hh.

◆ kf_bfly4()

template<typename scalar_t >
void kissfft< scalar_t >::kf_bfly4 ( cpx_t *const  Fout,
const std::size_t  fstride,
const std::size_t  m 
) const
inlineprivate

Definition at line 233 of file kissfft.hh.

◆ kf_bfly5()

template<typename scalar_t >
void kissfft< scalar_t >::kf_bfly5 ( cpx_t *const  Fout,
const std::size_t  fstride,
const std::size_t  m 
) const
inlineprivate

Definition at line 256 of file kissfft.hh.

◆ kf_bfly_generic()

template<typename scalar_t >
void kissfft< scalar_t >::kf_bfly_generic ( cpx_t *const  Fout,
const size_t  fstride,
const std::size_t  m,
const std::size_t  p 
) const
inlineprivate

Definition at line 321 of file kissfft.hh.

◆ transform()

template<typename scalar_t >
void kissfft< scalar_t >::transform ( const cpx_t fft_in,
cpx_t fft_out,
const std::size_t  stage = 0,
const std::size_t  fstride = 1,
const std::size_t  in_stride = 1 
) const
inline

Calculates the complex Discrete Fourier Transform.

The size of the passed arrays must be passed in the constructor. The sum of the squares of the absolute values in the dst array will be N times the sum of the squares of the absolute values in the src array, where N is the size of the array. In other words, the l_2 norm of the resulting array will be sqrt(N) times as big as the l_2 norm of the input array. This is also the case when the inverse flag is set in the constructor. Hence when applying the same transform twice, but with the inverse flag changed the second time, then the result will be equal to the original input times N.

Definition at line 90 of file kissfft.hh.

◆ transform_real()

template<typename scalar_t >
void kissfft< scalar_t >::transform_real ( const scalar_t *const  src,
cpx_t *const  dst 
) const
inline

Calculates the Discrete Fourier Transform (DFT) of a real input of size 2*N.

The 0-th and N-th value of the DFT are real numbers. These are stored in dst[0].real() and dst[0].imag() respectively. The remaining DFT values up to the index N-1 are stored in dst[1] to dst[N-1]. The other half of the DFT values can be calculated from the symmetry relation

DFT(src)[2*N-k] == conj( DFT(src)[k] );

The same scaling factors as in transform() apply.

Note
For this to work, the types scalar_t and cpx_t must fulfill the following requirements:

For any object z of type cpx_t, reinterpret_cast<scalar_t(&)[2]>(z)[0] is the real part of z and reinterpret_cast<scalar_t(&)[2]>(z)[1] is the imaginary part of z. For any pointer to an element of an array of cpx_t named p and any valid array index i, reinterpret_cast<T*>(p)[2*i] is the real part of the complex number p[i], and reinterpret_cast<T*>(p)[2*i+1] is the imaginary part of the complex number p[i].

Since C++11, these requirements are guaranteed to be satisfied for scalar_ts being float, double or long double together with cpx_t being std::complex<scalar_t>.

Definition at line 154 of file kissfft.hh.

Member Data Documentation

◆ _inverse

template<typename scalar_t >
bool kissfft< scalar_t >::_inverse
private

Definition at line 355 of file kissfft.hh.

◆ _nfft

template<typename scalar_t >
std::size_t kissfft< scalar_t >::_nfft
private

Definition at line 354 of file kissfft.hh.

◆ _scratchbuf

template<typename scalar_t >
std::vector<cpx_t> kissfft< scalar_t >::_scratchbuf
mutableprivate

Definition at line 359 of file kissfft.hh.

◆ _stageRadix

template<typename scalar_t >
std::vector<std::size_t> kissfft< scalar_t >::_stageRadix
private

Definition at line 357 of file kissfft.hh.

◆ _stageRemainder

template<typename scalar_t >
std::vector<std::size_t> kissfft< scalar_t >::_stageRemainder
private

Definition at line 358 of file kissfft.hh.

◆ _twiddles

template<typename scalar_t >
std::vector<cpx_t> kissfft< scalar_t >::_twiddles
private

Definition at line 356 of file kissfft.hh.


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


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:50