PCL
pcl::GenericRealFFT< T > Class Template Reference

Generic fast Fourier transform of real data. More...

#include <FFT1D.h>

+ Inheritance diagram for pcl::GenericRealFFT< T >:

Public Types

using base = AbstractFFT< T >
 
using complex = typename base::complex
 
using complex_vector = typename base::complex_vector
 
using scalar = typename base::scalar
 
using transform = typename base::transform
 
using vector = typename base::vector
 
- Public Types inherited from pcl::AbstractFFT< T >
using complex = Complex< T >
 
using complex_vector = GenericVector< complex >
 
using scalar = T
 
using transform = complex_vector
 
using vector = GenericVector< scalar >
 

Public Member Functions

 GenericRealFFT (int length)
 
 ~GenericRealFFT () override
 
GenericRealFFToperator() (complex *y, const scalar *x) const
 
GenericRealFFToperator() (scalar *y, const complex *x) const
 
GenericRealFFToperator<< (const scalar *x)
 
GenericRealFFToperator<< (const vector &x)
 
GenericRealFFToperator>> (scalar *y) const
 
GenericRealFFToperator>> (vector &y) const
 
- Public Member Functions inherited from pcl::AbstractFFT< T >
 AbstractFFT (int length)
 
virtual ~AbstractFFT ()
 
transformDFT ()
 
transform DFT () const
 
int Length () const
 
complexoperator* ()
 
const complexoperator* () const
 
virtual void Release ()
 

Static Public Member Functions

static int OptimizedLength (int n)
 

Detailed Description

template<typename T>
class pcl::GenericRealFFT< T >

The GenericRealFFT template class performs forward and inverse, out-of-place fast Fourier transforms of real-valued data. For real data in the time domain, this class performs nearly twice as fast as Fourier transform classes for complex data.

For fast Fourier transforms of complex-valued data, see the GenericFFT template class.

See also
AbstractFFT, GenericFFT

Definition at line 543 of file FFT1D.h.

Member Typedef Documentation

◆ base

template<typename T >
using pcl::GenericRealFFT< T >::base = AbstractFFT<T>

Identifies the base class of this FFT class.

Definition at line 550 of file FFT1D.h.

◆ complex

template<typename T >
using pcl::GenericRealFFT< T >::complex = typename base::complex

Represents a complex number in the context of this FFT class.

Definition at line 560 of file FFT1D.h.

◆ complex_vector

template<typename T >
using pcl::GenericRealFFT< T >::complex_vector = typename base::complex_vector

Represents a vector of complex numbers.

Definition at line 570 of file FFT1D.h.

◆ scalar

template<typename T >
using pcl::GenericRealFFT< T >::scalar = typename base::scalar

Represents a scalar in the context of this FFT class.

Definition at line 555 of file FFT1D.h.

◆ transform

template<typename T >
using pcl::GenericRealFFT< T >::transform = typename base::transform

Represents the container type used to store an out-of-place discrete Fourier transform.

Definition at line 576 of file FFT1D.h.

◆ vector

template<typename T >
using pcl::GenericRealFFT< T >::vector = typename base::vector

Represents a vector of real numbers.

Definition at line 565 of file FFT1D.h.

Constructor & Destructor Documentation

◆ GenericRealFFT()

template<typename T >
pcl::GenericRealFFT< T >::GenericRealFFT ( int  length)
inline

Constructs a GenericRealFFT object of the specified length.

The current PCL implementation supports FFTs for real data of any even length, but the underlying routines have been optimized for performance when the length of the input vector can be factorized as follows:

n = 2^n2 * 3^n3 * 4^n4 * 5^n5

where n2, n3, n4, and n5 are arbitrary positive integers, and n is an even integer. For best performance, you should call GenericRealFFT::OptimizedLength() to get the smallest optimal length for your real data, then place them on an array of the obtained length, padded with zeros.

Note
We stress the fact that the specified length must be an even integer.

Definition at line 596 of file FFT1D.h.

◆ ~GenericRealFFT()

template<typename T >
pcl::GenericRealFFT< T >::~GenericRealFFT ( )
inlineoverride

