Class to compute Marquardt fitter.
More...
#include <MarquardtFitter.h>
|
| MarquardtFitter (std::vector< std::vector< double >> &apMatrix) |
| Base constructor for MarquardtFitter. More...
|
|
void | setData (const std::vector< double > &zvalues) |
| Set the values of the original data points that are going to be fit. More...
|
|
std::vector< double > | getParameters () |
| Obtain marquardt fitter current arguments/parameters. More...
|
|
void | setParameters (const std::vector< double > ¶meters) |
| Set the arguments/parameters for the fitter. More...
|
|
std::vector< std::vector< double > > | getMatrix (std::vector< std::vector< double >> &A, std::vector< int > &r, int j0, int j1) |
| Get a submatrix. More...
|
|
double | evaluate (const std::vector< double > &values, const std::vector< double > ¶ms) |
| Evaluate the marquardt fitter. More...
|
|
double | calculateErrors () |
| Compute the cumulative error for current values. More...
|
|
double | calculateDerivative (int k, std::vector< double > &values, std::vector< double > ¶ms) |
| Given a set of parameters, and inputs, calculates the derivative of the k'th parameter. More...
|
|
void | calculateDerivativeFast (double x, double c, double d, double coefficient, std::vector< double > &dvec) |
| Alternative method for faster derivative computation. More...
|
|
void | calculateDerivatives () |
| Compute matrix of partial derivatives. More...
|
|
void | calculateDerivativesFast () |
| Alternative method for faster computation of partial derivatives matrix. More...
|
|
void | createBetaMatrix () |
| Create the beta matrix.
|
|
void | createAlphaPrimeMatrix () |
| Create the alpha prime matrix.
|
|
void | iterateValues () |
| Iterate over values considering the current error and arguments/parameters and compute the changes.
|
|
void | initializeWorkspace () |
| Initializes the workspace for the Marquardt fitter.
|
|
void | fitData () |
| Iterate until fitting is finished.
|
|
void | updateLambda (double value) |
| Update lambda. More...
|
|
std::string | printMatrix () |
| Build a string representing the alpha prime matrix together with beta vector for debugging purposes. More...
|
|
std::string | printMatrix (std::vector< std::vector< double >> &matrix) |
| Build a string representing given matrix for debugging purposes. More...
|
|
|
std::vector< std::vector< double > > | X |
| X input vector.
|
|
std::vector< double > | Z |
| Z output vecctor.
|
|
std::vector< double > | A |
| A arguments vector.
|
|
size_t | alphaPrimeN = 0 |
| Alpha prime vector dimensionality.
|
|
std::vector< std::vector< double > > & | ALPHA_PRIME |
| Reference to alpha prime vector.
|
|
std::vector< std::vector< double > > | DERIVATIVES |
| Vector containing derivatives (jacobian vector)
|
|
std::vector< double > | BETA |
| Beta vector.
|
|
std::vector< double > | LAMBDA |
| Lambda vector.
|
|
std::vector< double > | ERR |
| Error vector.
|
|
double | DELTA = 1e-6 |
| Delta for numerical derivatives.
|
|
double | MINERROR = 1e-9 |
| Mnimum error for evaluating. It is no longer used and it might be removed in the future.
|
|
double | MINCHANGE = 1e-3 |
| Minimum change. It is no longer used and it might be removed in the future.
|
|
Class to compute Marquardt fitter.
◆ MarquardtFitter()
MarquardtFitter::MarquardtFitter |
( |
std::vector< std::vector< double >> & |
apMatrix | ) |
|
|
inlineexplicit |
Base constructor for MarquardtFitter.
- Parameters
-
apMatrix | Reference to the alpha prime matrix. It is passed this way to reduce the number of memory management operations, mainly due to using multiple marquardt fitters |
◆ calculateDerivative()
double MarquardtFitter::calculateDerivative |
( |
int |
k, |
|
|
std::vector< double > & |
values, |
|
|
std::vector< double > & |
params |
|
) |
| |
Given a set of parameters, and inputs, calculates the derivative of the k'th parameter.
\[ \frac{\partial{f}}{\partial{a_{k}}} \]
- Parameters
-
k | Index of the parameter that the derivative is being taken of |
params | Array that will be used to calculate derivatives, note params will be modified. |
x | Set of values to use. |
- Returns
- Computed derivative
- See also
- MarquardtFitter::calculateDerivativeFast( double, double, double, double, std::vector<double>&)
◆ calculateDerivativeFast()
void MarquardtFitter::calculateDerivativeFast |
( |
double |
x, |
|
|
double |
c, |
|
|
double |
d, |
|
|
double |
coefficient, |
|
|
std::vector< double > & |
dvec |
|
) |
| |
Alternative method for faster derivative computation.
- Parameters
-
| x | Input for the Marquardt fitter |
| c | Third argument (index 2) |
| d | Fourth argument (index 3) |
| coefficient | Coefficient calculated with respect to second argument (index 1) |
[out] | dvec | Vector of partial derivatives (where the output is stored) |
- See also
- MarquardtFitter::calculateDerivative(int, std::vector<double>&, std::vector<double>&)
◆ calculateDerivatives()
void MarquardtFitter::calculateDerivatives |
( |
| ) |
|
◆ calculateDerivativesFast()
void MarquardtFitter::calculateDerivativesFast |
( |
| ) |
|
Alternative method for faster computation of partial derivatives matrix.
- See also
- calculateDerivatives
◆ calculateErrors()
double MarquardtFitter::calculateErrors |
( |
| ) |
|
Compute the cumulative error for current values.
- Returns
- Cumulative error for current values
◆ evaluate()
double MarquardtFitter::evaluate |
( |
const std::vector< double > & |
values, |
|
|
const std::vector< double > & |
params |
|
) |
| |
Evaluate the marquardt fitter.
- Parameters
-
values | Values to evaluate over. At the moment values[0] is the only considered one. |
params | Arguments/parameters which define the evaluation |
- Returns
- Marquardt fitter evaluation
◆ getMatrix()
vector< vector< double > > MarquardtFitter::getMatrix |
( |
std::vector< std::vector< double >> & |
A, |
|
|
std::vector< int > & |
r, |
|
|
int |
j0, |
|
|
int |
j1 |
|
) |
| |
Get a submatrix.
- Parameters
-
A | Matrix where values are taken from |
r | Array of row indices |
j0 | Initial column index |
j1 | Final column index |
- Returns
◆ getParameters()
vector< double > MarquardtFitter::getParameters |
( |
| ) |
|
Obtain marquardt fitter current arguments/parameters.
- Returns
- Marquardt fitter current arguments/parameters
◆ printMatrix() [1/2]
string MarquardtFitter::printMatrix |
( |
| ) |
|
Build a string representing the alpha prime matrix together with beta vector for debugging purposes.
- Returns
- String representing the alpha prime matrix together with beta vector
◆ printMatrix() [2/2]
std::string MarquardtFitter::printMatrix |
( |
std::vector< std::vector< double >> & |
matrix | ) |
|
Build a string representing given matrix for debugging purposes.
- Parameters
-
matrix | Matrix to be debugged |
- Returns
- String representing given matrix
◆ setData()
void MarquardtFitter::setData |
( |
const std::vector< double > & |
zvalues | ) |
|
Set the values of the original data points that are going to be fit.
- Parameters
-
zvalues | Values of the original data points |
◆ setParameters()
void MarquardtFitter::setParameters |
( |
const std::vector< double > & |
parameters | ) |
|
Set the arguments/parameters for the fitter.
- Parameters
-
parameters | Parameters for the fitter |
◆ updateLambda()
void MarquardtFitter::updateLambda |
( |
double |
value | ) |
|
Update lambda.
When value is less than $0$, then lambda is multiplied by $10$. Otherwise it is multiplied by $0.1$.
- Parameters
-
The documentation for this class was generated from the following files: