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

The original version of this code was developed by Charles L. Lawson and Richard J. Hanson at Jet Propulsion Laboratory 1974 SEP 25, and published in the book "Solving Least Squares Problems", Prentice-Hall, 1974.
This subroutine computes the singular value decomposition of the given
matrix A, and optionally applies the transformations from the left to the
column vectors of the
matrix B. Either
or
is permitted.
The singular value decomposition of A is of the form:

where U is
orthogonal, S is
diagonal with the diagonal terms nonnegative and ordered from large to small, and V is
orthogonal. Note that these matrices also satisfy:

The singular values, i.e. the diagonal terms of the matrix S, are returned in the matrix GetS(). If
, positions
through N of S() will be set to zero.
The product matrix
replaces the given matrix B in the matrix B(,).
If the user wishes to obtain a minimum length least squares solution of the linear system:

the solution X can be constructed, following use of this subroutine, by computing the sum for i = 1, ..., R of the outer products
(Col i of V) * (1/S(i)) * (Row i of G)
Here R denotes the pseudorank of A which the user may choose in the range 0 through
based on the sizes of the singular values.
The data members of this class are:


matrix A. On output contains the
matrix V.
this array must contain a
matrix on input and will contain the
product matrix,
on output.
. If
the singular values indexed from
through N will be zero.
.
The input matrices of this class must use a column major storage order. To do so, use VCT_COL_MAJOR whenever you declare a matrix. They must also be compact (see vctDynamicMatrix::IsFortran()).
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 119 of file nmrSVDRSSolver.h.
| nmrSVDRSSolver::nmrSVDRSSolver | ( | 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 136 of file nmrSVDRSSolver.h.
References Allocate(), M, and N.
| nmrSVDRSSolver::nmrSVDRSSolver | ( | CISSTNETLIB_INTEGER | m, | |
| CISSTNETLIB_INTEGER | n, | |||
| CISSTNETLIB_INTEGER | nb = 1 | |||
| ) | [inline] |
Constructor with memory allocation. This constructor allocates the memory based on M, N and Nb. It relies on the method Allocate(). The next call to the Solve() method will check that the parameters match the dimension.
| m | Number of rows of A | |
| n | Number of columns of A | |
| nb | Number of columns of B |
Definition at line 149 of file nmrSVDRSSolver.h.
References Allocate().
| nmrSVDRSSolver::nmrSVDRSSolver | ( | 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 161 of file nmrSVDRSSolver.h.
References Allocate().
| void nmrSVDRSSolver::Allocate | ( | CISSTNETLIB_INTEGER | m, | |
| CISSTNETLIB_INTEGER | n, | |||
| CISSTNETLIB_INTEGER | nb = 1 | |||
| ) | [inline] |
This method allocates the memory based on M, N and Nb. The next call to the Solve() method will check that the parameters match the dimension.
| m | Number of rows of A | |
| n | Number of columns of A | |
| nb | Number of columns of B |
Definition at line 174 of file nmrSVDRSSolver.h.
References Lda, Ldb, M, N, Nb, S, vctDynamicMatrix< _elementType >::SetSize(), VCT_COL_MAJOR, and Work.
Referenced by Allocate(), nmrLSISolver::Allocate(), and nmrSVDRSSolver().
| void nmrSVDRSSolver::Allocate | ( | 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 191 of file nmrSVDRSSolver.h.
References Allocate(), vctDynamicConstMatrixBase< vctDynamicMatrixOwner< _elementType >, _elementType >::cols(), and vctDynamicConstMatrixBase< vctDynamicMatrixOwner< _elementType >, _elementType >::rows().
| void nmrSVDRSSolver::Solve | ( | vctDynamicMatrix< CISSTNETLIB_DOUBLE > & | A, | |
| vctDynamicMatrix< CISSTNETLIB_DOUBLE > & | B | |||
| ) | throw (std::runtime_error) [inline] |
This subroutine computes the singular value decomposition of the given
matrix A, and optionally applies the transformations from the left to the
column vectors of the
matrix B. Either
or
is permitted.
The singular value decomposition of A is of the form:

Definition at line 212 of file nmrSVDRSSolver.h.
References cmnThrow(), Lda, Ldb, M, N, Nb, vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Pointer(), S, and Work.