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

#include <nmrLSSolver.h>

Public Member Functions

 nmrLSSolver (void)
 
 nmrLSSolver (CISSTNETLIB_INTEGER m, CISSTNETLIB_INTEGER n, CISSTNETLIB_INTEGER nrhs, bool storageOrder)
 
void Allocate (CISSTNETLIB_INTEGER m, CISSTNETLIB_INTEGER n, CISSTNETLIB_INTEGER nrhs, bool storageOrder)
 
 nmrLSSolver (vctDynamicMatrix< double > &A, vctDynamicMatrix< double > &B)
 
void Allocate (vctDynamicMatrix< double > &A, vctDynamicMatrix< double > &B)
 
template<class _matrixOwnerType >
void Solve (vctDynamicMatrixBase< _matrixOwnerType, double > &A, vctDynamicMatrixBase< _matrixOwnerType, double > &B) throw (std::runtime_error)
 

Protected Attributes

CISSTNETLIB_INTEGER M
 
CISSTNETLIB_INTEGER N
 
CISSTNETLIB_INTEGER NRHS
 
CISSTNETLIB_INTEGER Lda
 
CISSTNETLIB_INTEGER Ldb
 
CISSTNETLIB_INTEGER Lwork
 
char Trans
 
vctDynamicMatrix< double > Work
 
CISSTNETLIB_INTEGER Info
 
bool StorageOrder
 

Detailed Description

Algorithm LS: Least Squares by QR or LQ decomposition This solves overdetermined or underdetermined real linear systems involving an M-by-N matrix A, or its transpose, using a QR or LQ factorization of A. It is assumed that A has full rank.

The following options are provided:

  1. If m >= n: find the least squares solution of an overdetermined system, i.e., solve the least squares problem $ \mbox {minimize} \| B - A*X \| $
  2. If m < n: find the minimum norm solution of an underdetermined system $ A * X = B $

The data members of this class are:

The input/output from this class is:

Note
The input matrix must be compact (see vctDynamicMatrix::IsCompact() or vctFixedSizeMatrix::IsCompact()).
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

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

nmrLSSolver::nmrLSSolver ( CISSTNETLIB_INTEGER  m,
CISSTNETLIB_INTEGER  n,
CISSTNETLIB_INTEGER  nrhs,
bool  storageOrder 
)
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 A
nNumber of columns of A
nrhsNumber of columns of B
storageOrderStorage order used for the input matrix. This order will be used for the output as well.
nmrLSSolver::nmrLSSolver ( vctDynamicMatrix< double > &  A,
vctDynamicMatrix< 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 and storage order.

Member Function Documentation

void nmrLSSolver::Allocate ( CISSTNETLIB_INTEGER  m,
CISSTNETLIB_INTEGER  n,
CISSTNETLIB_INTEGER  nrhs,
bool  storageOrder 
)
inline

This method allocates the memory based on M and N. The next call to the Solve() method will check that the parameters match the dimension.

Parameters
mNumber of rows of A
nNumber of columns of A
nrhsNumber of columns of B
storageOrderStorage order used for all the matrices
void nmrLSSolver::Allocate ( vctDynamicMatrix< double > &  A,
vctDynamicMatrix< 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.

template<class _matrixOwnerType >
void nmrLSSolver::Solve ( vctDynamicMatrixBase< _matrixOwnerType, double > &  A,
vctDynamicMatrixBase< _matrixOwnerType, double > &  B 
)
throw (std::runtime_error
)
inline

This computes the solves overdetermined or underdetermined real linear systems involving an M-by-N matrix A, using the right hand side M-by-NRHS matrix B.

Member Data Documentation

CISSTNETLIB_INTEGER nmrLSSolver::Info
protected
CISSTNETLIB_INTEGER nmrLSSolver::Lda
protected
CISSTNETLIB_INTEGER nmrLSSolver::Ldb
protected
CISSTNETLIB_INTEGER nmrLSSolver::Lwork
protected
CISSTNETLIB_INTEGER nmrLSSolver::M
protected
CISSTNETLIB_INTEGER nmrLSSolver::N
protected
CISSTNETLIB_INTEGER nmrLSSolver::NRHS
protected
bool nmrLSSolver::StorageOrder
protected
char nmrLSSolver::Trans
protected
vctDynamicMatrix<double> nmrLSSolver::Work
protected

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