Engauge Digitizer 2
Loading...
Searching...
No Matches
Correlation.h
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
7#ifndef CORRELATION_H
8#define CORRELATION_H
9
10#include "fftw3.h"
11
15{
16public:
18 Correlation(int N);
20
23 void correlateWithShift (int N,
24 const double function1 [],
25 const double function2 [],
26 int &binStartMax,
27 double &corrMax,
28 double correlations []) const;
29
32 void correlateWithoutShift (int N,
33 const double function1 [],
34 const double function2 [],
35 double &corrMax) const;
36
37private:
39
40 int m_N;
41
42 fftw_complex *m_signalA;
43 fftw_complex *m_signalB;
44 fftw_complex *m_outShifted;
45 fftw_complex *m_outA;
46 fftw_complex *m_outB;
47 fftw_complex *m_out;
48
49 fftw_plan m_planA;
50 fftw_plan m_planB;
51 fftw_plan m_planX;
52};
53
54#endif // CORRELATION_H
void correlateWithoutShift(int N, const double function1[], const double function2[], double &corrMax) const
Return the correlation of the two functions, without any shift.
Correlation(int N)
Single constructor. Slow memory allocations are done once and then reused repeatedly.
void correlateWithShift(int N, const double function1[], const double function2[], int &binStartMax, double &corrMax, double correlations[]) const
Return the shift in function1 that best aligns that function with function2.