itpp::Freq_Filt< Num_T > Class Template Reference
Signal Processing (SP) Module » Filtering

Freq_Filt Frequency domain filtering using the overlap-add technique. 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);
itpp::Array
General array class.
Definition array.h:105

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

## Freq_Filt() [1/2]

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.

## Freq_Filt() [2/2]

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());
itpp::Freq_Filt
Freq_Filt Frequency domain filtering using the overlap-add technique.
Definition freq_filt.h:113

Definition at line 134 of file freq_filt.h.

## ~Freq_Filt()

template<class Num_T >

itpp::Freq_Filt< Num_T >::~Freq_Filt | ( |  | ) |

inline

Destructor.

Definition at line 154 of file freq_filt.h.

## Member Function Documentation

## filter()

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::Array< T >::concat, itpp::Array< T >::length(), and itpp::Array< T >::set_size().

## get_fft_size()

template<class Num_T >

int itpp::Freq_Filt< Num_T >::get_fft_size | ( |  | ) |

inline

Return FFT size.

Definition at line 148 of file freq_filt.h.

## get_blk_size()

template<class Num_T >

int itpp::Freq_Filt< Num_T >::get_blk_size | ( |  | ) |

inline

Return the data block size.

Definition at line 151 of file freq_filt.h.

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

- itpp/signal/freq_filt.h

Generated on Mon Jun 10 2024 11:49:35 for IT++ by Doxygen 1.9.8