📄 sri.hpp
字号:
/// constructor given the dimension N. SRI(const unsigned int) throw(); /// constructor given a Namelist, its dimension determines the SRI dimension. SRI(const Namelist&) throw(); /// explicit constructor - throw if the dimensions are inconsistent. SRI(const Matrix<double>&, const Vector<double>&, const Namelist&) throw(MatrixException); /// copy constructor SRI(const SRI&) throw(); /// operator= SRI& operator=(const SRI& right) throw(); // modify SRIs /// Permute the SRI elements to match the input Namelist, which may differ with /// the SRI Namelist by AT MOST A PERMUTATION; throw if this is not true. void permute(const Namelist&) throw(MatrixException,VectorException); /// split an SRI into two others, this one matching the input Namelist, the /// other containing whatever is left. The input Namelist must be a non-trivial /// subset of this->names; throw MatrixException if it is not. NB. Interpreting /// the results of a split() and merge (operator+()) operations should be done /// very carefully; remember that the SRI contains both solution and noise, /// and that the results of these operations are not always as expected, /// particularly note that split() and operator+() are usually NOT reversible. void split(const Namelist&, SRI&) throw(MatrixException,VectorException); /// extend this SRI to include the given Namelist, with no added information; /// names in the input namelist which are not unique are ignored. SRI& operator+=(const Namelist&) throw(MatrixException,VectorException); /// reshape this SRI to match the input Namelist, by calling other member /// functions, including split(), operator+() and permute() void reshape(const Namelist&) throw(MatrixException,VectorException); /// merge an SRI into this one. NB names may be reordered in the result. void merge(const SRI& S) throw(MatrixException,VectorException) { *this += S; } /// merge this SRI with the given input SRI. ? should this be operator&=() ? /// NB may reorder the names in the resulting Namelist. SRI& operator+=(const SRI&) throw(MatrixException,VectorException); /// merge two SRIs to produce a third. ? should this be operator&() ? friend SRI operator+(const SRI&, const SRI&) throw(MatrixException,VectorException); /// Zero out the nth row of R and the nth element of Z, removing all /// information about that element. void zeroOne(const unsigned int n) throw(); /// Zero out all the first n rows of R and elements of Z, removing all /// information about those elements. Default value of the input is 0, /// meaning zero out the entire SRI. void zeroAll(const int n=0) throw(); /// Zero out (set all elements to zero) the Vector Z only. void zeroZ(void) throw() { Z = 0.0; } /// Reset the SRI, meaning zero it and optionally change the dimension to n. /// @param n Dimension of the new object (optional). //void reset(int n=0) // throw(); /// Shift the state vector by a constant vector X0; does not change information /// i.e. let R * X = Z => R' * (X-X0) = Z' /// throw on invalid input dimension void shift(const Vector<double>&) throw(MatrixException); /// Transform this SRI with the transformation matrix T; /// i.e. R -> T * R * inverse(T) and Z -> T * Z. The matrix inverse(T) /// may optionally be supplied as input, otherwise it is computed from /// T. NB names in this SRI are most likely changed; but this routine does /// not change the Namelist. Throw MatrixException if the input has /// the wrong dimension or cannot be inverted. void transform(const Matrix<double>& T, const Matrix<double>& invT=SRINullMatrix) throw(MatrixException,VectorException); /// Transform the state by the transformation matrix T; i.e. X -> T*X, /// without transforming the SRI; this is done by right multiplying R by /// inverse(T), which is the input. Thus R -> R*inverse(T), /// so R*inverse(T)*T*X = Z. Input is the _inverse_ of the transformation. /// throw MatrixException if input dimensions are wrong. void transformState(const Matrix<double>& invT) throw(MatrixException); /// Decrease the information in this SRI for, or 'Q bump', the element /// with the input index. This means that the uncertainty and the state /// element given by the index are divided by the input factor q; the /// default input is zero, which means zero out the information (q = infinite). /// A Q bump by factor q is equivalent to 'de-weighting' the element by q. /// No effect if in is out of range. void Qbump(const unsigned int& in, const double& q=0.0) throw(MatrixException,VectorException); /// Fix the state element with the input index to the input value, and /// collapse the SRI by removing that element. /// No effect if index is out of range. void biasFix(const unsigned int&, const double&) throw(MatrixException,VectorException); /// Add a priori or constraint information in the form of an ordinary /// state vector and covariance matrix. /// @param Cov Covariance matrix of same dimension as this SRIFilter /// @param X State vector of same dimension as this SRIFilter /// @throw if input is invalid: dimensions are wrong or Cov is singular. void addAPriori(const Matrix<double>& Cov, const Vector<double>& X) throw(MatrixException); /// SRIF (Kalman) measurement update, or least squares update void measurementUpdate(Matrix<double>& Partials, Vector<double>& Data) throw(MatrixException) { SrifMU(R, Z, Partials, Data); } /// Compute the state X and the covariance matrix C of the state, where /// C = transpose(inverse(R))*inverse(R) and X = inverse(R) * Z. /// Optional pointer arguments will return smallest and largest /// eigenvalues of the R matrix, which is a measure of singularity. /// @param X State vector (output) /// @param C Covariance of the state vector (output) /// @param ptrSmall Pointer to double, on output *ptrSmall set to smallest /// eigenvalue of R /// @param ptrBig Pointer to double, on output *ptrBig set to largest /// eigenvalue of R /// @throw SingularMatrixException if R is singular. /// NB this is the most efficient way to invert the SRI equation. void getStateAndCovariance(Vector<double>& X, Matrix<double>& C, double *ptrSmall=NULL, double *ptrBig=NULL) throw(MatrixException,VectorException); // member access /// return the size of the SRI, which is the dimension of R(rows and columns), /// Z and names. unsigned int size(void) const throw() { return R.rows(); } /// access the Namelist of the SRI Namelist getNames(void) throw() { return names; } /// access the name of a specific state element, given its index. /// returns 'out-of-range' if the index is out of range. std::string getName(const unsigned int in) throw() { return names.getName(in); } /// assign the name of a specific state element, given its index; /// no effect, and return false, if the name is not unique; /// return true if successful. bool setName(const unsigned int in, const std::string& name) throw() { return names.setName(in,name); } /// return the index of the name in the Namelist that matches the input, or /// -1 if not found. unsigned int index(std::string& name) throw() { return names.index(name); } /// output operator friend std::ostream& operator<<(std::ostream& s, const SRI&);protected: // member data /// Information matrix, an upper triangular (square) matrix Matrix<double> R; /// SRI state vector, of length equal to the dimension (row and col) of R. Vector<double> Z; /// Namelist parallel to R and Z, labelling the elements of the state vector. Namelist names;}; // end class SRI} // end namespace gpstk//------------------------------------------------------------------------------------#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -