ERC CISST - cisst software

nmrSVDRSSolver Class Reference
[Numerical Methods]

#include <nmrSVDRSSolver.h>

Collaboration diagram for nmrSVDRSSolver:

Collaboration graph
[legend]
List of all members.

Detailed Description

Algorithm SVDRS: Singular Value Decomposition also treating Right Side Vector.

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 $ M \times N $ matrix A, and optionally applies the transformations from the left to the $ Nb $ column vectors of the $ Mb \times Nb $ matrix B. Either $ M > N $ or $ M < N $ is permitted.

The singular value decomposition of A is of the form:

$ A = U S V^{T} $

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

$ S = (U^{T}) A V $

The singular values, i.e. the diagonal terms of the matrix S, are returned in the matrix GetS(). If $ M < N $, positions $ M+1 $ through N of S() will be set to zero.

The product matrix $ G = U^{T} B $ 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:

$ \| Ax - B \| $

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 $ \mbox{min}(M, N) $ based on the sizes of the singular values.

The data members of this class are:

Note:
This code gives special treatment to rows and columns that are entirely zero. This causes certain zero singular values to appear as exact zeros rather than as about MACHEPS times the largest singular value It similarly cleans up the associated columns of U and V.

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.

Public Member Functions

Protected Attributes


Constructor & Destructor Documentation

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.

Parameters:
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().


Member Function Documentation

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.

Parameters:
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 $ M \times N $ matrix A, and optionally applies the transformations from the left to the $ Nb $ column vectors of the $ Mb \times Nb $ matrix B. Either $ M > N $ or $ M < N $ is permitted.

The singular value decomposition of A is of the form:

$ A = U S V^{T} $

Note:
This method verifies that the input parameters are using a column major storage order and that they are compact. Both conditions are tested using vctDynamicMatrix::IsFortran(). If the parameters don't meet all the requirements, an exception is thrown (std::runtime_error).

Definition at line 212 of file nmrSVDRSSolver.h.

References cmnThrow(), Lda, Ldb, M, N, Nb, vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Pointer(), S, and Work.


The documentation for this class was generated from the following file:
erc-cisst-devel<at>lists.johnshopkins.edu