11#include "tnt/tnt_array2d.h"
103 int sparseRows = 0,
int sparseCols = 0,
bool jigsaw =
false);
105 void AddKnown(
const std::vector<double> &input,
double expected,
106 double weight = 1.0);
108 std::vector<double>
GetInput(
int row)
const;
118 double Evaluate(
const std::vector<double> &input);
121 void Weight(
int index,
double weight);
130 return p_expected.size();
138 std::vector<double>
GetEpsilons ()
const {
return p_epsilonsSparse; }
145 void SolveCholesky () {}
148 void FillSparseA(
const std::vector<double> &data);
149 bool ApplyParameterWeights();
152 std::vector<double> p_epsilonsSparse;
153 std::vector<double> p_parameterWeights;
155 arma::SpMat<double> p_sparseA;
156 arma::SpMat<double> p_normals;
158 arma::mat p_SLU_Factor;
164 int p_currentFillRow;
167 int p_constrainedParameters;
168 int p_degreesOfFreedom;
172 std::vector<std::vector<double> > p_input;
174 std::vector<double> p_expected;
176 std::vector<double> p_sqrtWeight;
179 std::vector<double> p_residuals;
Generic linear equation class.
Definition BasisFunction.h:48
Generic least square fitting class.
Definition LeastSquares.h:99
void SetNumberOfConstrainedParameters(int n)
Definition LeastSquares.h:140
double GetSigma0()
Definition LeastSquares.h:133
double GetExpected(int row) const
This method returns the expected value at the given row.
Definition LeastSquares.cpp:173
void Weight(int index, double weight)
Reset the weight for the ith known.
Definition LeastSquares.cpp:614
void SetParameterWeights(const std::vector< double > weights)
Definition LeastSquares.h:139
void Reset()
Definition LeastSquares.cpp:523
int GetDegreesOfFreedom()
Definition LeastSquares.h:134
double Residual(int i) const
Returns the ith residual.
Definition LeastSquares.cpp:590
int Rows() const
This methods returns the number of rows in the matrix.
Definition LeastSquares.cpp:187
~LeastSquares()
Destroys the LeastSquares object.
Definition LeastSquares.cpp:62
SolveMethod
Definition LeastSquares.h:112
@ SPARSE
Sparse.
Definition LeastSquares.h:114
@ QRD
QR Decomposition.
Definition LeastSquares.h:113
@ SVD
Singular Value Decomposition.
Definition LeastSquares.h:112
int Knowns() const
The number of knowns (or times AddKnown was invoked) linear combination of the variables.
Definition LeastSquares.h:129
double Evaluate(const std::vector< double > &input)
Invokes the BasisFunction Evaluate method.
Definition LeastSquares.cpp:553
int Solve(Isis::LeastSquares::SolveMethod method=SVD)
After all the data has been registered through AddKnown, invoke this method to solve the system of eq...
Definition LeastSquares.cpp:205
LeastSquares(Isis::BasisFunction &basis, bool sparse=false, int sparseRows=0, int sparseCols=0, bool jigsaw=false)
Creates a LeastSquares Object.
Definition LeastSquares.cpp:23
std::vector< double > Residuals() const
Returns a vector of residuals (errors).
Definition LeastSquares.cpp:570
void AddKnown(const std::vector< double > &input, double expected, double weight=1.0)
Invoke this method for each set of knowns.
Definition LeastSquares.cpp:96
std::vector< double > GetEpsilons() const
Definition LeastSquares.h:138
void ResetSparse()
Definition LeastSquares.h:137
std::vector< double > GetInput(int row) const
This method returns the data at the given row.
Definition LeastSquares.cpp:158
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16