0.2.0
Loading...
Searching...
No Matches
LeastSquares.hpp File Reference

Least Squares Algorithm. More...

Go to the source code of this file.

Classes

struct  NAV::LeastSquaresResult< SolutionVector, VarianceMatrix >
 Least Squares Uncertainties return value. More...
 

Functions

template<typename DerivedA , typename DerivedB >
Eigen::Vector< typename DerivedA::Scalar, DerivedA::ColsAtCompileTime > NAV::solveLinearLeastSquares (const Eigen::MatrixBase< DerivedA > &H, const Eigen::MatrixBase< DerivedB > &dz)
 Finds the "least squares" solution for the equation \( \mathbf{v} = \mathbf{dz} - \mathbf{H} \mathbf{x} \).
 
template<typename DerivedA , typename DerivedB >
LeastSquaresResult< Eigen::Vector< typename DerivedA::Scalar, DerivedA::ColsAtCompileTime >, Eigen::Matrix< typename DerivedA::Scalar, DerivedA::ColsAtCompileTime, DerivedA::ColsAtCompileTime > > NAV::solveLinearLeastSquaresUncertainties (const Eigen::MatrixBase< DerivedA > &H, const Eigen::MatrixBase< DerivedB > &dz)
 Finds the "least squares" solution for the equation \( \mathbf{v} = \mathbf{dz} - \mathbf{H} \mathbf{x} \).
 
template<typename DerivedA , typename DerivedW , typename DerivedB >
Eigen::Vector< typename DerivedA::Scalar, DerivedA::ColsAtCompileTime > NAV::solveWeightedLinearLeastSquares (const Eigen::MatrixBase< DerivedA > &H, const Eigen::MatrixBase< DerivedW > &W, const Eigen::MatrixBase< DerivedB > &dz)
 Finds the "weighted least squares" solution.
 
template<typename DerivedA , typename DerivedW , typename DerivedB >
LeastSquaresResult< Eigen::Vector< typename DerivedA::Scalar, DerivedA::ColsAtCompileTime >, Eigen::Matrix< typename DerivedA::Scalar, DerivedA::ColsAtCompileTime, DerivedA::ColsAtCompileTime > > NAV::solveWeightedLinearLeastSquaresUncertainties (const Eigen::MatrixBase< DerivedA > &H, const Eigen::MatrixBase< DerivedW > &W, const Eigen::MatrixBase< DerivedB > &dz)
 Finds the "weighted least squares" solution.
 

Detailed Description

Least Squares Algorithm.

Author
T. Topp (topp@.nosp@m.ins..nosp@m.uni-s.nosp@m.tutt.nosp@m.gart..nosp@m.de)
Date
2022-05-04

Function Documentation

◆ solveLinearLeastSquares()

template<typename DerivedA , typename DerivedB >
Eigen::Vector< typename DerivedA::Scalar, DerivedA::ColsAtCompileTime > NAV::solveLinearLeastSquares ( const Eigen::MatrixBase< DerivedA > & H,
const Eigen::MatrixBase< DerivedB > & dz )

Finds the "least squares" solution for the equation \( \mathbf{v} = \mathbf{dz} - \mathbf{H} \mathbf{x} \).

Minimizes the functional

\begin{equation} \label{eq:eq-LinearLeastSquares-functional} J(\mathbf{x}) \equiv \sum_{i=1}^m v_i^2 = \mathbf{v}^T \mathbf{v} = (\mathbf{dz} - \mathbf{H} \mathbf{x})^T (\mathbf{dz} - \mathbf{H} \mathbf{x}) \end{equation}

which has the solution (assuming that the inverse to \( \mathbf{H}^T \mathbf{H} \) exists)

\begin{equation} \label{eq:eq-LinearLeastSquares-solution} \mathbf{x} = \left(\mathbf{H}^T \mathbf{H} \right)^{-1} \mathbf{H}^T \mathbf{dz} \end{equation}

Parameters
[in]HDesign Matrix
[in]dzResidual vector
Returns
Least squares solution

◆ solveLinearLeastSquaresUncertainties()

template<typename DerivedA , typename DerivedB >
LeastSquaresResult< Eigen::Vector< typename DerivedA::Scalar, DerivedA::ColsAtCompileTime >, Eigen::Matrix< typename DerivedA::Scalar, DerivedA::ColsAtCompileTime, DerivedA::ColsAtCompileTime > > NAV::solveLinearLeastSquaresUncertainties ( const Eigen::MatrixBase< DerivedA > & H,
const Eigen::MatrixBase< DerivedB > & dz )

Finds the "least squares" solution for the equation \( \mathbf{v} = \mathbf{dz} - \mathbf{H} \mathbf{x} \).

Parameters
[in]HDesign Matrix
[in]dzResidual vector
Returns
Least squares solution and variance

◆ solveWeightedLinearLeastSquares()

template<typename DerivedA , typename DerivedW , typename DerivedB >
Eigen::Vector< typename DerivedA::Scalar, DerivedA::ColsAtCompileTime > NAV::solveWeightedLinearLeastSquares ( const Eigen::MatrixBase< DerivedA > & H,
const Eigen::MatrixBase< DerivedW > & W,
const Eigen::MatrixBase< DerivedB > & dz )

Finds the "weighted least squares" solution.

\begin{equation} \label{eq:eq-WeightedLinearLeastSquares} \mathbf{x} = \left(\mathbf{H}^T \mathbf{W} \mathbf{H} \right)^{-1} \mathbf{H}^T \mathbf{W} \mathbf{dz} \end{equation}

Parameters
[in]HDesign Matrix
[in]WWeight matrix
[in]dzResidual vector
Returns
Least squares solution

◆ solveWeightedLinearLeastSquaresUncertainties()

template<typename DerivedA , typename DerivedW , typename DerivedB >
LeastSquaresResult< Eigen::Vector< typename DerivedA::Scalar, DerivedA::ColsAtCompileTime >, Eigen::Matrix< typename DerivedA::Scalar, DerivedA::ColsAtCompileTime, DerivedA::ColsAtCompileTime > > NAV::solveWeightedLinearLeastSquaresUncertainties ( const Eigen::MatrixBase< DerivedA > & H,
const Eigen::MatrixBase< DerivedW > & W,
const Eigen::MatrixBase< DerivedB > & dz )

Finds the "weighted least squares" solution.

Parameters
[in]HDesign Matrix
[in]WWeight matrix
[in]dzResidual vector
Returns
Weighted least squares solution and variance