cisst-saw
Loading...
Searching...
No Matches
vctDynamicMatrix.h File Reference

Declaration of vctDynamicMatrix. More...

Go to the source code of this file.

Classes

class  vctReturnDynamicMatrix< _elementType >

Macros

#define _vctDynamicMatrix_h

Functions

 vctDynamicMatrix ()
 A matrix object of dynamic size.
 vctDynamicMatrix (size_type rows, size_type cols, bool storageOrder=VCT_DEFAULT_STORAGE)
 vctDynamicMatrix (const nsize_type &matrixSize, bool storageOrder=VCT_DEFAULT_STORAGE)
 vctDynamicMatrix (size_type rows, size_type cols, value_type value, bool storageOrder=VCT_DEFAULT_STORAGE)
 vctDynamicMatrix (const nsize_type &matrixSize, value_type value, bool storageOrder=VCT_DEFAULT_STORAGE)
 vctDynamicMatrix (const vctReturnDynamicMatrix< value_type > &otherMatrix)
 vctDynamicMatrix (const ThisType &otherMatrix)
template<class __matrixOwnerType, typename __otherMatrixElementType>
 vctDynamicMatrix (const vctDynamicConstMatrixBase< __matrixOwnerType, __otherMatrixElementType > &otherMatrix, bool storageOrder)
template<class __matrixOwnerType>
 vctDynamicMatrix (const vctDynamicConstMatrixBase< __matrixOwnerType, value_type > &otherMatrix)
template<class __matrixOwnerType, typename __otherMatrixElementType>
 vctDynamicMatrix (const vctDynamicConstMatrixBase< __matrixOwnerType, __otherMatrixElementType > &otherMatrix)
template<size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, class __elementType, class __dataPtrType>
 vctDynamicMatrix (const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, __elementType, __dataPtrType > &other)
template<class __matrixOwnerType, typename __elementType>
ThisTypeoperator= (const vctDynamicConstMatrixBase< __matrixOwnerType, __elementType > &otherMatrix)
ThisTypeoperator= (const ThisType &otherMatrix)
template<size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, class __elementType, class __dataPtrType>
ThisTypeoperator= (const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, __elementType, __dataPtrType > &other)
ThisTypeoperator= (const vctReturnDynamicMatrix< value_type > &otherMatrix)
ThisTypeoperator= (const value_type &value)
template<class __matrixOwnerType, typename __elementType>
ThisTypeForceAssign (const vctDynamicConstMatrixBase< __matrixOwnerType, __elementType > &other)
template<size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, class __elementType, class __dataPtrType>
ThisTypeForceAssign (const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, __elementType, __dataPtrType > &other)
void resize (size_type rows, size_type cols)
void resize (const nsize_type &newSizes)
void SetSize (size_type rows, size_type cols, bool storageOrder)
void SetSize (const nsize_type &matrixSize, bool storageOrder)
void SetSize (size_type rows, size_type cols)
void SetSize (const nsize_type &matrixSize)
void DeSerializeRaw (std::istream &inputStream)
Elementwise operations between dynamic matrices.
template<class _matrixOwnerType1, class _matrixOwnerType2, class _elementType>
vctReturnDynamicMatrix< _elementType > operator+ (const vctDynamicConstMatrixBase< _matrixOwnerType1, _elementType > &inputMatrix1, const vctDynamicConstMatrixBase< _matrixOwnerType2, _elementType > &inputMatrix2)
template<class _matrixOwnerType1, class _matrixOwnerType2, class _elementType>
vctReturnDynamicMatrix< _elementType > operator- (const vctDynamicConstMatrixBase< _matrixOwnerType1, _elementType > &inputMatrix1, const vctDynamicConstMatrixBase< _matrixOwnerType2, _elementType > &inputMatrix2)
Elementwise operations between a dynamic matrix and a

scalar.

