IT++ Logo
Public Member Functions | List of all members
itpp::Freq_Filt< Num_T > Class Template Reference

Freq_Filt Frequency domain filtering using the overlap-add techniqueThe Freq_Filt class implements an FFT based filter using the overlap-add technique. The data is filtered by first transforming the input sequence into the frequency domain with an efficient FFT implementation (i.e. FFTW) and then multiplied with a Fourier transformed version of the impulse response. The resulting data is then inversed Fourier transformed to return a filtered time domain signal. More...

#include <itpp/signal/freq_filt.h>

Public Member Functions

 Freq_Filt ()
 Constructor.
 
 Freq_Filt (const Vec< Num_T > &b, const int xlength)
 Constructor with initialization of the impulse response b.
 
Vec< Num_T > filter (const Vec< Num_T > &x, const int strm=0)
 Filter data in the input vector x.
 
int get_fft_size ()
 Return FFT size.
 
int get_blk_size ()
 Return the data block size.
 
 ~Freq_Filt ()
 Destructor.
 

Detailed Description

template<class Num_T>
class itpp::Freq_Filt< Num_T >

Freq_Filt Frequency domain filtering using the overlap-add technique

The Freq_Filt class implements an FFT based filter using the overlap-add technique. The data is filtered by first transforming the input sequence into the frequency domain with an efficient FFT implementation (i.e. FFTW) and then multiplied with a Fourier transformed version of the impulse response. The resulting data is then inversed Fourier transformed to return a filtered time domain signal.

Freq_Filt is a templated class. The template paramter Num_T defines the data type for the impulse response b, input data x and output data y.

The class constructor chooses an optimal FFT length and data block size that minimizes execution time.

For example,

vec b = "1 2 3 4";
Freq_Filt<double> FF(b,8000);

where 8000 corresponds to the expected vector length of the data to be filtered. The actual number of elements does not have to be exact, but it should be close.

Here is a complete example:

vec b = "1 2 3 4";
vec x(20);
x(0) = 1;
// Define a filter object for doubles
Freq_Filt<double> FF(b,x.length());
// Filter the data
vec y = FF.filter(x);
// Check the FFT and block sizes that were used
int fftsize = FF.getFFTSize();
int blk = FF.getBlkSize();

To facilitate large data sets the Freq_Filt class has a streaming option. In this mode of operation data history is internally stored. This allows the class to be used for large data sets that are read from disk or streamed in real-time.

bool stream = true;
vec b = "1 2 3 4";
Freq_Filt<double> FF(b,1000);
vec x,y;
while(!EOF) {
x = "read buffer of data";
y = FF.filter(x,stream);
cout << << endl;
}

Definition at line 112 of file freq_filt.h.

Constructor & Destructor Documentation

template<class Num_T >
itpp::Freq_Filt< Num_T >::Freq_Filt ( )
inline

Constructor.

The empty constructor makes it possible to have other container objects of the Freq_Filt class

Definition at line 121 of file freq_filt.h.

template<class Num_T >
itpp::Freq_Filt< Num_T >::Freq_Filt ( const Vec< Num_T > &  b,
const int  xlength 
)
inline

Constructor with initialization of the impulse response b.

Create a filter object with impulse response b. The FFT size and data block size are also initialized.

vec b = "1 2 3 4";
vec x(20);
Freq_Filt FF(b,x.length());

Definition at line 134 of file freq_filt.h.

Member Function Documentation

template<class Num_T >
Vec< Num_T > itpp::Freq_Filt< Num_T >::filter ( const Vec< Num_T > &  x,
const int  strm = 0 
)

Filter data in the input vector x.

Filters data in batch mode or streaming mode

FF.filter(x); // Filters data in batch mode
FF.filter(x,1); // Filters data in streaming mode

Definition at line 230 of file freq_filt.h.

References itpp::concat(), itpp::Vec< Num_T >::length(), itpp::Vec< Num_T >::set_size(), and itpp::Vec< Num_T >::zeros().


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

Generated on Sat Jul 6 2013 10:54:34 for IT++ by Doxygen 1.8.2