RTXI  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
autometh.cpp
Go to the documentation of this file.
1 //
2 // File = autometh.cpp
3 //
4 
5 #include <fstream>
6 #include <stdlib.h>
7 #include <iostream>
8 
9 #include "autometh.h"
10 #include "complex.h"
11 #include "overload.h"
12 
13 template <class T>
14 AutocorrMethCorrMtx<T>::AutocorrMethCorrMtx(T* signal, int seq_len, int max_lag)
15 {
16  int j, k;
17  T sum;
18  double denom;
19  int mode = 0;
20 
21  this->Herm_Toep_Col_1 = new T[max_lag + 1];
22  this->Num_Rows = max_lag + 1;
23  this->Num_Cols = max_lag + 1;
24  denom = double(seq_len);
25 
26  for (k = 0; k <= max_lag; k++) {
27  sum = 0.0;
28 
29  for (j = 0; j < (seq_len - k); j++) {
30  sum += signal[j + k] * conj(signal[j]);
31  }
32  // if(mode == ACF_MODE_UNBIASED)
33  if (mode == 0)
34  denom = double(seq_len);
35  this->Herm_Toep_Col_1[k] = sum / denom;
36  }
37  return;
38 }
39 template <class T>
41 {
42  delete[] this->Herm_Toep_Col_1;
43 }
44 
45 template class AutocorrMethCorrMtx<double>;
46 template class AutocorrMethCorrMtx<complex>;
complex conj(const complex _z)
Definition: complex.h:108
AutocorrMethCorrMtx(T *signal, int seq_len, int max_lag)
Definition: autometh.cpp:14