ERC CISST - cisst software

nmrLSSolver Class Reference
[Numerical Methods]

#include <nmrLSSolver.h>

Collaboration diagram for nmrLSSolver:

Collaboration graph
[legend]
List of all members.

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.

Definition at line 93 of file nmrLSSolver.h.

Public Member Functions

Protected Attributes


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.

Definition at line 115 of file nmrLSSolver.h.

References Allocate(), M, N, NRHS, and StorageOrder.

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:
m Number of rows of A
n Number of columns of A
nrhs Number of columns of B
storageOrder Storage order used for the input matrix. This order will be used for the output as well.

Definition at line 136 of file nmrLSSolver.h.

References Allocate().

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.

Definition at line 147 of file nmrLSSolver.h.

References Allocate().

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.

Definition at line 147 of file nmrLSSolver.h.

References Allocate().


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:
m Number of rows of A
n Number of columns of A
nrhs Number of columns of B
storageOrder Storage order used for all the matrices

Definition at line 162 of file nmrLSSolver.h.

References Lda, Ldb, Lwork, M, N, NRHS, vctDynamicMatrix< _elementType >::SetSize(), StorageOrder, Trans, and Work.

Referenced by Allocate(), and nmrLSSolver().

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.

Definition at line 182 of file nmrLSSolver.h.

References Allocate(), vctDynamicConstMatrixBase< vctDynamicMatrixOwner< _elementType >, _elementType >::cols(), vctDynamicConstMatrixBase< vctDynamicMatrixOwner< _elementType >, _elementType >::IsRowMajor(), and vctDynamicConstMatrixBase< vctDynamicMatrixOwner< _elementType >, _elementType >::rows().

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.

Definition at line 194 of file nmrLSSolver.h.

References cmnThrow(), Info, Lda, Ldb, Lwork, M, N, NRHS, vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Pointer(), StorageOrder, Trans, and Work.


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