template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator+ (const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &inputMatrix, const _elementType &inputScalar)
template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator- (const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &inputMatrix, const _elementType &inputScalar)
template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator* (const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &inputMatrix, const _elementType &inputScalar)
template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator/ (const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &inputMatrix, const _elementType &inputScalar)
Elementwise operations between a scalar and a dynamic

matrix.

template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator+ (const _elementType &inputScalar, const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &inputMatrix)
template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator- (const _elementType &inputScalar, const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &inputMatrix)
template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator* (const _elementType &inputScalar, const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &inputMatrix)
template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator/ (const _elementType &inputScalar, const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &inputMatrix)
Elementwise operations on a dynamic matrix.
template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator- (const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &inputMatrix)
template<class _matrixOwnerType1, class _matrixOwnerType2, class _elementType>
vctReturnDynamicMatrix< _elementType > operator* (const vctDynamicConstMatrixBase< _matrixOwnerType1, _elementType > &inputMatrix1, const vctDynamicConstMatrixBase< _matrixOwnerType2, _elementType > &inputMatrix2)
template<class _matrixOwnerType, class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator* (const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &inputMatrix, const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > &inputVector)
template<class _vectorOwnerType, class _matrixOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator* (const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > &inputVector, const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &inputMatrix)
template<class _matrixOwnerType, class __matrixOwnerType, class _elementType, class _elementOperationType>
vctReturnDynamicMatrix< bool > vctDynamicMatrixElementwiseCompareMatrix (const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &matrix1, const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &matrix2)
template<class _matrixOwnerType, class _elementType, class _elementOperationType>
vctReturnDynamicMatrix< bool > vctDynamicMatrixElementwiseCompareScalar (const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &matrix, const _elementType &scalar)

Detailed Description

Declaration of vctDynamicMatrix.

Macro Definition Documentation

◆ _vctDynamicMatrix_h

#define _vctDynamicMatrix_h

Function Documentation

◆ DeSerializeRaw()

void DeSerializeRaw ( std::istream & inputStream)

Binary deserialization

◆ ForceAssign() [1/2]

template<class __matrixOwnerType, typename __elementType>
ThisType & ForceAssign ( const vctDynamicConstMatrixBase< __matrixOwnerType, __elementType > & other)
inline

◆ ForceAssign() [2/2]

template<size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, class __elementType, class __dataPtrType>
ThisType & ForceAssign ( const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, __elementType, __dataPtrType > & other)
inline

◆ operator*() [1/5]

template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator* ( const _elementType & inputScalar,
const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > & inputMatrix )

◆ operator*() [2/5]

template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator* ( const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > & inputMatrix,
const _elementType & inputScalar )

◆ operator*() [3/5]

template<class _matrixOwnerType, class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator* ( const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > & inputMatrix,
const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > & inputVector )

◆ operator*() [4/5]

template<class _matrixOwnerType1, class _matrixOwnerType2, class _elementType>
vctReturnDynamicMatrix< _elementType > operator* ( const vctDynamicConstMatrixBase< _matrixOwnerType1, _elementType > & inputMatrix1,
const vctDynamicConstMatrixBase< _matrixOwnerType2, _elementType > & inputMatrix2 )

◆ operator*() [5/5]

template<class _vectorOwnerType, class _matrixOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator* ( const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > & inputVector,
const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > & inputMatrix )

◆ operator+() [1/3]

template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator+ ( const _elementType & inputScalar,
const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > & inputMatrix )

Operation between a scalar and a dynamic matrix.

Parameters
inputScalarThe first operand of the binary operation.
inputMatrixThe second operand of the binary operation.
Returns
The matrix result of \(op(scalar, matrix)\).

◆ operator+() [2/3]

template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator+ ( const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > & inputMatrix,
const _elementType & inputScalar )

Operation between a dynamic matrix and a scalar.

Parameters
inputMatrixThe first operand of the binary operation.
inputScalarThe second operand of the binary operation.
Returns
The matrix result of \(op(matrix, scalar)\).

◆ operator+() [3/3]

