Least squares polynomial fit. More...
#include <PolynomialFit.h>
Public Member Functions | |
| PolynomialFit (const std::vector< Real > &x, const std::vector< Real > &y, unsigned int order, bool truncate_order=false) | |
| virtual Real | sample (Real x) override |
| This function will take an independent variable input and will return the dependent variable based on the generated fit. | |
| virtual void | generate () |
| Generate the fit. | |
| unsigned int | getSampleSize () |
| Size of the array holding the points. | |
| const std::vector< Real > & | getCoefficients () |
| Const reference to the vector of coefficients of the least squares fit. | |
| void | setVariables (const std::vector< Real > &x, const std::vector< Real > &y) |
Protected Member Functions | |
| virtual void | fillMatrix () override |
| Helper function that creates the matrix necessary for the least squares algorithm. | |
| void | doLeastSquares () |
| Wrapper for the LAPACK dgels function. | |
Protected Attributes | |
| unsigned int | _order |
| Order of the polynomial. | |
| bool | _truncate_order |
| Flag to implement a truncated polynomial. | |
| std::vector< Real > | _x |
| Independent variable. | |
| std::vector< Real > | _y |
| Dependent variable. | |
| std::vector< Real > | _matrix |
| Basis functions evaluated at each independent variable (note: actually a vector) | |
| std::vector< Real > | _coeffs |
| Vector of coefficients of the least squares fit. | |
| unsigned int | _num_coeff |
| The number of coefficients. | |
Static Protected Attributes | |
| static int | _file_number = 0 |
| File number. | |
| PolynomialFit::PolynomialFit | ( | const std::vector< Real > & | x, |
| const std::vector< Real > & | y, | ||
| unsigned int | order, | ||
| bool | truncate_order = false |
||
| ) |
Definition at line 21 of file PolynomialFit.C.
|
protectedinherited |
Wrapper for the LAPACK dgels function.
Called by generate() to perform the least squares fit
Definition at line 45 of file LeastSquaresFitBase.C.
Referenced by LeastSquaresFitBase::generate().
|
overrideprotectedvirtual |
Helper function that creates the matrix necessary for the least squares algorithm.
Implements LeastSquaresFitBase.
Definition at line 41 of file PolynomialFit.C.
|
virtualinherited |
Generate the fit.
This function must be called prior to using sample. Note: If you pass a vector that contains duplicate independent measures the call to LAPACK will fail
Definition at line 34 of file LeastSquaresFitBase.C.
Referenced by LeastSquaresFit::execute(), and LeastSquaresFitHistory::execute().
|
inherited |
Const reference to the vector of coefficients of the least squares fit.
| return | vector of coefficients |
Definition at line 64 of file LeastSquaresFitBase.C.
Referenced by LeastSquaresFit::execute(), and LeastSquaresFitHistory::execute().
|
inherited |
Size of the array holding the points.
Definition at line 58 of file LeastSquaresFitBase.C.
|
overridevirtual |
This function will take an independent variable input and will return the dependent variable based on the generated fit.
| x | independent variable |
Implements LeastSquaresFitBase.
Definition at line 53 of file PolynomialFit.C.
Referenced by LeastSquaresFit::execute().
|
inherited |
Definition at line 27 of file LeastSquaresFitBase.C.
|
protectedinherited |
Vector of coefficients of the least squares fit.
Definition at line 79 of file LeastSquaresFitBase.h.
Referenced by LeastSquaresFitBase::doLeastSquares(), LeastSquaresFitBase::getCoefficients(), and sample().
|
staticprotected |
File number.
Definition at line 42 of file PolynomialFit.h.
|
protectedinherited |
Basis functions evaluated at each independent variable (note: actually a vector)
Definition at line 77 of file LeastSquaresFitBase.h.
Referenced by LeastSquaresFitBase::doLeastSquares(), and fillMatrix().
|
protectedinherited |
The number of coefficients.
Definition at line 81 of file LeastSquaresFitBase.h.
Referenced by LeastSquaresFitBase::doLeastSquares(), and PolynomialFit().
|
protected |
Order of the polynomial.
Definition at line 38 of file PolynomialFit.h.
Referenced by fillMatrix(), and PolynomialFit().
|
protected |
Flag to implement a truncated polynomial.
Definition at line 40 of file PolynomialFit.h.
Referenced by PolynomialFit().
|
protectedinherited |
Independent variable.
Definition at line 73 of file LeastSquaresFitBase.h.
Referenced by fillMatrix(), LeastSquaresFitBase::generate(), LeastSquaresFitBase::getSampleSize(), PolynomialFit(), and LeastSquaresFitBase::setVariables().
|
protectedinherited |
Dependent variable.
Definition at line 75 of file LeastSquaresFitBase.h.
Referenced by LeastSquaresFitBase::doLeastSquares(), and LeastSquaresFitBase::setVariables().