cisst-saw
Loading...
Searching...
No Matches
nmrIsOrthonormalDynamicData< _elementType > Class Template Reference

Data (workspace) for nmrIsOrthonormal (Dynamic). More...

#include <nmrIsOrthonormal.h>

Classes

class  Friend

Public Types

typedef vct::size_type size_type

Public Member Functions

 nmrIsOrthonormalDynamicData ()
 nmrIsOrthonormalDynamicData (size_type m)
template<class __matrixOwnerTypeA>
 nmrIsOrthonormalDynamicData (const vctDynamicConstMatrixBase< __matrixOwnerTypeA, _elementType > &A)
template<class __matrixOwnerTypeA, class __vectorOwnerTypeWorkspace>
 nmrIsOrthonormalDynamicData (const vctDynamicConstMatrixBase< __matrixOwnerTypeA, _elementType > &A, vctDynamicVectorBase< __vectorOwnerTypeWorkspace, _elementType > &inWorkspace)
template<class __matrixOwnerTypeA>
void Allocate (const vctDynamicConstMatrixBase< __matrixOwnerTypeA, _elementType > &A)
template<class __matrixOwnerTypeA, class __vectorOwnerTypeWorkspace>
void SetRef (const vctDynamicConstMatrixBase< __matrixOwnerTypeA, _elementType > &A, vctDynamicVectorBase< __vectorOwnerTypeWorkspace, _elementType > &inWorkspace)
void Allocate (size_type m)

Static Public Member Functions

static size_type WorkspaceSize (size_type m)
template<class __matrixOwnerTypeA>
static size_type WorkspaceSize (const vctDynamicConstMatrixBase< __matrixOwnerTypeA, _elementType > &A)

Protected Member Functions

void SetDimension (size_type m)
void AllocateWorkspace (bool allocateWorkspace)
template<typename __vectorOwnerTypeWorkspace>
void ThrowUnlessWorkspaceSizeIsCorrect (vctDynamicVectorBase< __vectorOwnerTypeWorkspace, _elementType > &inWorkspace) const CISST_THROW(std

Protected Attributes

vctDynamicVector< _elementType > WorkspaceMemory
vctDynamicVectorRef< _elementType > WorkspaceReference
size_type Size

Friends

class Friend

Detailed Description

template<class _elementType>
class nmrIsOrthonormalDynamicData< _elementType >

Data (workspace) for nmrIsOrthonormal (Dynamic).

Any size 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 nmrIsOrthonormalDynamicData class allows 2 different configurations:

  • Allocate automatically the workspace. This can be performed using either the constructor from input matrix (i.e. nmrIsOrthonormalDynamicData(A)) or using the method Allocate(A).
  • Don't allocate anything. The user has to provide the container he wants to use for the workspace. In this case, the data object is used mostly to check that all the workspace is large enough. This can be performed using either the constructor from workspace (i.e. nmrIsOrthonormalDynamicData(A, workspace)) or the method SetRef(A, workspace).
See also
nmrIsOrthonormal

Member Typedef Documentation

◆ size_type

template<class _elementType>
typedef vct::size_type nmrIsOrthonormalDynamicData< _elementType >::size_type

Type used for sizes within nmrIsOrthonormalDynamicData.

Constructor & Destructor Documentation

◆ nmrIsOrthonormalDynamicData() [1/4]

template<class _elementType>
nmrIsOrthonormalDynamicData< _elementType >::nmrIsOrthonormalDynamicData ( )
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.

See also
nmrIsOrthonormalDynamicData::Allocate nmrIsOrthonormalDynamicData::SetRef

◆ nmrIsOrthonormalDynamicData() [2/4]

template<class _elementType>
nmrIsOrthonormalDynamicData< _elementType >::nmrIsOrthonormalDynamicData ( size_type m)
inline

Constructor where the user specifies the size. Memory allocation is performed for the workspace. This should be used when the user doesn't need to share the workspace between different algorithms.

Parameters
mNumber of rows of the matrix to be decomposed. The matrix must be square.
See also
nmrIsOrthonormalDynamicData::Allocate

◆ nmrIsOrthonormalDynamicData() [3/4]

template<class _elementType>
template<class __matrixOwnerTypeA>
nmrIsOrthonormalDynamicData< _elementType >::nmrIsOrthonormalDynamicData ( const vctDynamicConstMatrixBase< __matrixOwnerTypeA, _elementType > & A)
inline

Constructor where the user provides the input matrix to specify the size. Memory allocation is performed for the workspace. This should be used when the user doesn't need to share the workspace between different algorithms.

Parameters
Ainput matrix
See also
nmrIsOrthonormalDynamicData::Allocate

◆ nmrIsOrthonormalDynamicData() [4/4]

template<class _elementType>
template<class __matrixOwnerTypeA, class __vectorOwnerTypeWorkspace>
nmrIsOrthonormalDynamicData< _elementType >::nmrIsOrthonormalDynamicData ( const vctDynamicConstMatrixBase< __matrixOwnerTypeA, _elementType > & A,
vctDynamicVectorBase< __vectorOwnerTypeWorkspace, _elementType > & inWorkspace )
inline

Constructor where the user provides the input matrix to specify the size and storage order. There is no memory allocation performed in this case. This constructor should be used when the user cares wants to avoid allocating different workspaces for different numerical routines. Please note that since multiple routines can share the workspace, these routines must be called in a thread safe manner.

Parameters
Ainput matrix
inWorkspaceworkspace
See also
nmrIsOrthonormalDynamicData::SetRefWorkspace

Member Function Documentation

◆ Allocate() [1/2]

template<class _elementType>
template<class __matrixOwnerTypeA>
void nmrIsOrthonormalDynamicData< _elementType >::Allocate ( const vctDynamicConstMatrixBase< __matrixOwnerTypeA, _elementType > & A)
inline

This method allocates memory for the workspace. The input matrix is used only to determine the size of the problem.

This method should be called before the nmrIsOrthonormalDynamicData object is passed on to nmrIsOrthonormal function.

Parameters
AThe matrix to be used with nmrIsOrthonormal.

◆ Allocate() [2/2]

template<class _elementType>
void nmrIsOrthonormalDynamicData< _elementType >::Allocate ( size_type m)
inline

This method allocates the memory for the workspace. This method is not meant to be a top-level user API, but is used by other overloaded Allocate methods.

Parameters
mNumber of rows of input matrix A. A must be a square matrix.

◆ AllocateWorkspace()

template<class _elementType>
void nmrIsOrthonormalDynamicData< _elementType >::AllocateWorkspace ( bool allocateWorkspace)
inlineprotected

Private method to allocate memory for the workspace if needed. This method assumes that the size of the problem has been 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 (nmrIsOrthonormalDynamicData) 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 either the workspace or the output). For example:

vctRandom(A, 10, 10);
nmrIsOrthonormalDynamicData data(A); // allocate workspace
data.SetRef(A, workspace); // after all, use my own workspace
nmrIsOrthonormalDynamicData()
Definition nmrIsOrthonormal.h:195
static size_type WorkspaceSize(size_type m)
Definition nmrIsOrthonormal.h:146
Definition vctForwardDeclarations.h:157
Definition vctForwardDeclarations.h:131
void vctRandom(vctDynamicMatrixBase< _matrixOwnerType, _elementType > &matrix, const typename vctDynamicMatrixBase< _matrixOwnerType, _elementType >::value_type min, const typename vctDynamicMatrixBase< _matrixOwnerType, _elementType >::value_type max)
Definition vctRandomDynamicMatrix.h:47
Note
The method SetDimension must have been called before.

◆ SetDimension()

template<class _elementType>
void nmrIsOrthonormalDynamicData< _elementType >::SetDimension ( size_type m)
inlineprotected

Private method to set the data member Size. This method must be called before AllocateWorkspace or ThrowUnlessWorkspaceSizeIsCorrect.

◆ SetRef()

template<class _elementType>
template<class __matrixOwnerTypeA, class __vectorOwnerTypeWorkspace>
void nmrIsOrthonormalDynamicData< _elementType >::SetRef ( const vctDynamicConstMatrixBase< __matrixOwnerTypeA, _elementType > & A,
vctDynamicVectorBase< __vectorOwnerTypeWorkspace, _elementType > & inWorkspace )
inline

This method uses the memory provided by user for workspace. The input matrix A is used to determine the size of the problem.

This method verifies that the workspace provided by the user is large enough and is compact.

Parameters
AThe matrix to be used with IsOrthonormal.
inWorkspaceThe vector used for workspace.

◆ ThrowUnlessWorkspaceSizeIsCorrect()

template<class _elementType>
template<typename __vectorOwnerTypeWorkspace>
void nmrIsOrthonormalDynamicData< _elementType >::ThrowUnlessWorkspaceSizeIsCorrect ( vctDynamicVectorBase< __vectorOwnerTypeWorkspace, _elementType > & inWorkspace) const
inlineprotected

Verifies that the user provided references for the workspace match (or is greated than) the size of the data object as set by SetDimension. This method also checks that the workspace is compact.

Note
The method SetDimension must have been called before.

◆ WorkspaceSize() [1/2]

template<class _elementType>
template<class __matrixOwnerTypeA>
size_type nmrIsOrthonormalDynamicData< _elementType >::WorkspaceSize ( const vctDynamicConstMatrixBase< __matrixOwnerTypeA, _elementType > & A)
inlinestatic

Helper methods for user to set minimum working space required for nmrIsOrthonormal.

Parameters
AThe matrix to be tested. A must be square.

◆ WorkspaceSize() [2/2]

template<class _elementType>
size_type nmrIsOrthonormalDynamicData< _elementType >::WorkspaceSize ( size_type m)
inlinestatic

Helper methods for user to set minimum working space required for nmrIsOrthonormal.

Parameters
mThe number or rows of matrix to be tested. The matrix must be square.

◆ Friend

template<class _elementType>
friend class Friend
friend

Member Data Documentation

◆ Size

template<class _elementType>
size_type nmrIsOrthonormalDynamicData< _elementType >::Size
protected

Just store the size of the matrix, i.e. M * N.

◆ WorkspaceMemory

template<class _elementType>
vctDynamicVector<_elementType> nmrIsOrthonormalDynamicData< _elementType >::WorkspaceMemory
protected

Memory allocated for Workspace matrices if needed.

◆ WorkspaceReference

template<class _elementType>
vctDynamicVectorRef<_elementType> nmrIsOrthonormalDynamicData< _elementType >::WorkspaceReference
protected

References to work or return types, these point either to user allocated memory or our memory chunks if needed.


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