template<class _matrixOwnerType1, class _matrixOwnerType2, class _elementType>
vctReturnDynamicMatrix< _elementType > operator+ ( const vctDynamicConstMatrixBase< _matrixOwnerType1, _elementType > & inputMatrix1,
const vctDynamicConstMatrixBase< _matrixOwnerType2, _elementType > & inputMatrix2 )

Operation between dynamic matrices (same size).

Parameters
inputMatrix1The first operand of the binary operation.
inputMatrix2The second operand of the binary operation.
Returns
The matrix result of \(op(matrix1, matrix2)\).

◆ operator-() [1/4]

template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator- ( const _elementType & inputScalar,
const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > & inputMatrix )

◆ operator-() [2/4]

template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator- ( const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > & inputMatrix)

Unary operation on a dynamic matrix.

Parameters
inputMatrixThe operand of the unary operation
Returns
The matrix result of \(op(matrix)\).

◆ operator-() [3/4]

template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator- ( const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > & inputMatrix,
const _elementType & inputScalar )

◆ operator-() [4/4]

template<class _matrixOwnerType1, class _matrixOwnerType2, class _elementType>
vctReturnDynamicMatrix< _elementType > operator- ( const vctDynamicConstMatrixBase< _matrixOwnerType1, _elementType > & inputMatrix1,
const vctDynamicConstMatrixBase< _matrixOwnerType2, _elementType > & inputMatrix2 )

◆ operator/() [1/2]

template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator/ ( const _elementType & inputScalar,
const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > & inputMatrix )

◆ operator/() [2/2]

template<class _matrixOwnerType, class _elementType>
vctReturnDynamicMatrix< _elementType > operator/ ( const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > & inputMatrix,
const _elementType & inputScalar )

◆ operator=() [1/5]

ThisType & operator= ( const ThisType & otherMatrix)

Assignment from a dynamic matrix to this matrix. The operation discards the old memory allocated for this matrix, and allocates new memory the size of the input matrix. Then the elements of the input matrix are copied into this matrix.

◆ operator=() [2/5]

ThisType & operator= ( const value_type & value)
inline

Assignement of a scalar to all elements. See also SetAll.

◆ operator=() [3/5]

template<class __matrixOwnerType, typename __elementType>
ThisType & operator= ( const vctDynamicConstMatrixBase< __matrixOwnerType, __elementType > & otherMatrix)

Assignment from a dynamic matrix to a matrix. The operation discards the old memory allocated for this matrix, and allocates new memory the size of the input matrix. Then the elements of the input matrix are copied into this matrix.

Todo
This assumes a row major storage. Needs more work.

◆ operator=() [4/5]

template<size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, class __elementType, class __dataPtrType>
ThisType & operator= ( const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, __elementType, __dataPtrType > & other)

Assignment from a fixed size matrix. This operator will resize the left side dynamic matrix to match the right side fixed size matrix.

◆ operator=() [5/5]

ThisType & operator= ( const vctReturnDynamicMatrix< value_type > & otherMatrix)

Assignement from a transitional vctReturnDynamicMatrix to a vctDynamicMatrix variable. This specialized operation does not perform any element copy. Instead it transfers ownership of the data from the other matrix to this matrix, and disowns the other matrix. The right hand side operand must be a temporary object returned, e.g., from a function or overloaded operator.

Todo
This operator needs some revisions.

◆ resize() [1/2]

void resize ( const nsize_type & newSizes)

◆ resize() [2/2]

void resize ( size_type rows,
size_type cols )

Non-destructive size change. Change the size to the specified size, and preserve as many rows and columns as possible from the former matrix.

Note
If the storage order and the sizes (both rows and columns) are unchanged, this method does nothing.
This method doesn't allow to change the storage order of the elements (i.e. stays either row or column major).
If the size is set to zero, the data pointer is set to null (0).

◆ SetSize() [1/4]

void SetSize ( const nsize_type & matrixSize)

◆ SetSize() [2/4]

