libwt  1.0.0
A C++ library for the continous wavelet transform.
Public Member Functions | Protected Attributes | List of all members
wt::Convolution Class Reference

Implements the overlap-add covolution[3] of a signal with several filter kernels of the same size, each being shorter that the signal. More...

#include <convolution.hh>

Public Member Functions

 Convolution (const CMatrix &kernels, size_t subSample=1)
 Constructor. More...
 
virtual ~Convolution ()
 Destructor. More...
 
template<class iDerived , class oDerived >
void apply (const Eigen::DenseBase< iDerived > &signal, Eigen::DenseBase< oDerived > &out)
 Performs the convolution of the signal passed by signal with the kernels passed to the constructor. More...
 
size_t kernelLength () const
 Returns the length of the kernels. More...
 
size_t numKernels () const
 Returns the number of kernels. More...
 
size_t subSampling () const
 Returns the sub-sampling assinged to the convolution operation. More...
 
void setSubSampling (size_t subSample)
 Sets the sub-sampling assinged to the convolution operation. More...
 

Protected Attributes

size_t _K
 The number of kernels. More...
 
size_t _M
 The lenght of the kernels. More...
 
CMatrix _kernelF
 Holds the Fourier transformed of the kernels. More...
 
CVector _part
 Working vector for the forward-transform of an piece of the input signal. More...
 
FFT _fwd
 The in-place FFT transform of a (zero-padded) signal part. More...
 
CMatrix _lastRes
 Second halfs of the back-transformed, filtered singals. More...
 
CMatrix _work
 Working memory for backward transformation of filtered signals. More...
 
FFT _rev
 Backward transformation. More...
 
size_t _subSampling
 Possible subsampling for the kernels. More...
 

Detailed Description

Implements the overlap-add covolution[3] of a signal with several filter kernels of the same size, each being shorter that the signal.

As all kernels share the same size, hence the forward FFT of a piece of the input signal must be computed only once. This speeds up the convolution slightly. Further, assuming K kernels of size M and a signal length of N samples. The direct FFT convolution cost would be $(K+1)\,N\,\log(N)$, not including the costs of computing the FFTs of the kernels.

Using the overlap-add method, the costs are $(K+1)\,N\,\log(2\,M)$, which results into a benifit if $2\,M < N$.

Constructor & Destructor Documentation

Convolution::Convolution ( const CMatrix &  kernels,
size_t  subSample = 1 
)

Constructor.

The complex matrix kernels specifies the convolution filters to be used. Every colum specifies a filter kernel.

Convolution::~Convolution ( )
virtual

Destructor.

Member Function Documentation

template<class iDerived , class oDerived >
void wt::Convolution::apply ( const Eigen::DenseBase< iDerived > &  signal,
Eigen::DenseBase< oDerived > &  out 
)
inline

Performs the convolution of the signal passed by signal with the kernels passed to the constructor.

The results are stored in the columns of the array out. Hence, given a signal with N samples and K kernels, the output must be pre-allocated as a NxK array/matrix.

size_t wt::Convolution::kernelLength ( ) const
inline

Returns the length of the kernels.

size_t wt::Convolution::numKernels ( ) const
inline

Returns the number of kernels.

void wt::Convolution::setSubSampling ( size_t  subSample)
inline

Sets the sub-sampling assinged to the convolution operation.

size_t wt::Convolution::subSampling ( ) const
inline

Returns the sub-sampling assinged to the convolution operation.

Member Data Documentation

FFT wt::Convolution::_fwd
protected

The in-place FFT transform of a (zero-padded) signal part.

size_t wt::Convolution::_K
protected

The number of kernels.

CMatrix wt::Convolution::_kernelF
protected

Holds the Fourier transformed of the kernels.

CMatrix wt::Convolution::_lastRes
protected

Second halfs of the back-transformed, filtered singals.

size_t wt::Convolution::_M
protected

The lenght of the kernels.

CVector wt::Convolution::_part
protected

Working vector for the forward-transform of an piece of the input signal.

FFT wt::Convolution::_rev
protected

Backward transformation.

size_t wt::Convolution::_subSampling
protected

Possible subsampling for the kernels.

This property of the convolution is not computed or handled by the convolution itself, instead it is a property that can be assigned to it. I.e. kind of meta-data for the convolution operation.

CMatrix wt::Convolution::_work
protected

Working memory for backward transformation of filtered signals.


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