cisst-saw
|
Declaration of nmrSVD. More...
#include <cisstCommon/cmnThrow.h>
#include <cisstVector/vctFixedSizeMatrix.h>
#include <cisstVector/vctDynamicMatrix.h>
#include <cisstNumerical/nmrNetlib.h>
#include <cisstNumerical/nmrExport.h>
Go to the source code of this file.
Classes | |
class | nmrSVDDynamicData |
Data for SVD problem (Dynamic). More... | |
class | nmrSVDDynamicData::Friend |
class | nmrSVDFixedSizeData< _rows, _cols, _storageOrder > |
Data of SVD problem (Fixed size). More... | |
class | nmrSVDFixedSizeData< _rows, _cols, _storageOrder >::Friend |
Functions | |
Algorithm SVD: Singular Value Decomposition | |
The nmrSVD functions compute the singular value decomposition (SVD) of a real where These functions are wrappers around the LAPACK routine dgesvd, therefore they share some features with the LAPACK routine:
The nmrSVD functions add the following features:
There are different ways to call this function to compute the SVD of the matrix A. These correspond to different overloaded nmrSVD functions:
The functions nmrSVD return the status code as defined by LAPACK, i.e.:
| |
template<class _matrixOwnerType > | |
CISSTNETLIB_INTEGER | nmrSVD (vctDynamicMatrixBase< _matrixOwnerType, CISSTNETLIB_DOUBLE > &A, nmrSVDDynamicData &data) throw (std::runtime_error) |
template<class _matrixOwnerTypeA , class _matrixOwnerTypeU , class _vectorOwnerTypeS , class _matrixOwnerTypeVt , class _vectorOwnerTypeWorkspace > | |
CISSTNETLIB_INTEGER | nmrSVD (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicMatrixBase< _matrixOwnerTypeU, CISSTNETLIB_DOUBLE > &U, vctDynamicVectorBase< _vectorOwnerTypeS, CISSTNETLIB_DOUBLE > &S, vctDynamicMatrixBase< _matrixOwnerTypeVt, CISSTNETLIB_DOUBLE > &Vt, vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &Workspace) |
template<class _matrixOwnerTypeA , class _matrixOwnerTypeU , class _vectorOwnerTypeS , class _matrixOwnerTypeVt > | |
CISSTNETLIB_INTEGER | nmrSVD (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicMatrixBase< _matrixOwnerTypeU, CISSTNETLIB_DOUBLE > &U, vctDynamicVectorBase< _vectorOwnerTypeS, CISSTNETLIB_DOUBLE > &S, vctDynamicMatrixBase< _matrixOwnerTypeVt, CISSTNETLIB_DOUBLE > &Vt) |
template<vct::size_type _rows, vct::size_type _cols, vct::size_type _minmn, vct::size_type _work, bool _storageOrder> | |
CISSTNETLIB_INTEGER | nmrSVD (vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _rows, _cols, _storageOrder > &A, vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _rows, _rows, _storageOrder > &U, vctFixedSizeVector< CISSTNETLIB_DOUBLE, _minmn > &S, vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _cols, _cols, _storageOrder > &Vt, vctFixedSizeVector< CISSTNETLIB_DOUBLE, _work > &workspace) |
template<vct::size_type _rows, vct::size_type _cols, vct::size_type _minmn, bool _storageOrder> | |
CISSTNETLIB_INTEGER | nmrSVD (vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _rows, _cols, _storageOrder > &A, vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _rows, _rows, _storageOrder > &U, vctFixedSizeVector< CISSTNETLIB_DOUBLE, _minmn > &S, vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _cols, _cols, _storageOrder > &Vt) |
template<vct::size_type _rows, vct::size_type _cols, bool _storageOrder> | |
CISSTNETLIB_INTEGER | nmrSVD (vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _rows, _cols, _storageOrder > &A, nmrSVDFixedSizeData< _rows, _cols, _storageOrder > &data) |
Declaration of nmrSVD.
|
inline |
This function solves the SVD problem for a dynamic matrix using an nmrSVDDynamicData.
This function checks for valid input (size, storage order and compact) and calls the LAPACK function. If the input doesn't match the data, an exception is thrown (std::runtime_error
).
This function modifies the input matrix A and stores the results in the data. Each component of the result can be obtained via the const methods nmrSVDDynamicData::U(), nmrSVDDynamicData::S() and nmrSVDDynamicData::Vt().
A | A matrix of size MxN, either vctDynamicMatrix or vctDynamicMatrixRef. |
data | A data object corresponding to the input matrix. |
|
inline |
This function solves the SVD problem for a dynamic matrix using the storage provided by the user for both the output (U, S, Vt) and the workspace.
Internally, a data is created using the storage provided by the user (see nmrSVDDynamicData::SetRef). While the data is being build, the consistency of the output and workspace is checked. Then, the nmrSVD(A, data) function can be used safely.
A | is a reference to a dynamic matrix of size MxN |
U,S,Vt | The output matrices and vector for SVD |
Workspace | The workspace for LAPACK. |
|
inline |
This function solves the SVD problem for a dynamic matrix using the storage provided by the user for the output (U, S, Vt). A workspace will be dynamically allocated.
Internally, a data is created using the storage provided by the user (see nmrSVDDynamicData::SetRefOutput). While the data is being build, the consistency of the output is checked. Then, the nmrSVD(A, data) function can be used safely.
A | is a reference to a dynamic matrix of size MxN |
U,S,Vt | The output matrices and vector for SVD |
|
inline |
This function solves the SVD problem for a fixed size matrix using the storage provided by the user for both the output (U, S, Vt) and the workspace.
The storage order of the matrices and their sizes must match at compilation time. This is enforced by the template parameters and matching problems will lead to compilation errors. Since there is no easy way to enforece the size of the vectors S and workspace with template parameters, a runtime check is performed. The test uses CMN_ASSERT to determine what to do if the sizes don't match. By default CMN_ASSERT calls abort()
but it can be configured to be ignored or to throw an exception (see CMN_ASSERT for details).
This function modifies the input matrix A and the workspace. It stores the results in U, S and Vt.
A | is a reference to a dynamic matrix of size MxN |
U,S,Vt | The output matrices and vector for SVD |
workspace | The workspace for LAPACK. |
|
inline |
This function solves the SVD problem for a fixed size matrix using the storage provided by the user for the output (U, S, Vt). The workspace will be automatically allocated (stack allocation of a fixed size vector).
This method calls nmrSVD(A, U, S, Vt, workspace).
A | is a reference to a dynamic matrix of size MxN |
U,S,Vt | The output matrices and vector for SVD |
|
inline |
This function solves the SVD problem for a fixed size matrix using the storage provided by the user for both the output (U, S, Vt) and the workspace. This function allows to use the very convenient nmrSVDFixedSizeData to allocate the memory required for U, S, Vt and the workspace:
This method calls nmrSVD(A, U, S, Vt, workspace).
A | A fixed size matrix of size MxN. |
data | A data object. |