26#ifndef _nmrIsOrthonormal_h
27#define _nmrIsOrthonormal_h
61template <
class _elementType>
102 if (allocateWorkspace) {
103 this->WorkspaceMemory.SetSize(
Size);
106 this->WorkspaceMemory.SetSize(0);
117 template <
typename __vectorOwnerTypeWorkspace>
122 if (
Size > inWorkspace.size()) {
123 cmnThrow(std::runtime_error(
"nmrIsOrthonormalDynamicData: Workspace is too small."));
125 if (!inWorkspace.IsCompact()) {
126 cmnThrow(std::runtime_error(
"nmrIsOrthonormalDynamicData: Workspace must be compact."));
156 template <
class __matrixOwnerTypeA>
178 return Data.WorkspaceReference;
225 template <
class __matrixOwnerTypeA>
244 template <
class __matrixOwnerTypeA,
class __vectorOwnerTypeWorkspace>
248 this->
SetRef(A, inWorkspace);
260 template <
class __matrixOwnerTypeA>
275 template <
class __matrixOwnerTypeA,
class __vectorOwnerTypeWorkspace>
286 this->WorkspaceReference.
SetRef(inWorkspace);
331template <
class _elementType, vct::
size_type _rows>
360 return Data.WorkspaceMember;
443template <vct::
size_type _size, vct::str
ide_type _rowStr
ide, vct::str
ide_type _colStr
ide,
typename _elementType,
class _dataPtrType>
450 product.Diagonal().Subtract(_elementType(1));
451 return (product.LinfNorm() <= tolerance);
461template <vct::
size_type _size, vct::str
ide_type _rowStr
ide, vct::str
ide_type _colStr
ide,
typename _elementType,
class _dataPtrType>
468 product.Diagonal().Subtract(_elementType(1));
469 return (product.LinfNorm() <= tolerance);
480template <
class _matrixOwnerTypeA,
class _elementType>
489 if (A.cols() != A.rows()) {
490 cmnThrow(std::runtime_error(
"nmrIsOrthonormal: Requires a square matrix."));
493 if ((A.cols() * A.rows()) > dataFriend.
Size()) {
494 cmnThrow(std::runtime_error(
"nmrIsOrthonormal: The data provided is not large enough."));
497 product.
SetRef(A.rows(), A.cols(), A.cols(), 1, dataFriend.
Workspace().Pointer());
499 product.
Diagonal().Subtract(_elementType(1));
500 return (product.LinfNorm() <= tolerance);
510template <
class _matrixOwnerTypeA,
typename _elementType>
528template <
class _matrixOwnerTypeA,
class _vectorOwnerTypeWorkspace,
typename _elementType>
535 data.
SetRef(A, workspace);
static Type Tolerance(void)
Definition cmnTypeTraits.h:170
Definition nmrIsOrthonormal.h:171
size_type Size(void)
Definition nmrIsOrthonormal.h:180
Friend(nmrIsOrthonormalDynamicData &data)
Definition nmrIsOrthonormal.h:175
vctDynamicVectorRef< _elementType > & Workspace(void)
Definition nmrIsOrthonormal.h:177
Data (workspace) for nmrIsOrthonormal (Dynamic).
Definition nmrIsOrthonormal.h:62
size_type Size
Definition nmrIsOrthonormal.h:136
void AllocateWorkspace(bool allocateWorkspace)
Definition nmrIsOrthonormal.h:100
nmrIsOrthonormalDynamicData(const vctDynamicConstMatrixBase< __matrixOwnerTypeA, _elementType > &A, vctDynamicVectorBase< __vectorOwnerTypeWorkspace, _elementType > &inWorkspace)
Definition nmrIsOrthonormal.h:245
void SetRef(const vctDynamicConstMatrixBase< __matrixOwnerTypeA, _elementType > &A, vctDynamicVectorBase< __vectorOwnerTypeWorkspace, _elementType > &inWorkspace)
Definition nmrIsOrthonormal.h:276
vctDynamicVectorRef< _elementType > WorkspaceReference
Definition nmrIsOrthonormal.h:133
void Allocate(size_type m)
Definition nmrIsOrthonormal.h:295
nmrIsOrthonormalDynamicData(const vctDynamicConstMatrixBase< __matrixOwnerTypeA, _elementType > &A)
Definition nmrIsOrthonormal.h:226
vctDynamicVector< _elementType > WorkspaceMemory
Definition nmrIsOrthonormal.h:70
static size_type WorkspaceSize(const vctDynamicConstMatrixBase< __matrixOwnerTypeA, _elementType > &A)
Definition nmrIsOrthonormal.h:157
nmrIsOrthonormalDynamicData()
Definition nmrIsOrthonormal.h:195
nmrIsOrthonormalDynamicData(size_type m)
Definition nmrIsOrthonormal.h:211
static size_type WorkspaceSize(size_type m)
Definition nmrIsOrthonormal.h:146
void ThrowUnlessWorkspaceSizeIsCorrect(vctDynamicVectorBase< __vectorOwnerTypeWorkspace, _elementType > &inWorkspace) const CISST_THROW(std
Definition nmrIsOrthonormal.h:119
void Allocate(const vctDynamicConstMatrixBase< __matrixOwnerTypeA, _elementType > &A)
Definition nmrIsOrthonormal.h:261
vct::size_type size_type
Definition nmrIsOrthonormal.h:66
void SetDimension(size_type m)
Definition nmrIsOrthonormal.h:75
Definition nmrIsOrthonormal.h:353
Friend(nmrIsOrthonormalFixedSizeData< _elementType, _rows > &data)
Definition nmrIsOrthonormal.h:357
VectorTypeWorkspace & Workspace(void)
Definition nmrIsOrthonormal.h:359
Data for nmrIsOrthonormal (Fixed size).
Definition nmrIsOrthonormal.h:333
VectorTypeWorkspace WorkspaceMember
Definition nmrIsOrthonormal.h:343
vctFixedSizeVector< _elementType, SIZE > VectorTypeWorkspace
Definition nmrIsOrthonormal.h:340
nmrIsOrthonormalFixedSizeData()
Definition nmrIsOrthonormal.h:368
@ SIZE
Definition nmrIsOrthonormal.h:336
Definition vctForwardDeclarations.h:145
DiagonalRefType Diagonal(void)
Definition vctDynamicMatrixBase.h:239
ThisType & ProductOf(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix, const value_type scalar)
Definition vctDynamicMatrixBase.h:971
Dynamic matrix referencing existing memory.
Definition vctDynamicMatrixRef.h:75
void SetRef(size_type rows, size_type cols, stride_type rowStride, stride_type colStride, pointer dataPointer)
Definition vctDynamicMatrixRef.h:217
Definition vctDynamicVectorBase.h:62
Definition vctForwardDeclarations.h:131
Dynamic vector referencing existing memory.
Definition vctDynamicVectorRef.h:78
void SetRef(size_type size, pointer data, stride_type stride=1)
Definition vctDynamicVectorRef.h:156
A template for a fixed size matrix with fixed spacing in memory.
Definition vctFixedSizeConstMatrixBase.h:104
ConstRefTransposeType TransposeRef(void) const
Definition vctFixedSizeConstMatrixRef.h:172
Definition vctForwardDeclarations.h:110
pointer Pointer(size_type index=0)
Definition vctFixedSizeVectorBase.h:226
Implementation of a fixed-size vector using template metaprogramming.
Definition vctFixedSizeVector.h:54
#define CISST_THROW(exceptionParameter)
Somewhat portable compilation warning message. This works with very recent versions of gcc (4....
Definition cmnPortability.h:559
void cmnThrow(const _exceptionType &except, cmnLogLevel lod=CMN_LOG_LEVEL_INIT_ERROR)
Definition cmnThrow.h:76
size_t size_type
Definition vctContainerTraits.h:35
bool nmrIsOrthonormal(const vctFixedSizeConstMatrixBase< _size, _size, _rowStride, _colStride, _elementType, _dataPtrType > &A, nmrIsOrthonormalFixedSizeData< _elementType, _size > &data, _elementType tolerance=cmnTypeTraits< _elementType >::Tolerance())
Definition nmrIsOrthonormal.h:444
vctDynamicMatrix< _elementType > MatrixValueType
Definition vctDynamicConstMatrixBase.h:141
Declaration of vctDynamicMatrix.
Declaration of vctFixedSizeMatrix.