36 #ifndef TF_CONVOLVE_H_VERSION 38 #define TF_CONVOLVE_H_VERSION \ 41 #include<aff/series.h> 103 aff::Series<T>
convolve(
const aff::ConstSeries<T>& a,
104 const aff::ConstSeries<T>& b)
106 aff::Series<T> retval(a.first()+b.first(),b.last()+a.last());
107 for (
long int k=retval.first(); k<=retval.last(); ++k)
110 long int lmin=a.first() > (k-b.last()) ? a.first() : (k-b.last());
111 long int lmax=a.last() < (k-b.first()) ? a.last() : (k-b.first());
112 for(
long int l=lmin; l<=lmax; ++l)
114 retval(k)+=a(l)*b(k-l);
122 #endif // TF_CONVOLVE_H_VERSION (includeguard) aff::Series< T > convolve(const aff::ConstSeries< T > &a, const aff::ConstSeries< T > &b)
Calculate convolution of two series.
All stuff in this library will be placed within namespace ts.