Engauge Digitizer 2
Loading...
Searching...
No Matches
FittingStatistics.h
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2016 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 FITTING_STATISTICS_H
8#define FITTING_STATISTICS_H
9
12#include <QVector>
13
14const int MAX_POLYNOMIAL_ORDER = 9; // Check execution time if this is increased from, say, 6 or 7
15
16class Matrix;
17
20{
21 // For unit testing
22 friend class TestFitting;
23
24public:
27 virtual ~FittingStatistics ();
28
39 void calculateCurveFitAndStatistics (unsigned int order,
42 double &mse,
43 double &rms,
44 double &rSquared,
45 int significantDigits);
46
47private:
48
49 void calculateCurveFit (int orderReduced,
52 int significantDigits);
53 bool calculateCurveFitReducedFurther (int orderReducedFurther,
55 int significantDigits,
56 QVector<double> &a) const;
57 void calculateStatistics (const FittingPointsConvenient &pointsConvenient,
59 double &mse,
60 double &rms,
61 double &rSquared);
62 void loadXAndYArrays (int orderReduced,
64 Matrix &X,
65 QVector<double> &Y) const;
66 double yFromXAndCoefficients (const FittingCurveCoefficients &coefficients,
67 double x) const;
68};
69
70#endif // FITTING_STATISTICS_H
const int INNER_RADIUS_MIN
QVector< double > FittingCurveCoefficients
Coefficients x0, x1, ... in y = a0 + a1 * x + a2 * x^2 + ...
QList< QPointF > FittingPointsConvenient
Array of (x,y) points in graph coordinates.
const int MAX_POLYNOMIAL_ORDER
This class does the math to compute statistics for FittingWindow.
FittingStatistics()
Single constructor.
void calculateCurveFitAndStatistics(unsigned int order, const FittingPointsConvenient &pointsConvenient, FittingCurveCoefficients &coefficients, double &mse, double &rms, double &rSquared, int significantDigits)
Compute the curve fit and the statistics for that curve fit.
Matrix class that supports arbitrary NxN size.
Definition Matrix.h:21
Unit test of Fitting classes.
Definition TestFitting.h:8