void SetSize ( const nsize_type & matrixSize,
bool storageOrder )

◆ SetSize() [3/4]

void SetSize ( size_type rows,
size_type cols )

◆ SetSize() [4/4]

void SetSize ( size_type rows,
size_type cols,
bool storageOrder )

DESTRUCTIVE size change. Change the size to the specified size. Discard of all the old values. The storage order can be either VCT_ROW_MAJOR or VCT_COL_MAJOR. If the storage order is not specified, it is not modified.

◆ vctDynamicMatrix() [1/10]

vctDynamicMatrix ( const nsize_type & matrixSize,
bool storageOrder = VCT_DEFAULT_STORAGE )

◆ vctDynamicMatrix() [2/10]

vctDynamicMatrix ( const nsize_type & matrixSize,
value_type value,
bool storageOrder = VCT_DEFAULT_STORAGE )

◆ vctDynamicMatrix() [3/10]

vctDynamicMatrix ( const ThisType & otherMatrix)

Copy constructor: Allocate memory to store a copy of the other matrix, and copy the elements of the other matrix to this matrix.

◆ vctDynamicMatrix() [4/10]

template<class __matrixOwnerType, typename __otherMatrixElementType>
vctDynamicMatrix ( const vctDynamicConstMatrixBase< __matrixOwnerType, __otherMatrixElementType > & otherMatrix)
explicit

Copy constructor: Allocate memory and copy all the elements from the other matrix. The storage order of the copied matrix is defined by the source matrix. This constructor can also be used for type conversions.

◆ vctDynamicMatrix() [5/10]

template<class __matrixOwnerType, typename __otherMatrixElementType>
vctDynamicMatrix ( const vctDynamicConstMatrixBase< __matrixOwnerType, __otherMatrixElementType > & otherMatrix,
bool storageOrder )

Copy constructor: Allocate memory and copy all the elements from the other matrix. The storage order can be either VCT_ROW_MAJOR or VCT_COL_MAJOR.

◆ vctDynamicMatrix() [6/10]

template<class __matrixOwnerType>
vctDynamicMatrix ( const vctDynamicConstMatrixBase< __matrixOwnerType, value_type > & otherMatrix)

Copy constructor: Allocate memory and copy all the elements from the other matrix. The storage order of the copied matrix is defined by the source matrix.

◆ vctDynamicMatrix() [7/10]

template<size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, class __elementType, class __dataPtrType>
vctDynamicMatrix ( const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, __elementType, __dataPtrType > & other)
explicit

Constructor from a fixed size matrix.

◆ vctDynamicMatrix() [8/10]

vctDynamicMatrix ( const vctReturnDynamicMatrix< value_type > & otherMatrix)

Special copy constructor: Take ownership of the data of a temporary matrix object of type vctReturnDynamicMatrix. Disown the other matrix.

◆ vctDynamicMatrix() [9/10]

vctDynamicMatrix ( size_type rows,
size_type cols,
bool storageOrder = VCT_DEFAULT_STORAGE )

◆ vctDynamicMatrix() [10/10]

vctDynamicMatrix ( size_type rows,
size_type cols,
value_type value,
bool storageOrder = VCT_DEFAULT_STORAGE )

Constructor: Create a matrix of the specified size and assign all elements a specific value. The storage order can be either VCT_ROW_MAJOR or VCT_COL_MAJOR.

◆ vctDynamicMatrixElementwiseCompareMatrix()

template<class _matrixOwnerType, class __matrixOwnerType, class _elementType, class _elementOperationType>
vctReturnDynamicMatrix< bool > vctDynamicMatrixElementwiseCompareMatrix ( const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > & matrix1,
const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > & matrix2 )
inline

◆ vctDynamicMatrixElementwiseCompareScalar()

template<class _matrixOwnerType, class _elementType, class _elementOperationType>
vctReturnDynamicMatrix< bool > vctDynamicMatrixElementwiseCompareScalar ( const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > & matrix,
const _elementType & scalar )
inline