libwt
1.0.0
A C++ library for the continous wavelet transform.
|
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... | |
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 , not including the costs of computing the FFTs of the kernels.
Using the overlap-add method, the costs are , which results into a benifit if .
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.
|
virtual |
Destructor.
|
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.
|
inline |
Returns the length of the kernels.
|
inline |
Returns the number of kernels.
|
inline |
Sets the sub-sampling assinged to the convolution operation.
|
inline |
Returns the sub-sampling assinged to the convolution operation.
|
protected |
The number of kernels.
|
protected |
Holds the Fourier transformed of the kernels.
|
protected |
Second halfs of the back-transformed, filtered singals.
|
protected |
The lenght of the kernels.
|
protected |
Working vector for the forward-transform of an piece of the input signal.
|
protected |
Backward transformation.
|
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.
|
protected |
Working memory for backward transformation of filtered signals.