27 #include "tnt/tnt_array2d.h"
121 int sparseRows = 0,
int sparseCols = 0,
bool jigsaw =
false);
123 void AddKnown(
const std::vector<double> &input,
double expected,
124 double weight = 1.0);
126 std::vector<double>
GetInput(
int row)
const;
136 double Evaluate(
const std::vector<double> &input);
139 void Weight(
int index,
double weight);
151 double GetSigma0() {
return p_sigma0; }
156 void ResetSparse() { Reset(); }
159 void SetParameterWeights(
const std::vector<double> weights) {
p_parameterWeights = weights; }
161 const gmm::row_matrix<gmm::rsvector<double> >& GetCovarianceMatrix ()
const {
return p_normals; }
167 void SolveCholesky () {}
172 bool ApplyParameterWeights();
189 int p_currentFillRow;
void Weight(int index, double weight)
Reset the weight for the ith known.
gmm::row_matrix< gmm::rsvector< double > > p_sparseA
design matrix 'A'
void SolveSVD()
After all the data has been registered through AddKnown, invoke this method to solve the system of eq...
LeastSquares(Isis::BasisFunction &basis, bool sparse=false, int sparseRows=0, int sparseCols=0, bool jigsaw=false)
Creates a LeastSquares Object.
std::vector< double > p_epsilonsSparse
sparse vector of total parameter corrections
std::vector< double > p_expected
A vector of the expected values when solved.
std::vector< double > Residuals() const
Returns a vector of residuals (errors).
~LeastSquares()
Destroys the LeastSquares object.
std::vector< std::vector< double > > p_input
A vector of the input variables to evaluate.
void FillSparseA(const std::vector< double > &data)
Invoke this method for each set of knowns for sparse solutions.
bool SparseErrorPropagation()
Error propagation for sparse least-squares solution.
std::vector< double > p_xSparse
sparse solution vector
std::vector< double > p_parameterWeights
vector of parameter weights
Singular Value Decomposition.
double Evaluate(const std::vector< double > &input)
Invokes the BasisFunction Evaluate method.
std::vector< double > p_residuals
A vector of the residuals (or difference between expected and solved values).
gmm::row_matrix< gmm::rsvector< double > > p_normals
normal equations matrix 'N'
gmm::dense_matrix< double > p_ATb
right-hand side vector
Generic least square fitting class.
gmm::SuperLU_factor< double > p_SLU_Factor
decomposed normal equations matrix
int SolveSparse()
Solve using sparse class.
double p_sigma0
sigma nought - reference variance
void AddKnown(const std::vector< double > &input, double expected, double weight=1.0)
Invoke this method for each set of knowns.
double Residual(int i) const
Returns the ith residual.
int p_degreesOfFreedom
degrees of freedom (redundancy)
std::vector< double > GetInput(int row) const
This method returns the data at the given row.
Generic linear equation class.
double GetExpected(int row) const
This method returns the expected value at the given row.
Isis::BasisFunction * p_basis
Pointer to the BasisFunction object.
std::vector< double > p_sqrtWeight
A vector of the square roots of the weights for each known value.
int Knowns() const
The number of knowns (or times AddKnown was invoked) linear combination of the variables.
bool p_solved
Boolean value indicating solution is complete.
void SolveQRD()
After all the data has been registered through AddKnown, invoke this method to solve the system of eq...
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...
int Rows() const
This methods returns the number of rows in the matrix.
int p_constrainedParameters
constrained parameters