36 #ifndef TF_CORRELATE_H_VERSION 38 #define TF_CORRELATE_H_VERSION \ 39 "TF_CORRELATE_H V1.0 " 41 #include<aff/series.h> 75 aff::Series<T>
correlate(
const aff::ConstSeries<T>& a,
76 const aff::ConstSeries<T>& b)
78 aff::Series<T> retval(b.first()-a.last(),b.last()-a.first());
79 for (
long int k=retval.first(); k<=retval.last(); ++k)
82 long int lmin=a.first() > (b.first()-k) ? a.first() : (b.first()-k);
83 long int lmax=a.last() < (b.last()-k) ? a.last() : (b.last()-k);
84 for(
long int l=lmin; l<=lmax; ++l)
86 retval(k)+=a(l)*b(l+k);
94 #endif // TF_CORRELATE_H_VERSION (includeguard) All stuff in this library will be placed within namespace ts.
aff::Series< T > correlate(const aff::ConstSeries< T > &a, const aff::ConstSeries< T > &b)
Calculate crosscorrelation of two series.