Destroys a GenericRealFFT object.

Definition at line 605 of file FFT1D.h.

Member Function Documentation

◆ operator()() [1/2]

template<typename T >
GenericRealFFT& pcl::GenericRealFFT< T >::operator() ( complex y,
const scalar x 
) const
inline

Performs the FFT of an input vector of real numbers, and stores the result in a caller-supplied output vector of complex values.

Parameters
[in]xInput vector. Must be the starting address of a contiguous sequence of at least Length() scalars.
[out]yOutput vector, where the result of the transform will be stored. Must be the starting address of a contiguous sequence of at least Length()/2 + 1 complex numbers.

The specified arguments x and y must be the starting addresses of two different, non-overlapping contiguous blocks of data. The output transform will be a sequence of Length()/2 + 1 complex numbers.

This member function does not change the current Fourier transform in this object, if any.

Returns a reference to this object.

Definition at line 704 of file FFT1D.h.

◆ operator()() [2/2]

template<typename T >
GenericRealFFT& pcl::GenericRealFFT< T >::operator() ( scalar y,
const complex x 
) const
inline

Performs the inverse FFT of an input vector of complex numbers, and stores the result in a caller-supplied output vector of real values.

Parameters
[in]xInput vector. Must be the starting address of a contiguous sequence of at least Length()/2 + 1 complex numbers, corresponding to a discrete real Fourier transform of length Length().
[out]yOutput vector, where the result of the inverse transform will be stored. Must be the starting address of a contiguous sequence of at least Length() real numbers.

The specified arguments x and y must be the starting addresses of two different, non-overlapping contiguous blocks of data. The input transform must be a sequence of Length()/2 + 1 complex numbers. The output inverse transform will be a sequence of Length() real numbers.

This member function does not change the current Fourier transform in this object, if any.

Returns a reference to this object.

Definition at line 735 of file FFT1D.h.

◆ operator<<() [1/2]

template<typename T >
GenericRealFFT& pcl::GenericRealFFT< T >::operator<< ( const scalar x)
inline

Fast Fourier transform. Performs the FFT of the specified vector of real numbers.

The argument x must be the starting address of a contiguous block of at least Length() scalars.

Returns a reference to this object.

Definition at line 618 of file FFT1D.h.

◆ operator<<() [2/2]

template<typename T >
GenericRealFFT& pcl::GenericRealFFT< T >::operator<< ( const vector x)
inline

Fast Fourier transform. Performs the FFT of a vector of real numbers.

The specified vector x must have at least Length() elements. Otherwise an Error exception will be thrown.

Returns a reference to this object.

Definition at line 658 of file FFT1D.h.

References pcl::GenericVector< T >::Length().

◆ operator>>() [1/2]

template<typename T >
GenericRealFFT& pcl::GenericRealFFT< T >::operator>> ( scalar y) const
inline

Inverse fast Fourier transform. Performs the inverse FFT and stores the result in the specified vector of real values.

The value of y must be the starting address of a contiguous block of at least Length() elements.

If no FFT has been performed for this object (by a previous call to operator <<()), this member function throws an Error exception.

Returns a reference to this object.

Definition at line 640 of file FFT1D.h.

◆ operator>>() [2/2]

template<typename T >
GenericRealFFT& pcl::GenericRealFFT< T >::operator>> ( vector y) const
inline

Inverse fast Fourier transform. Performs the inverse FFT and stores the result in the specified vector of real values.

The specified vector y must have at least Length() elements. Otherwise an Error exception will be thrown.

If no FFT has been performed on this object (by a previous call to operator <<()), this member function throws an Error exception.

Returns a reference to this object.

Definition at line 677 of file FFT1D.h.

References pcl::GenericVector< T >::Length().

◆ OptimizedLength()

template<typename T >
static int pcl::GenericRealFFT< T >::OptimizedLength ( int  n)
inlinestatic

Returns the optimized real FFT length larger than or equal to a given length n. The returned length will be optimal to perform a FFT of real data with the current PCL implementation. The optimized length can be used as the argument to the constructor of any FFT class for real data transforms.

Definition at line 750 of file FFT1D.h.


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