cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
nmrLSISolver Class Reference

#include <nmrLSISolver.h>

Public Member Functions

 nmrLSISolver (void)
 
 nmrLSISolver (CISSTNETLIB_INTEGER ma, CISSTNETLIB_INTEGER na, CISSTNETLIB_INTEGER mg)
 
 nmrLSISolver (vctDynamicMatrix< CISSTNETLIB_DOUBLE > &C, vctDynamicMatrix< CISSTNETLIB_DOUBLE > &d, vctDynamicMatrix< CISSTNETLIB_DOUBLE > &A, vctDynamicMatrix< CISSTNETLIB_DOUBLE > &b)
 
void Allocate (CISSTNETLIB_INTEGER ma, CISSTNETLIB_INTEGER na, CISSTNETLIB_INTEGER mg)
 
void Allocate (vctDynamicMatrix< CISSTNETLIB_DOUBLE > &C, vctDynamicMatrix< CISSTNETLIB_DOUBLE > &d, vctDynamicMatrix< CISSTNETLIB_DOUBLE > &A, vctDynamicMatrix< CISSTNETLIB_DOUBLE > &b)
 
CISST_EXPORT void Solve (vctDynamicMatrix< CISSTNETLIB_DOUBLE > &C, vctDynamicMatrix< CISSTNETLIB_DOUBLE > &d, vctDynamicMatrix< CISSTNETLIB_DOUBLE > &A, vctDynamicMatrix< CISSTNETLIB_DOUBLE > &b) throw (std::runtime_error)
 
const vctDynamicMatrix
< CISSTNETLIB_DOUBLE > & 
GetX (void) const
 

Protected Attributes

CISSTNETLIB_INTEGER Ma
 
CISSTNETLIB_INTEGER Na
 
CISSTNETLIB_INTEGER Mg
 
vctDynamicMatrix
< CISSTNETLIB_DOUBLE > 
VSiUtb
 
vctDynamicMatrix
< CISSTNETLIB_DOUBLE > 
GTilde
 
vctDynamicMatrix
< CISSTNETLIB_DOUBLE > 
HTilde
 
vctDynamicMatrix
< CISSTNETLIB_DOUBLE > 
Z
 
vctDynamicMatrix
< CISSTNETLIB_DOUBLE > 
X
 
vctDynamicMatrix
< CISSTNETLIB_DOUBLE > 
Si
 
vctDynamicMatrix
< CISSTNETLIB_DOUBLE > 
VSi
 
nmrSVDRSSolver SVDRS
 
nmrLDPSolver LDP
 

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.

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.

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
maNumber of rows of C
naNumber of columns of C
mgNumber of rows of A
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.

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
maNumber of rows of C
naNumber of columns of C
mgNumber of rows of A
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.

const vctDynamicMatrix<CISSTNETLIB_DOUBLE>& nmrLSISolver::GetX ( void  ) const
inline

Get X. This method must be used after Solve().

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

Member Data Documentation

vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrLSISolver::GTilde
protected
vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrLSISolver::HTilde
protected
nmrLDPSolver nmrLSISolver::LDP
protected
CISSTNETLIB_INTEGER nmrLSISolver::Ma
protected
CISSTNETLIB_INTEGER nmrLSISolver::Mg
protected
CISSTNETLIB_INTEGER nmrLSISolver::Na
protected
vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrLSISolver::Si
protected
nmrSVDRSSolver nmrLSISolver::SVDRS
protected
vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrLSISolver::VSi
protected
vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrLSISolver::VSiUtb
protected
vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrLSISolver::X
protected
vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrLSISolver::Z
protected

The documentation for this class was generated from the following file: