ERC CISST - cisst software

nmrLSISolver Class Reference
[Numerical Methods]

#include <nmrLSISolver.h>

Collaboration diagram for nmrLSISolver:

Collaboration graph
[legend]
List of all members.

Detailed Description

Algorithm LSI: Least Squares with Inequality Constraints.

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 $Ma \times Na$ matrix C, a $Ma \times 1$ vector d, a $Mg \times Na$ A and a $Mg \times 1$ vector b, compute a $Na \times 1$ vector X, that solves the least squares problem:

$ \mbox{min} \; 1 / 2 \| CX - d \| \; \mbox{subject to} \; AX \geq B$

The data members of this class are:

Note:
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 73 of file nmrLSISolver.h.

Public Member Functions

Protected Attributes


Constructor & Destructor Documentation

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.

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


Member Function Documentation

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.

Parameters:
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 $Ma \times Na$ matrix C, a $Ma \times 1$ vector d, a $Mg \times Na$ A and a $Mg \times 1$ vector b, compute a $Na \times 1$ vector X, that solves the least squares problem:

$ \mbox{min} \; 1 / 2 \| CX - d \| \; \mbox{subject to} \; AX \geq B$

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).

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.


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