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

#include <nmrSVDSolver.h>

Public Member Functions

 nmrSVDSolver (void)
 
 nmrSVDSolver (CISSTNETLIB_INTEGER m, CISSTNETLIB_INTEGER n, bool storageOrder)
 
void Allocate (CISSTNETLIB_INTEGER m, CISSTNETLIB_INTEGER n, bool storageOrder)
 
const vctDynamicMatrix
< CISSTNETLIB_DOUBLE > & 
GetS (void) const
 
const vctDynamicMatrix
< CISSTNETLIB_DOUBLE > & 
GetU (void) const
 
const vctDynamicMatrix
< CISSTNETLIB_DOUBLE > & 
GetVt (void) const
 
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.

Parameters
AInput matrix
template<class _matrixOwnerType >
 nmrSVDSolver (const vctDynamicMatrixBase< _matrixOwnerType, CISSTNETLIB_DOUBLE > &A)
 
template<vct::size_type _rows, vct::size_type _cols, bool _storageOrder>
 nmrSVDSolver (const vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _rows, _cols, _storageOrder > &A)
 
Allocate memory to solve this problem.

This methods provide 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 Allocate (const vctDynamicMatrixBase< _matrixOwnerType, CISSTNETLIB_DOUBLE > &A)
 
template<vct::size_type _rows, vct::size_type _cols, bool _storageOrder>
void Allocate (const vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _rows, _cols, _storageOrder > &A)
 
template<class _matrixOwnerType >
void Solve (vctDynamicMatrixBase< _matrixOwnerType, CISSTNETLIB_DOUBLE > &A) throw (std::runtime_error)
 
template<vct::size_type _rows, vct::size_type _cols, bool _storageOrder>
void Solve (vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _rows, _cols, _storageOrder > &A)
 

Protected Attributes

CISSTNETLIB_INTEGER M
 
CISSTNETLIB_INTEGER N
 
CISSTNETLIB_INTEGER Lda
 
CISSTNETLIB_INTEGER Ldu
 
CISSTNETLIB_INTEGER Ldvt
 
CISSTNETLIB_INTEGER Lwork
 
char Jobu
 
char Jobvt
 
vctDynamicMatrix
< CISSTNETLIB_DOUBLE > 
S
 
vctDynamicMatrix
< CISSTNETLIB_DOUBLE > 
U
 
vctDynamicMatrix
< CISSTNETLIB_DOUBLE > 
Vt
 
vctDynamicMatrix
< CISSTNETLIB_DOUBLE > 
Work
 
CISSTNETLIB_INTEGER Info
 
bool StorageOrder
 

Detailed Description

Algorithm SVD: Singular Value Decomposition

This computes the singular value decomposition (SVD) of a real $ M \times N $ matrix A, optionally computing the left and/or right singular vectors. The SVD is written:

$ A = U * \Sigma * V^{T} $

where $ \Sigma $ is a $ M \times N $ matrix which is zero except for its min(m,n) diagonal elements, U is a $ M \times M $ orthogonal matrix, and V is a $ N \times N $ orthogonal matrix. The diagonal elements of $ \Sigma $ are the singular values of A; they are real and non-negative, and are returned in descending order. The first $ \mbox{min}(m,n) $ columns of U and V are the left and right singular vectors of A.

Note that the routine returns $ V^{T} $, not $ V $.

The data members of this class are:

Note
The input matrices of this class can use either column major or row major storage order. To select the storage order, use either VCT_COL_MAJOR or VCT_ROW_MAJOR (default) whenever you declare a matrix.
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.
Deprecated:
This class has been replaced by nmrSVD, nmrSVDDynamicData and nmrSVDFixedSizeData.

Constructor & Destructor Documentation

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

nmrSVDSolver::nmrSVDSolver ( CISSTNETLIB_INTEGER  m,
CISSTNETLIB_INTEGER  n,
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
storageOrderStorage order used for the input matrix. This order will be used for the output as well.
template<class _matrixOwnerType >
nmrSVDSolver::nmrSVDSolver ( const vctDynamicMatrixBase< _matrixOwnerType, CISSTNETLIB_DOUBLE > &  A)
inline
template<vct::size_type _rows, vct::size_type _cols, bool _storageOrder>
nmrSVDSolver::nmrSVDSolver ( const vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _rows, _cols, _storageOrder > &  A)
inline

Member Function Documentation

void nmrSVDSolver::Allocate ( CISSTNETLIB_INTEGER  m,
CISSTNETLIB_INTEGER  n,
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
storageOrderStorage order used for all the matrices
template<class _matrixOwnerType >
void nmrSVDSolver::Allocate ( const vctDynamicMatrixBase< _matrixOwnerType, CISSTNETLIB_DOUBLE > &  A)
inline
template<vct::size_type _rows, vct::size_type _cols, bool _storageOrder>
void nmrSVDSolver::Allocate ( const vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _rows, _cols, _storageOrder > &  A)
inline
const vctDynamicMatrix<CISSTNETLIB_DOUBLE>& nmrSVDSolver::GetS ( void  ) const
inline
const vctDynamicMatrix<CISSTNETLIB_DOUBLE>& nmrSVDSolver::GetU ( void  ) const
inline
const vctDynamicMatrix<CISSTNETLIB_DOUBLE>& nmrSVDSolver::GetVt ( void  ) const
inline
template<class _matrixOwnerType >
void nmrSVDSolver::Solve ( vctDynamicMatrixBase< _matrixOwnerType, CISSTNETLIB_DOUBLE > &  A)
throw (std::runtime_error
)
inline

This computes the singular value decomposition (SVD) of a real $ M \times N $ matrix A, optionally computing the left and/or right singular vectors. The SVD is written:

$ A = U * \Sigma * V^{T} $

Note
This method requires a compact matrix with the same size and storage order used to Allocate. An std::runtime_error exception will be thrown if these conditions are not met.
template<vct::size_type _rows, vct::size_type _cols, bool _storageOrder>
void nmrSVDSolver::Solve ( vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _rows, _cols, _storageOrder > &  A)
inline

Member Data Documentation

CISSTNETLIB_INTEGER nmrSVDSolver::Info
protected
char nmrSVDSolver::Jobu
protected
char nmrSVDSolver::Jobvt
protected
CISSTNETLIB_INTEGER nmrSVDSolver::Lda
protected
CISSTNETLIB_INTEGER nmrSVDSolver::Ldu
protected
CISSTNETLIB_INTEGER nmrSVDSolver::Ldvt
protected
CISSTNETLIB_INTEGER nmrSVDSolver::Lwork
protected
CISSTNETLIB_INTEGER nmrSVDSolver::M
protected
CISSTNETLIB_INTEGER nmrSVDSolver::N
protected
vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrSVDSolver::S
protected
bool nmrSVDSolver::StorageOrder
protected
vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrSVDSolver::U
protected
vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrSVDSolver::Vt
protected
vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrSVDSolver::Work
protected

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