cisst-saw
|
Data for Inverse problem (Dynamic). More...
#include <nmrInverse.h>
Classes | |
class | Friend |
Public Types | |
enum | { NB = 64 } |
typedef vct::size_type | size_type |
Public Member Functions | |
nmrInverseDynamicData () | |
nmrInverseDynamicData (size_type size, bool storageOrder) | |
template<class _matrixOwnerTypeA > | |
nmrInverseDynamicData (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A) | |
template<class _matrixOwnerTypeA , class _vectorOwnerTypePivotIndices , class _vectorOwnerTypeWorkspace > | |
nmrInverseDynamicData (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicVectorBase< _vectorOwnerTypePivotIndices, CISSTNETLIB_INTEGER > &pivotIndices, vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &workspace) | |
template<class _matrixOwnerTypeA > | |
void | Allocate (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A) |
void | Allocate (size_type size, bool storageOrder) |
template<class _matrixOwnerTypeA , class _vectorOwnerTypePivotIndices , class _vectorOwnerTypeWorkspace > | |
void | SetRef (vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicVectorBase< _vectorOwnerTypePivotIndices, CISSTNETLIB_INTEGER > &pivotIndices, vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &workspace) throw (std::runtime_error) |
Static Public Member Functions | |
template<class _matrixOwnerTypeA > | |
static size_type | PivotIndicesSize (const vctDynamicConstMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A) |
template<class _matrixOwnerTypeA > | |
static size_type | WorkspaceSize (const vctDynamicConstMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A) |
Protected Member Functions | |
void | SetDimension (size_type size, bool storageOrder) |
void | AllocatePivotIndicesWorkspace (bool allocatePivotIndices, bool allocateWorkspace) |
template<class _vectorOwnerTypePivotIndices > | |
void | ThrowUnlessPivotIndicesSizeIsCorrect (vctDynamicVectorBase< _vectorOwnerTypePivotIndices, CISSTNETLIB_INTEGER > &pivotIndices) throw (std::runtime_error) |
template<class _vectorOwnerTypeWorkspace > | |
void | ThrowUnlessWorkspaceSizeIsCorrect (vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &workspace) throw (std::runtime_error) |
Protected Attributes | |
vctDynamicVector < CISSTNETLIB_INTEGER > | PivotIndicesMemory |
vctDynamicVector < CISSTNETLIB_DOUBLE > | WorkspaceMemory |
vctDynamicVectorRef < CISSTNETLIB_INTEGER > | PivotIndicesReference |
vctDynamicVectorRef < CISSTNETLIB_DOUBLE > | WorkspaceReference |
size_type | SizeMember |
bool | StorageOrderMember |
Friends | |
class | Friend |
Data for Inverse problem (Dynamic).
To ease the use of the Inverse routine, the user can rely on the nmrInverseDynamicData class to perform the required memory allocation.
Another good reason to use a data object is that the memory allocation can be performed once during an initialization phase while the function nmrInverse can be called numerous times later on without any new dynamic memory allocation. This is crucial for such things as real time tasks.
The Inverse routine can be used for different storage orders, i.e. either VCT_ROW_MAJOR or VCT_COL_MAJOR. The only restriction is that all matrices and vectors must also be compact, i.e. use a contiguous block of memory.
Any size or storage order mismatch will lead to an exception thrown (std::runtime_error). Since we are using cmnThrow, it is possible to configure cisst (at compilation time) to abort the program instead of throwing an exception.
The nmrInverseDynamicData class allows 2 different configurations:
Type used for sizes within nmrInverseDynamicData. This type is compatible with the cisstVector containers such as vctDynamicMatrix and vctDynamicVector (unsigned int). To call the Fortran based routines, these values must be cast to CISSTNETLIB_INTEGER.
|
inline |
The default constuctor. For dynamic size, there are assigned default values, i.e. sets all the dimensions to zero. These MUST be changed by calling the appropriate method.
|
inline |
Constructor where the user specifies the size. Memory allocation is performed for pivot indices vector and workspace. This should be used when the user doesn't care much about where the memory management.
size | Dimension of the square matrix. |
storageOrder | Storage order of the matrix |
|
inline |
Constructor where the user provides the input matrix to specify the size and storage order. Memory allocation is performed for pivot indices vector and workspace. This should be used when the user doesn't care much about memory management.
A | input matrix. |
|
inline |
Constructor where the user provides the vector to store the pivot indices and the workspace. The data object now acts as a composite container to hold, pass and manipulate a convenient storage for nmrInverse algorithm. Checks are made on the validity of the input and its consitency in terms of size.
A | The matrix to be inversed, used to verify the sizes. |
pivotIndices | Vector created by the user to store the pivot indices. |
workspace | Vector created by the user for the workspace. |
|
inline |
This method allocates memory for the pivot indices vector and the workspace. The input matrix is used only to determine the size of these vectors.
This method should be called before the nmrInverseDynamicData object is passed on to the nmrInverse function.
A | The square matrix for which inverse needs to be computed. |
|
inline |
This method allocates the memory for the pivot indices and the workspace. This method is not meant to be a top-level user API, but is used by other overloaded Allocate methods.
size | Size of the square input matrix A. |
storageOrder | Storage order of the input matrix. |
|
inlineprotected |
Private method to allocate memory for the the pivot indices and the workspace if needed. This method assumes that the dimension m and n as well as the storage order are already set. It is important to use this method in all the methods provided in the user API, even if all the memory is provided by the user since this method will ensure that the data (nmrInverseDynamicData) does not keep any memory allocated. This is for the case where a single data object is used first to allocate everything and, later on, used with user allocated memory (for the output).
|
inlinestatic |
Helper method to compute the size of the pivot indices vector.
A | The matrix to be used by nmrInverse (it is used only to determine the size). |
|
inlineprotected |
Private method to set the data members SizeMember and StorageOrderMember. This method must be called before AllocatePivotIndicesWorkspace, ThrowUnlessOutputSizeIsCorrect or ThrowUnlessWorkspaceSizeIsCorrect.
|
inline |
This method doesn't allocate any memory as it relies on the user provided vectors (pivotIndices and workspace).
The data object now acts as a composite container to hold, pass and manipulate a convenient storage for Inverse algorithm. The method tests that all the containers provided by the user have the correct size and are compact.
A | The matrix to be inversed, used to verify the sizes. |
pivotIndices | Vector created by the user to store the pivot indices. |
workspace | Vector created by the user for the workspace. |
|
inlineprotected |
Verifies that the user provided reference for the pivot indices match the size of the data object as set by SetDimension. This method also checks that all containers are compact.
|
inlineprotected |
Verifies that the user provided reference for the workspace match the size of the data object as set by SetDimension. This method also checks that all containers are compact.
|
inlinestatic |
Helper method to compute the size of the workspace vector.
A | The matrix to be used by nmrInverse (it is used only to determine the size). |
|
friend |
|
protected |
Memory allocated for pivot indices vector if needed.
|
protected |
Reference return type, this points either to user allocated memory or our memory chunk if needed.
|
protected |
Store Size and StorageOrder which are needed to check if A matrix passed nmrInverse matches the allocated size.
|
protected |
|
protected |
Memory allocated for the workspace if needed.
|
protected |