Go to the documentation of this file.
57 using namespace StringUtils;
61 SRIleastSquares::SRIleastSquares() { defaults(); }
65 SRIleastSquares::SRIleastSquares(
const unsigned int N)
75 SRIleastSquares::SRIleastSquares(
const Namelist& NL)
97 MatrixException me(
"Invalid input dimensions: R is " +
98 asString<int>(Rin.
rows()) +
"x" +
99 asString<int>(Rin.
cols()) +
", Z has length " +
100 asString<int>(Zin.
size()) +
", and NL has length " +
101 asString<int>(NLin.
size()));
271 int SRIleastSquares::dataUpdate(
275 const int M = D.
size();
276 const int N = R.rows();
279 cout <<
"\nSRIleastSquares::leastSquaresUpdate : M,N are " << M <<
","
286 MatrixException me(
"Called with zero-sized SRIleastSquares");
289 if (doLinearize && M < N)
292 string(
"When linearizing, problem must not be underdetermined:\n") +
293 string(
" data dimension is ") +
asString(M) +
294 string(
" while state dimension is ") +
asString(N));
297 if (doSequential && R.rows() != X.
size())
300 "Sequential problem has inconsistent dimensions:\n SRI is " +
301 asString<int>(R.rows()) +
"x" + asString<int>(R.cols()) +
302 " while X has length " + asString<int>(X.
size()));
305 if (doWeight && doRobust)
307 MatrixException me(
"Cannot have doWeight and doRobust both true.");
336 if (doSequential && numberBatches != 0)
344 if ((
int)X.
size() != N)
354 rmsConvergence = 0.0;
355 numberIterations = 0;
364 LSF(NominalX, f, Partials);
370 cout <<
"\nSRIleastSquares::leastSquaresUpdate :";
371 if (doLinearize || doRobust)
373 cout <<
" Iteration " << numberIterations;
379 cout <<
" Pre-fit data residuals: " << fixed << setprecision(6)
387 for (i = 0; i < M; i++)
388 MeasCov(i, i) = 1.0 / (Wts(i) * Wts(i));
392 if (numberIterations > 1)
401 cout <<
" Meas Cov:";
402 for (i = 0; i < M; i++)
403 cout <<
" " << MeasCov(i, i);
405 cout <<
" Partials:\n" << Partials << endl;
414 if (doRobust || doWeight)
426 if (doRobust || doWeight)
434 cout <<
" Updated information matrix\n"
436 cout <<
" Updated information vector\n"
443 getStateAndCovariance(Xsol, Cov, &small, &big);
445 catch (SingularMatrixException& sme)
450 conditionNum = big / small;
453 cout <<
" Condition number: " << scientific << conditionNum
455 cout <<
" Post-fit data residuals: " << fixed << setprecision(6)
468 cout << LXsol << endl;
472 if (!doLinearize && !doRobust)
480 rmsConvergence =
RMS(Xsol - NominalX);
483 cout <<
" RMS convergence : " << scientific << rmsConvergence
492 LSF(Xsol, f, Partials);
504 for (i = 0; i < M; i++)
521 rmsConvergence =
RMS(OldWts - Wts);
524 cout <<
" Convergence: " << scientific << setprecision(3)
525 << rmsConvergence << endl;
530 if (rmsConvergence > divergenceLimit)
534 if (numberIterations >= iterationsLimit)
549 if (numberIterations > 1 && rmsConvergence < convergenceLimit)
569 cout <<
"Return from SRIleastSquares::leastSquaresUpdate\n\n";
604 NL += string(
"State");
606 A = srif.
R || srif.
Z;
616 void SRIleastSquares::zeroAll()
628 void SRIleastSquares::reset(
const int N)
632 if (N > 0 && N != (
int)R.rows())
SparseMatrix< T > lowerCholesky(const SparseMatrix< T > &A)
double divergenceLimit
upper limit on the RSS change in solution which produces an abort
Vector< double > Xsave
solution X consistent with current information RX=z
double rmsConvergence
RMS change in state, used for convergence test.
size_t cols() const
The number of columns in the matrix.
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
int numberBatches
current number of batches seen
size_t rows() const
The number of rows in the matrix.
Matrix< double > R
Information matrix, an upper triangular (square) matrix.
Vector< double > Z
SRI state vector, of length equal to the dimension (row and col) of R.
LabeledMatrix & setprecision(int p)
Set the precision to p digits.
void SrifMU(Matrix< T > &R, Vector< T > &Z, SparseMatrix< T > &A, const unsigned int M)
SparseMatrix< T > inverseLT(const SparseMatrix< T > <, T *ptrSmall, T *ptrBig)
Compute inverse of lower-triangular SparseMatrix.
int numberIterations
current number of iterations
LabeledVector & message(const std::string &m)
Set the label or name.
unsigned int size() const
return the size of the list.
bool doVerbose
if true, output intermediate results
Namelist names
Namelist parallel to R and Z, labelling the elements of the state vector.
#define GNSSTK_RETHROW(exc)
@ P
Legacy GPS precise code.
#define RobustTuningT
tuning constant used in M-estimate and Robust least squares (SRIFilter.cpp)
std::ostream & operator<<(std::ostream &s, gnsstk::StringUtils::FFLead v)
size_t size() const
STL size.
#define GNSSTK_THROW(exc)
double conditionNum
condition number, defined in inversion to get state and covariance
T median(const Vector< T > &v)
Compute the median of a gnsstk::Vector.
double convergenceLimit
limit on the RSS change in solution which produces success
T RMS(const ConstVectorBase< T, BaseClass > &l)
int iterationsLimit
limit on the number of iterations
T mad(const gnsstk::Vector< T > &v)
median absolute deviation of a gnsstk::Vector
bool valid
indicates if the filter is valid - set false when singular
LabeledMatrix & setw(int w)
Set the width to w characters.
T MedianAbsoluteDeviation(T *xd, int nd, T &M, bool save_flag=true)
gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:41