Engauge Digitizer  2
Correlation.h
1 #ifndef CORRELATION_H
2 #define CORRELATION_H
3 
4 #include "fftw3.h"
5 
8 {
9 public:
11  Correlation(int N);
12  ~Correlation();
13 
16  void correlateWithShift (int N,
17  const double function1 [],
18  const double function2 [],
19  int &binStartMax,
20  double &corrMax) const;
21 
24  void correlateWithoutShift (int N,
25  const double function1 [],
26  const double function2 [],
27  double &corrMax) const;
28 
29 private:
30  Correlation();
31 
32  int m_N;
33 
34  fftw_complex *m_signalA;
35  fftw_complex *m_signalB;
36  fftw_complex *m_outShifted;
37  fftw_complex *m_outA;
38  fftw_complex *m_outB;
39  fftw_complex *m_out;
40 
41  fftw_plan m_planA;
42  fftw_plan m_planB;
43  fftw_plan m_planX;
44 };
45 
46 #endif // CORRELATION_H
Fast cross correlation between two functions.
Definition: Correlation.h:7
void correlateWithShift(int N, const double function1[], const double function2[], int &binStartMax, double &corrMax) const
Return the shift in function1 that best aligns that function with function2.
Definition: Correlation.cpp:39
void correlateWithoutShift(int N, const double function1[], const double function2[], double &corrMax) const
Return the correlation of the two functions, without any shift.