cisst-saw
Loading...
Searching...
No Matches
nmrLDPSolver Class Reference

#include <nmrLDPSolver.h>

Public Member Functions

 nmrLDPSolver (void)
 nmrLDPSolver (CISSTNETLIB_INTEGER m, CISSTNETLIB_INTEGER n)
 nmrLDPSolver (vctDynamicMatrix< CISSTNETLIB_DOUBLE > &G, vctDynamicMatrix< CISSTNETLIB_DOUBLE > &h)
void Allocate (CISSTNETLIB_INTEGER m, CISSTNETLIB_INTEGER n)
void Allocate (vctDynamicMatrix< CISSTNETLIB_DOUBLE > &G, vctDynamicMatrix< CISSTNETLIB_DOUBLE > &CMN_UNUSED(h))

Public Attributes

CISST_EXPORT void Solve(vctDynamicMatrix< CISSTNETLIB_DOUBLE > &G, vctDynamicMatrix< CISSTNETLIB_DOUBLE > &h) CISST_THROW(std const vctDynamicMatrix< CISSTNETLIB_DOUBLE > & GetX (void) const

Protected Attributes

CISSTNETLIB_INTEGER M
CISSTNETLIB_INTEGER N
vctDynamicMatrix< CISSTNETLIB_DOUBLE > E
vctDynamicMatrix< CISSTNETLIB_DOUBLE > CopyE
vctDynamicMatrix< CISSTNETLIB_DOUBLE > F
vctDynamicMatrix< CISSTNETLIB_DOUBLE > R
vctDynamicMatrix< CISSTNETLIB_DOUBLE > U
vctDynamicMatrix< CISSTNETLIB_DOUBLE > W
vctDynamicMatrix< CISSTNETLIB_INTEGER > Index
vctDynamicMatrix< CISSTNETLIB_DOUBLE > Zz
vctDynamicMatrix< CISSTNETLIB_DOUBLE > X

Detailed Description

Algorithm LDP: Least Distance Programming

The original version of this code was developed by Charles L. Lawson and Richard J. Hanson at Jet Propulsion Laboratory 1974 MAR 1, and published in the book "Solving Least Squares Problems", Prentice-Hall, 1974.

Given a \( M \times N \) matrix G and a \( M \times 1 \) vector h, compute a \( N \times 1 \) vector X, that solves the linear distance problem:

\( \mbox{min} \; \| X \| \; \mbox{subject to} \; GX \geq h \)

The data members of this class are:

  • M, N: Dimension of input matrix
  • G: The input matrix
  • H: On entry contains the \( M \times 1 \) matrix h
  • E: A \( N+1 \times M \) matrix passed as A matrix to NNLS
  • CopyE: A copy of E made before passing to NNLS
  • F: A \( N+1 \times 1 \) matrix passed as B to NNLS
  • U: A \( N+1 \times 1 \) matrix in which solution to NNLS is obtained
  • R: A \( N+1 \times 1 \) working matrix
  • W: A \( M \times 1 \) working matrix
  • ZZ: A \( N+1 \times 1 \) working array.
  • Index: A working array of integers of size atleast \( M \times 1 \)
  • X: On exit X contains the solution vector
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

◆ nmrLDPSolver() [1/3]

nmrLDPSolver::nmrLDPSolver ( 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.

◆ nmrLDPSolver() [2/3]

nmrLDPSolver::nmrLDPSolver ( CISSTNETLIB_INTEGER m,
CISSTNETLIB_INTEGER n )
inline

Constructor with memory allocation. This constructor allocates the memory based on M and N. It relies on the method Allocate(). The next call to the Solve() method will check that the parameters match the dimension.

Parameters
mNumber of rows of G
nNumber of columns of G

◆ nmrLDPSolver() [3/3]

nmrLDPSolver::nmrLDPSolver ( vctDynamicMatrix< CISSTNETLIB_DOUBLE > & G,
vctDynamicMatrix< CISSTNETLIB_DOUBLE > & h )
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

◆ Allocate() [1/2]

void nmrLDPSolver::Allocate ( CISSTNETLIB_INTEGER m,
CISSTNETLIB_INTEGER n )
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
mNumber of rows of G
nNumber of columns of G

◆ Allocate() [2/2]

void nmrLDPSolver::Allocate ( vctDynamicMatrix< CISSTNETLIB_DOUBLE > & G,
vctDynamicMatrix< CISSTNETLIB_DOUBLE > & CMN_UNUSEDh )
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.

Member Data Documentation

◆ CopyE

vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrLDPSolver::CopyE
protected

◆ E

vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrLDPSolver::E
protected

◆ F

vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrLDPSolver::F
protected

◆ GetX

CISST_EXPORT void Solve(vctDynamicMatrix< CISSTNETLIB_DOUBLE > &G, vctDynamicMatrix< CISSTNETLIB_DOUBLE > &h) CISST_THROW(std const vctDynamicMatrix< CISSTNETLIB_DOUBLE > & nmrLDPSolver::GetX(void) const
inline

Given a \( M \times N \) matrix G and a \( M \times 1 \) vector h, compute a \( N \times 1 \) vector X, that solves the linear distance problem:

\( \mbox{min} \; \| X \| \; \mbox{subject to} \; GX \geq h \)

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

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

◆ Index

vctDynamicMatrix<CISSTNETLIB_INTEGER> nmrLDPSolver::Index
protected

◆ M

CISSTNETLIB_INTEGER nmrLDPSolver::M
protected

◆ N

CISSTNETLIB_INTEGER nmrLDPSolver::N
protected

◆ R

vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrLDPSolver::R
protected

◆ U

vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrLDPSolver::U
protected

◆ W

vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrLDPSolver::W
protected

◆ X

vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrLDPSolver::X
protected

◆ Zz

vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrLDPSolver::Zz
protected

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