#include <nmrLSISolver.h>
Collaboration diagram for nmrLSISolver:

This code is a re-written version of algorithm from Charles L. Lawson and Richard J. Hanson, "Solving Least Squares Problems", Prentice-Hall, 1974. Section 5: Chapter 23.
Given a
matrix C, a
vector d, a
A and a
vector b, compute a
vector X, that solves the least squares problem:

The data members of this class are:
contains 
contains
. See L&H book for definition of
.
contains
. See L&H book for definition of
.
contains solution of the internal LDP problem
, on exit contains the solution.
contains the pseudo inverse of singular values.
contains 
This code relies on the ERC CISST cnetlib library. Since cnetlib is optional, make sure that CISST_HAS_CNETLIB has been turned ON during the configuration with CMake.
Definition at line 73 of file nmrLSISolver.h.
| nmrLSISolver::nmrLSISolver | ( | void | ) | [inline] |
Default constructor. This constructor doesn't allocate any memory. If you use this constructor, you will need to use one of the Allocate() methods before you can use the Solve method.
Definition at line 95 of file nmrLSISolver.h.
References Allocate(), Ma, Mg, and Na.
| nmrLSISolver::nmrLSISolver | ( | CISSTNETLIB_INTEGER | ma, | |
| CISSTNETLIB_INTEGER | na, | |||
| CISSTNETLIB_INTEGER | mg | |||
| ) | [inline] |
Constructor with memory allocation. This constructor allocates the memory based on Ma, Na and Mg. It relies on the method Allocate(). The next call to the Solve() method will check that the parameters match the dimension.
| ma | Number of rows of C | |
| na | Number of columns of C | |
| mg | Number of rows of A |
Definition at line 113 of file nmrLSISolver.h.
References Allocate().
| nmrLSISolver::nmrLSISolver | ( | vctDynamicMatrix< CISSTNETLIB_DOUBLE > & | C, | |
| vctDynamicMatrix< CISSTNETLIB_DOUBLE > & | d, | |||
| vctDynamicMatrix< CISSTNETLIB_DOUBLE > & | A, | |||
| vctDynamicMatrix< CISSTNETLIB_DOUBLE > & | b | |||
| ) | [inline] |
Constructor with memory allocation. This constructor allocates the memory based on the actual input of the Solve() method. It relies on the method Allocate(). The next call to the Solve() method will check that the parameters match the dimension.
Definition at line 123 of file nmrLSISolver.h.
References Allocate().
| void nmrLSISolver::Allocate | ( | CISSTNETLIB_INTEGER | ma, | |
| CISSTNETLIB_INTEGER | na, | |||
| CISSTNETLIB_INTEGER | mg | |||
| ) | [inline] |
This method allocates the memory based on Ma, Na and Mg. The next call to the Solve() method will check that the parameters match the dimension.
| ma | Number of rows of C | |
| na | Number of columns of C | |
| mg | Number of rows of A |
Definition at line 137 of file nmrLSISolver.h.
References nmrSVDRSSolver::Allocate(), nmrLDPSolver::Allocate(), GTilde, HTilde, LDP, Ma, Mg, Na, vctDynamicMatrix< _elementType >::SetSize(), Si, SVDRS, VCT_COL_MAJOR, VSi, VSiUtb, X, and Z.
Referenced by Allocate(), and nmrLSISolver().
| void nmrLSISolver::Allocate | ( | vctDynamicMatrix< CISSTNETLIB_DOUBLE > & | C, | |
| vctDynamicMatrix< CISSTNETLIB_DOUBLE > & | d, | |||
| vctDynamicMatrix< CISSTNETLIB_DOUBLE > & | A, | |||
| vctDynamicMatrix< CISSTNETLIB_DOUBLE > & | b | |||
| ) | [inline] |
Allocate memory to solve this problem. This method provides a convenient way to extract the required sizes from the input containers. The next call to the Solve() method will check that the parameters match the dimension.
Definition at line 157 of file nmrLSISolver.h.
References Allocate(), vctDynamicConstMatrixBase< vctDynamicMatrixOwner< _elementType >, _elementType >::cols(), and vctDynamicConstMatrixBase< vctDynamicMatrixOwner< _elementType >, _elementType >::rows().
| CISST_EXPORT void nmrLSISolver::Solve | ( | vctDynamicMatrix< CISSTNETLIB_DOUBLE > & | C, | |
| vctDynamicMatrix< CISSTNETLIB_DOUBLE > & | d, | |||
| vctDynamicMatrix< CISSTNETLIB_DOUBLE > & | A, | |||
| vctDynamicMatrix< CISSTNETLIB_DOUBLE > & | b | |||
| ) | throw (std::runtime_error) |
Given a
matrix C, a
vector d, a
A and a
vector b, compute a
vector X, that solves the least squares problem:

| const vctDynamicMatrix<CISSTNETLIB_DOUBLE>& nmrLSISolver::GetX | ( | void | ) | const [inline] |
Get X. This method must be used after Solve().
Definition at line 180 of file nmrLSISolver.h.
References X.