cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | List of all members
vctDynamicMatrixBase< _matrixOwnerType, _elementType > Class Template Reference

#include <vctDynamicMatrixBase.h>

Inheritance diagram for vctDynamicMatrixBase< _matrixOwnerType, _elementType >:
vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > vctDynamicMatrix< _ValueType > vctDynamicMatrix< CISSTNETLIB_DOUBLE > vctDynamicMatrix< CISSTNETLIB_INTEGER > vctDynamicMatrix< double > vctDynamicMatrix< float > vctDynamicMatrix< int > vctDynamicMatrix< short > vctDynamicMatrix< svlTarget2D > vctDynamicMatrix< unsigned char > vctDynamicMatrix< VariableType > vctDynamicMatrixRef< _ValueType > vctDynamicMatrixRef< CISSTNETLIB_DOUBLE > vctDynamicMatrixRef< double > vctDynamicMatrixRef< float > vctDynamicMatrixRef< unsigned char >

Classes

class  Submatrix
 

Public Types

typedef vctDynamicMatrixBase ThisType
 
typedef
vctDynamicConstMatrixBase
< _matrixOwnerType,
_elementType > 
BaseType
 
typedef _matrixOwnerType OwnerType
 
typedef BaseType::iterator iterator
 
typedef BaseType::reverse_iterator reverse_iterator
 
typedef BaseType::const_iterator const_iterator
 
typedef
BaseType::const_reverse_iterator 
const_reverse_iterator
 
typedef BaseType::ConstRowRefType ConstRowRefType
 
typedef BaseType::RowRefType RowRefType
 
typedef
BaseType::ConstColumnRefType 
ConstColumnRefType
 
typedef BaseType::ColumnRefType ColumnRefType
 
typedef
BaseType::ConstDiagonalRefType 
ConstDiagonalRefType
 
typedef BaseType::DiagonalRefType DiagonalRefType
 
typedef
BaseType::ConstRefTransposeType 
ConstRefTransposeType
 
typedef BaseType::RefTransposeType RefTransposeType
 
typedef
BaseType::ConstVectorPointerType 
ConstVectorPointerType
 
typedef BaseType::VectorPointerType VectorPointerType
 
- Public Types inherited from vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >
enum  { DIMENSION = 2 }
 
typedef
vctDynamicConstMatrixBase
< _matrixOwnerType,
_elementType > 
ThisType
 
typedef _matrixOwnerType OwnerType
 
typedef OwnerType::iterator iterator
 
typedef OwnerType::const_iterator const_iterator
 
typedef OwnerType::reverse_iterator reverse_iterator
 
typedef
OwnerType::const_reverse_iterator 
const_reverse_iterator
 
typedef
vctDynamicConstVectorRef
< _elementType > 
ConstRowRefType
 
typedef vctDynamicVectorRef
< _elementType > 
RowRefType
 
typedef
vctDynamicConstVectorRef
< _elementType > 
ConstColumnRefType
 
typedef vctDynamicVectorRef
< _elementType > 
ColumnRefType
 
typedef
vctDynamicConstVectorRef
< _elementType > 
ConstDiagonalRefType
 
typedef vctDynamicVectorRef
< _elementType > 
DiagonalRefType
 
typedef
vctDynamicConstMatrixRef
< _elementType > 
ConstRefTransposeType
 
typedef vctDynamicMatrixRef
< _elementType > 
RefTransposeType
 
typedef vctDynamicMatrix
< _elementType > 
TransposeValueType
 
typedef vctDynamicMatrix
< _elementType > 
MatrixValueType
 
typedef vctReturnDynamicMatrix
< _elementType > 
MatrixReturnType
 
typedef cmnTypeTraits< value_type > TypeTraits
 
typedef TypeTraits::BoolType BoolType
 
typedef vctReturnDynamicMatrix
< BoolType
BoolMatrixReturnType
 
typedef vctDynamicVector
< const_pointer > 
ConstVectorPointerType
 
typedef vctDynamicVector< pointer > VectorPointerType
 

Public Member Functions

 VCT_CONTAINER_TRAITS_TYPEDEFS (_elementType)
 
iterator begin (void)
 
iterator end (void)
 
reverse_iterator rbegin (void)
 
reverse_iterator rend (void)
 
const_iterator begin (void) const
 
const_iterator end (void) const
 
const_reverse_iterator rbegin (void) const
 
const_reverse_iterator rend (void) const
 
RowRefType operator[] (size_type index)
 
ConstRowRefType operator[] (size_type index) const
 
const OwnerTypeOwner (void) const
 
OwnerTypeOwner (void)
 
pointer Pointer (size_type rowIndex, size_type colIndex)
 
pointer Pointer (void)
 
const_pointer Pointer (size_type rowIndex, size_type colIndex) const
 
const_pointer Pointer (void) const
 
reference at (size_type index) throw (std::out_of_range)
 
const_reference at (size_type index) const throw (std::out_of_range)
 
reference at (size_type rowIndex, size_type colIndex) throw (std::out_of_range)
 
const_reference at (size_type rowIndex, size_type colIndex) const throw (std::out_of_range)
 
reference operator() (size_type rowIndex, size_type colIndex) throw (std::out_of_range)
 
const_reference operator() (size_type rowIndex, size_type colIndex) const throw (std::out_of_range)
 
reference Element (size_type rowIndex, size_type colIndex)
 
const_reference Element (size_type rowIndex, size_type colIndex) const
 
template<class __matrixOwnerType >
void RowPermutationOf (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &inputMatrix, const index_type permutedRowIndexes[])
 
template<class __matrixOwnerType >
void RowInversePermutationOf (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &inputMatrix, const index_type permutedRowIndexes[])
 
template<class __matrixOwnerType >
void ColumnPermutationOf (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &inputMatrix, const index_type permutedColumnIndexes[])
 
template<class __matrixOwnerType >
void ColumnInversePermutationOf (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &inputMatrix, const index_type permutedColumnIndexes[])
 
value_type SetAll (const value_type value)
 
bool Zeros (void)
 
ThisTypeAssign (const value_type *elements, bool inputIsRowMajor=true)
 
ThisTypeAssign (const value_type element0,...)
 
RefTransposeType TransposeRef (void)
 
ConstRefTransposeType TransposeRef (void) const
 
template<class __matrixOwnerType >
ThisTypeAddProductOf (const value_type scalar, const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
 
template<class __matrixOwnerType1 , class __matrixOwnerType2 >
ThisTypeAddElementwiseProductOf (const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &matrix1, const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &matrix2)
 
template<class __matrixOwnerType1 , class __matrixOwnerType2 >
void ProductOf (const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &matrix1, const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &matrix2)
 
template<class __vectorOwnerType1 , class __vectorOwnerType2 >
void OuterProductOf (const vctDynamicConstVectorBase< __vectorOwnerType1, _elementType > &colVector, const vctDynamicConstVectorBase< __vectorOwnerType2, _elementType > &rowVector)
 
Row and column references.
RowRefType Row (size_type index) throw (std::out_of_range)
 
ColumnRefType Column (size_type index) throw (std::out_of_range)
 
DiagonalRefType Diagonal (void)
 
VectorPointerTypeRowPointers (VectorPointerType &rowPointers) throw (std::runtime_error)
 
ConstRowRefType Row (size_type index) const throw (std::out_of_range)
 
ConstColumnRefType Column (size_type index) const throw (std::out_of_range)
 
ConstDiagonalRefType Diagonal (void) const
 
ConstVectorPointerType RowPointers (ConstVectorPointerType &rowPointers) const throw (std::runtime_error)
 
vctDynamicMatrixRef< _elementType > Ref (const size_type rows, const size_type cols, const size_type startRow=0, const size_type startCol=0) throw (std::out_of_range)
 
vctDynamicConstMatrixRef
< _elementType > 
Ref (const size_type rows, const size_type cols, const size_type startRow=0, const size_type startCol=0) const throw (std::out_of_range)
 
void ExchangeRows (const size_type row1Index, const size_type row2Index)
 
void ExchangeColumns (const size_type col1Index, const size_type col2Index)
 
template<class __inputMatrixOwnerType , class __indexVectorOwnerType >
void SelectRowsFrom (const vctDynamicConstMatrixBase< __inputMatrixOwnerType, _elementType > &inputMatrix, const vctDynamicConstVectorBase< __indexVectorOwnerType, index_type > &rowIndexVector)
 
template<class __inputMatrixOwnerType , class __indexVectorOwnerType >
void SelectColsFrom (const vctDynamicConstMatrixBase< __inputMatrixOwnerType, _elementType > &inputMatrix, const vctDynamicConstVectorBase< __indexVectorOwnerType, index_type > &colIndexVector)
 
Assignment operation between matrices containing the same data type but different owners
Parameters
otherThe matrix to be copied.
template<class __matrixOwnerType >
ThisTypeAssign (const vctDynamicConstMatrixBase< __matrixOwnerType, value_type > &other)
 
Assignment operation between matrices of different types.
Parameters
otherThe matrix to be copied.
template<class __matrixOwnerType , typename __elementType >
ThisTypeAssign (const vctDynamicConstMatrixBase< __matrixOwnerType, __elementType > &other)
 
template<class __matrixOwnerType , typename __elementType >
ThisTypeoperator= (const vctDynamicConstMatrixBase< __matrixOwnerType, __elementType > &other)
 
template<size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, class __elementType , class __dataPtrType >
ThisTypeAssign (const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, __elementType, __dataPtrType > &other)
 
Forced assignment operation between matrices of

different types. This method will use SetSize on the destination matrix (this matrix) to make sure the assignment will work. It is important to note that if the sizes don't match, memory for this matrix will be re-allocated. If the program has previously created some references (as in vctDynamic{Const}MatrixRef) on this matrix, they will become invalid.

Note
For a non-reallocating Assign, it is recommended to use the Assign() methods.
If the destination matrix doesn't have the same size as the source and can not be resized, an exception will be thrown by the Assign method called internally.
This method is provided for both fixed size and dynamic matrices for API consistency (usable in templated code). There is obviously not resize involved on fixed size matrices.
Parameters
otherThe matrix to be copied.
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)
 
template<class __matrixOwnerType >
bool FastCopyOf (const vctDynamicConstMatrixBase< __matrixOwnerType, value_type > &source, bool performSafetyChecks=vctFastCopy::PerformChecks) throw (std::runtime_error)
 
template<size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, class __dataPtrType >
bool FastCopyOf (const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, value_type, __dataPtrType > &source, bool performSafetyChecks=vctFastCopy::PerformChecks) throw (std::runtime_error)
 
Binary elementwise operations between two matrices.

Store the result of op(this, otherMatrix) back to this matrix.

template<class __matrixOwnerType1 , class __matrixOwnerType2 >
ThisTypeSumOf (const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &matrix1, const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &matrix2)
 
template<class __matrixOwnerType1 , class __matrixOwnerType2 >
ThisTypeDifferenceOf (const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &matrix1, const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &matrix2)
 
template<class __matrixOwnerType1 , class __matrixOwnerType2 >
ThisTypeElementwiseProductOf (const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &matrix1, const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &matrix2)
 
template<class __matrixOwnerType1 , class __matrixOwnerType2 >
ThisTypeElementwiseRatioOf (const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &matrix1, const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &matrix2)
 
template<class __matrixOwnerType1 , class __matrixOwnerType2 >
ThisTypeElementwiseMinOf (const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &matrix1, const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &matrix2)
 
template<class __matrixOwnerType1 , class __matrixOwnerType2 >
ThisTypeElementwiseMaxOf (const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &matrix1, const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &matrix2)
 
template<class __matrixOwnerType >
ThisTypeAdd (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
 
template<class __matrixOwnerType >
ThisTypeSubtract (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
 
template<class __matrixOwnerType >
ThisTypeElementwiseMultiply (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
 
template<class __matrixOwnerType >
ThisTypeElementwiseDivide (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
 
template<class __matrixOwnerType >
ThisTypeElementwiseMin (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
 
template<class __matrixOwnerType >
ThisTypeElementwiseMax (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
 
template<class __matrixOwnerType >
ThisTypeoperator+= (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
 
template<class __matrixOwnerType >
ThisTypeoperator-= (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
 
Binary elementwise operations a matrix and a scalar.

Store the result of op(matrix, scalar) to a third matrix.

template<class __matrixOwnerType >
ThisTypeSumOf (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix, const value_type scalar)
 
template<class __matrixOwnerType >
ThisTypeDifferenceOf (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix, const value_type scalar)
 
template<class __matrixOwnerType >
ThisTypeProductOf (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix, const value_type scalar)
 
template<class __matrixOwnerType >
ThisTypeRatioOf (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix, const value_type scalar)
 
template<class __matrixOwnerType >
ThisTypeClippedAboveOf (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix, const value_type lowerBound)
 
template<class __matrixOwnerType >
ThisTypeClippedBelowOf (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix, const value_type upperBound)
 
Binary elementwise operations a scalar and a matrix.

Store the result of op(scalar, matrix) to a third matrix.

template<class __matrixOwnerType >
ThisTypeSumOf (const value_type scalar, const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix)
 
template<class __matrixOwnerType >
ThisTypeDifferenceOf (const value_type scalar, const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix)
 
template<class __matrixOwnerType >
ThisTypeProductOf (const value_type scalar, const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix)
 
template<class __matrixOwnerType >
ThisTypeRatioOf (const value_type scalar, const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix)
 
template<class __matrixOwnerType >
ThisTypeClippedAboveOf (const value_type upperBound, const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix)
 
template<class __matrixOwnerType >
ThisTypeClippedBelowOf (const value_type lowerBound, const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix)
 
Binary elementwise operations between a matrix and a scalar.

Store the result of op(this, scalar) back to this matrix.

ThisTypeAdd (const value_type scalar)
 
ThisTypeSubtract (const value_type scalar)
 
ThisTypeMultiply (const value_type scalar)
 
ThisTypeDivide (const value_type scalar)
 
ThisTypeClipAbove (const value_type upperBound)
 
ThisTypeClipBelow (const value_type lowerBound)
 
ThisTypeoperator+= (const value_type scalar)
 
ThisTypeoperator-= (const value_type scalar)
 
ThisTypeoperator*= (const value_type scalar)
 
ThisTypeoperator/= (const value_type scalar)
 
Unary elementwise operations.

Store the result of op(matrix) to another matrix.

template<class __matrixOwnerType >
ThisTypeAbsOf (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
 
template<class __matrixOwnerType >
ThisTypeNegationOf (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
 
template<class __matrixOwnerType >
ThisTypeFloorOf (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
 
template<class __matrixOwnerType >
ThisTypeCeilOf (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
 
template<class __matrixOwnerType >
ThisTypeTransposeOf (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
 
Store back unary elementwise operations.

Store the result of op(this) to this matrix.

ThisTypeAbsSelf (void)
 
ThisTypeNegationSelf (void)
 
ThisTypeFloorSelf (void)
 
ThisTypeCeilSelf (void)
 
- Public Member Functions inherited from vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >
 VCT_CONTAINER_TRAITS_TYPEDEFS (_elementType)
 
 VCT_NARRAY_TRAITS_TYPEDEFS (DIMENSION)
 
const_iterator begin (void) const
 
const_iterator end (void) const
 
const_reverse_iterator rbegin (void) const
 
const_reverse_iterator rend (void) const
 
size_type size (void) const
 
const nsize_type & sizes (void) const
 
size_type rows () const
 
size_type cols () const
 
size_type height () const
 
size_type width () const
 
const nstride_type & strides (void) const
 
difference_type row_stride () const
 
difference_type col_stride () const
 
bool empty () const
 
ConstRowRefType operator[] (size_type index) const
 
const_reference at (size_type index) const throw (std::out_of_range)
 
const OwnerTypeOwner (void) const
 
const_pointer Pointer (index_type rowIndex, index_type colIndex) const
 
const_pointer Pointer (void) const
 
bool ValidIndex (size_type index) const
 
bool ValidIndex (size_type rowIndex, size_type colIndex) const
 
bool ValidRowIndex (size_type rowIndex) const
 
bool ValidColIndex (size_type colIndex) const
 
const_reference at (size_type rowIndex, size_type colIndex) const throw (std::out_of_range)
 
const_reference operator() (size_type rowIndex, size_type colIndex) const throw (std::out_of_range)
 
const_reference Element (size_type rowIndex, size_type colIndex) const
 
ConstRowRefType Row (size_type index) const throw (std::out_of_range)
 
ConstColumnRefType Column (size_type index) const throw (std::out_of_range)
 
ConstDiagonalRefType Diagonal () const
 
ConstVectorPointerTypeRowPointers (ConstVectorPointerType &rowPointers) const throw (std::runtime_error)
 
vctDynamicConstMatrixRef
< _elementType > 
Ref (const size_type rows, const size_type cols, const size_type startRow=0, const size_type startCol=0) const throw (std::out_of_range)
 
ConstRefTransposeType TransposeRef (void) const
 
MatrixReturnType Transpose () const
 
std::string ToString (void)
 
void ToStream (std::ostream &outputStream) const
 
void ToStreamRaw (std::ostream &outputStream, const char delimiter= ' ', bool headerOnly=false, const std::string &headerPrefix="") const
 
void SerializeRaw (std::ostream &outputStream) const
 
value_type SumOfElements (void) const
 
value_type ProductOfElements (void) const
 
value_type Trace (void) const
 
value_type NormSquare (void) const
 
NormType Norm (void) const
 
value_type L1Norm (void) const
 
value_type LinfNorm (void) const
 
value_type MaxElement (void) const
 
value_type MinElement (void) const
 
value_type MaxAbsElement (void) const
 
value_type MinAbsElement (void) const
 
void MinAndMaxElement (value_type &minElement, value_type &maxElement) const
 
bool IsPositive (void) const
 
bool IsNonNegative (void) const
 
bool IsNonPositive (void) const
 
bool IsNegative (void) const
 
bool All (void) const
 
bool Any (void) const
 
bool IsFinite (void) const
 
bool HasNaN (void) const
 
bool IsColMajor (void) const
 
bool IsRowMajor (void) const
 
bool IsCompact (void) const
 
bool IsFortran (void) const
 
bool StorageOrder (void) const
 
bool IsSquare (void) const
 
bool IsSquare (size_type size) const
 
template<class __matrixOwnerType >
bool FastCopyCompatible (const vctDynamicConstMatrixBase< __matrixOwnerType, value_type > &source) const
 
template<size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, class __dataPtrType >
bool FastCopyCompatible (const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, value_type, __dataPtrType > &source) const
 
template<class __matrixOwnerType >
bool Equal (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
 
template<class __matrixOwnerType >
bool operator== (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
 
template<class __matrixOwnerType >
bool AlmostEqual (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix, value_type tolerance) const
 
template<class __matrixOwnerType >
bool AlmostEqual (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
 
template<class __matrixOwnerType >
bool NotEqual (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
 
template<class __matrixOwnerType >
bool operator!= (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
 
template<class __matrixOwnerType >
bool Lesser (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
 
template<class __matrixOwnerType >
bool LesserOrEqual (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
 
template<class __matrixOwnerType >
bool Greater (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
 
template<class __matrixOwnerType >
bool GreaterOrEqual (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
 
template<class __matrixOwnerType >
BoolMatrixReturnType ElementwiseEqual (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
 
template<class __matrixOwnerType >
BoolMatrixReturnType ElementwiseNotEqual (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
 
template<class __matrixOwnerType >
BoolMatrixReturnType ElementwiseLesser (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
 
template<class __matrixOwnerType >
BoolMatrixReturnType ElementwiseLesserOrEqual (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
 
template<class __matrixOwnerType >
BoolMatrixReturnType ElementwiseGreater (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
 
template<class __matrixOwnerType >
BoolMatrixReturnType ElementwiseGreaterOrEqual (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
 
bool Equal (const value_type &scalar) const
 
bool operator== (const value_type &scalar) const
 
bool NotEqual (const value_type &scalar) const
 
bool operator!= (const value_type &scalar) const
 
bool Lesser (const value_type &scalar) const
 
bool LesserOrEqual (const value_type &scalar) const
 
bool Greater (const value_type &scalar) const
 
bool GreaterOrEqual (const value_type &scalar) const
 
BoolMatrixReturnType ElementwiseEqual (const value_type &scalar) const
 
BoolMatrixReturnType ElementwiseNotEqual (const value_type &scalar) const
 
BoolMatrixReturnType ElementwiseLesser (const value_type &scalar) const
 
BoolMatrixReturnType ElementwiseLesserOrEqual (const value_type &scalar) const
 
BoolMatrixReturnType ElementwiseGreater (const value_type &scalar) const
 
BoolMatrixReturnType ElementwiseGreaterOrEqual (const value_type &scalar) const
 
MatrixReturnType Abs (void) const
 
MatrixReturnType Negation (void) const
 
MatrixReturnType Floor (void) const
 
MatrixReturnType Ceil (void) const
 

Additional Inherited Members

- Static Public Member Functions inherited from vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >
static MatrixReturnType Eye (size_type size)
 
- Protected Member Functions inherited from vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >
void ThrowUnlessValidIndex (size_type index) const throw (std::out_of_range)
 
void ThrowUnlessValidIndex (size_type rowIndex, size_type colIndex) const throw (std::out_of_range)
 
void ThrowUnlessValidRowIndex (size_type index) const throw (std::out_of_range)
 
void ThrowUnlessValidColIndex (size_type index) const throw (std::out_of_range)
 
- Protected Attributes inherited from vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >
OwnerType Matrix
 

Detailed Description

template<class _matrixOwnerType, typename _elementType>
class vctDynamicMatrixBase< _matrixOwnerType, _elementType >

This class provides all the const methods inherited from vctConstMatrixBase, and extends them with non-const methods, such as SumOf.

See Also
vctDynamicConstMatrixBase

Member Typedef Documentation

template<class _matrixOwnerType, typename _elementType>
typedef vctDynamicConstMatrixBase<_matrixOwnerType, _elementType> vctDynamicMatrixBase< _matrixOwnerType, _elementType >::BaseType

Type of the base class.

template<class _matrixOwnerType, typename _elementType>
typedef BaseType::ColumnRefType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ColumnRefType
template<class _matrixOwnerType, typename _elementType>
typedef BaseType::const_iterator vctDynamicMatrixBase< _matrixOwnerType, _elementType >::const_iterator
template<class _matrixOwnerType, typename _elementType>
typedef BaseType::const_reverse_iterator vctDynamicMatrixBase< _matrixOwnerType, _elementType >::const_reverse_iterator
template<class _matrixOwnerType, typename _elementType>
typedef BaseType::ConstColumnRefType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ConstColumnRefType
template<class _matrixOwnerType, typename _elementType>
typedef BaseType::ConstDiagonalRefType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ConstDiagonalRefType
template<class _matrixOwnerType, typename _elementType>
typedef BaseType::ConstRefTransposeType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ConstRefTransposeType
template<class _matrixOwnerType, typename _elementType>
typedef BaseType::ConstRowRefType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ConstRowRefType
template<class _matrixOwnerType, typename _elementType>
typedef BaseType::ConstVectorPointerType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ConstVectorPointerType
template<class _matrixOwnerType, typename _elementType>
typedef BaseType::DiagonalRefType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::DiagonalRefType
template<class _matrixOwnerType, typename _elementType>
typedef BaseType::iterator vctDynamicMatrixBase< _matrixOwnerType, _elementType >::iterator
template<class _matrixOwnerType, typename _elementType>
typedef _matrixOwnerType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::OwnerType
template<class _matrixOwnerType, typename _elementType>
typedef BaseType::RefTransposeType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::RefTransposeType
template<class _matrixOwnerType, typename _elementType>
typedef BaseType::reverse_iterator vctDynamicMatrixBase< _matrixOwnerType, _elementType >::reverse_iterator
template<class _matrixOwnerType, typename _elementType>
typedef BaseType::RowRefType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::RowRefType
template<class _matrixOwnerType, typename _elementType>
typedef vctDynamicMatrixBase vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ThisType
template<class _matrixOwnerType, typename _elementType>
typedef BaseType::VectorPointerType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::VectorPointerType

Member Function Documentation

template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::AbsOf ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  otherMatrix)
inline

Unary elementwise operations on a matrix. For each element of the matrix "this", performs $ this[i] \leftarrow op(otherMatrix[i])$ where $op$ can calculate the absolute value (AbsOf), the opposite (NegationOf) or the transpose (TransposeOf).

Parameters
otherMatrixThe operand of the unary operation.
Returns
The matrix "this" modified.
template<class _matrixOwnerType, typename _elementType>
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::AbsSelf ( void  )
inline

Unary elementwise operations on a matrix. For each element of the matrix "this", performs $ this[i] \leftarrow op(this[i])$ where $op$ can calculate the absolute value (AbsSelf) or the opposite (NegationSelf).

Returns
The matrix "this" modified.
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Add ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  otherMatrix)
inline

Store back binary elementwise operations between two matrices. For each element of the matrices, performs $ this[i] \leftarrow op(this[i], otherMatrix[i])$ where $op$ is either an addition (Add), a subtraction (Subtraction), a multiplication (ElementwiseMultiply) a division (ElementwiseDivide), a minimization (ElementwiseMin) or a maximisation (ElementwiseMax).

Parameters
otherMatrixThe second operand of the binary operation (this[i] is the first operand)
Returns
The matrix "this" modified.
template<class _matrixOwnerType, typename _elementType>
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Add ( const value_type  scalar)
inline

Store back binary elementwise operations between a matrix and a scalar. For each element of the matrix "this", performs $ this[i] \leftarrow op(this[i], scalar)$ where $op$ is either an addition (Add), a subtraction (Subtract), a multiplication (Multiply), a division (Divide), a minimum (ClipAbove) or a maximum (ClipBelow).

Parameters
scalarThe second operand of the binary operation (this[i] is the first operand.
Returns
The matrix "this" modified.
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType1 , class __matrixOwnerType2 >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::AddElementwiseProductOf ( const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &  matrix1,
const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &  matrix2 
)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::AddProductOf ( const value_type  scalar,
const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  otherMatrix 
)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Assign ( const vctDynamicConstMatrixBase< __matrixOwnerType, value_type > &  other)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType , typename __elementType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Assign ( const vctDynamicConstMatrixBase< __matrixOwnerType, __elementType > &  other)
inline
template<class _matrixOwnerType, typename _elementType>
template<size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, class __elementType , class __dataPtrType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Assign ( const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, __elementType, __dataPtrType > &  other)
inline
template<class _matrixOwnerType, typename _elementType>
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Assign ( const value_type *  elements,
bool  inputIsRowMajor = true 
)
inline

Assign to this matrix values from a C array given as a pointer to value_type. The purpose of this method is to simplify the syntax by not necessitating the creation of an explicit matrix for the given array. However, we only provide this method for an array of value_type. For arrays of other types a matrix still needs to be declared.

Parameters
elementsa pointer to a C array of elements to be assigned to this matrix.
inputIsRowMajora flag indicating the storage order of the elements in the input array.
Note
For lack of better knowledge, this method assumes that the input array is packed, that is, that all the elements are stored in a contiguous memory block with no gaps. The only existing options now relate to the storage order of the input elements. If the input is not packed, you should create a MatrixRef explicitly, with stride specifications, or use other tricks.
Returns
a reference to this object.
template<class _matrixOwnerType, typename _elementType>
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Assign ( const value_type  element0,
  ... 
)
inline

Assign to this matrix a set of values provided as independent arguments, by using cstdarg macros, that is, an unspecified number of arguments. This operation assumes that all the arguments are of type value_type, and that their number is equal to the size of the matrix. The arguments are passed by value. The user may need to explicitly cast the parameters to value_type to avoid runtime bugs and errors. The order of the paramaters is row first which allows to keep the code pretty intuitive:

matrix.Assign( 0.0, 1.0,
-1.0, 0.0);
Returns
a reference to this matrix.
template<class _matrixOwnerType, typename _elementType>
reference vctDynamicMatrixBase< _matrixOwnerType, _elementType >::at ( size_type  index)
throw (std::out_of_range
)
inline

Access an element by index (const). Compare with std::vector::at. This method can be a handy substitute for the overloaded operator [] when operator overloading is unavailable or inconvenient.

Returns
a non-const reference to element[index]
template<class _matrixOwnerType, typename _elementType>
const_reference vctDynamicMatrixBase< _matrixOwnerType, _elementType >::at ( size_type  index) const
throw (std::out_of_range
)
inline
template<class _matrixOwnerType, typename _elementType>
reference vctDynamicMatrixBase< _matrixOwnerType, _elementType >::at ( size_type  rowIndex,
size_type  colIndex 
)
throw (std::out_of_range
)
inline

Access an element by index. Compare with std::vector::at(). This method can be a handy substitute for the overloaded operator () when operator overloading is unavailable or inconvenient.

Returns
a reference to the element at rowIndex, colIndex
template<class _matrixOwnerType, typename _elementType>
const_reference vctDynamicMatrixBase< _matrixOwnerType, _elementType >::at ( size_type  rowIndex,
size_type  colIndex 
) const
throw (std::out_of_range
)
inline
template<class _matrixOwnerType, typename _elementType>
iterator vctDynamicMatrixBase< _matrixOwnerType, _elementType >::begin ( void  )
inline

Returns an iterator on the first element (STL compatibility).

template<class _matrixOwnerType, typename _elementType>
const_iterator vctDynamicMatrixBase< _matrixOwnerType, _elementType >::begin ( void  ) const
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::CeilOf ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  otherMatrix)
inline
template<class _matrixOwnerType, typename _elementType>
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::CeilSelf ( void  )
inline
template<class _matrixOwnerType, typename _elementType>
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ClipAbove ( const value_type  upperBound)
inline
template<class _matrixOwnerType, typename _elementType>
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ClipBelow ( const value_type  lowerBound)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ClippedAboveOf ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  matrix,
const value_type  lowerBound 
)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ClippedAboveOf ( const value_type  upperBound,
const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  matrix 
)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ClippedBelowOf ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  matrix,
const value_type  upperBound 
)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ClippedBelowOf ( const value_type  lowerBound,
const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  matrix 
)
inline
template<class _matrixOwnerType, typename _elementType>
ColumnRefType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Column ( size_type  index)
throw (std::out_of_range
)
inline

Create a column reference.

template<class _matrixOwnerType, typename _elementType>
ConstColumnRefType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Column ( size_type  index) const
throw (std::out_of_range
)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
void vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ColumnInversePermutationOf ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  inputMatrix,
const index_type  permutedColumnIndexes[] 
)
inline

Assign a permutation of the columns of the input matrix to the column of this matrix. Both matrices must have the same size.

Parameters
inputMatrixthe input matrix for the permutation.
permutedColumnIndexesan array of column indices. The assignment performed is: this->Column( permutedColumnIndexes[i] ) <– inputMatrix.Column(i).
Note
The current implementation does not validate that the input permuted indexes is an actual permutation of the numbers 0..(COLS-1). Nor does it assure that the input permutation array has the right size. Both are the caller's responsibility.
Do not use this method for an in-place permutation of the input matrix.
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
void vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ColumnPermutationOf ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  inputMatrix,
const index_type  permutedColumnIndexes[] 
)
inline

Assign a permutation of the columns of the input matrix to the column of this matrix. Both matrices must have the same size.

Parameters
inputMatrixthe input matrix for the permutation.
permutedColumnIndexesan array of column indices. The assignment performed is: this->Column(i) <– inputMatrix.Column( permutedColumnIndexes[i] ).
Note
The current implementation does not validate that the input permuted indexes is an actual permutation of the numbers 0..(COLS-1). Nor does it assure that the input permutation array has the right size. Both are the caller's responsibility.
Do not use this method for an in-place permutation of the input matrix.
template<class _matrixOwnerType, typename _elementType>
DiagonalRefType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Diagonal ( void  )
inline

Create a non-const reference to the main diagonal of this matrix

template<class _matrixOwnerType, typename _elementType>
ConstDiagonalRefType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Diagonal ( void  ) const
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType1 , class __matrixOwnerType2 >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::DifferenceOf ( const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &  matrix1,
const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &  matrix2 
)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::DifferenceOf ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  matrix,
const value_type  scalar 
)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::DifferenceOf ( const value_type  scalar,
const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  matrix 
)
inline
template<class _matrixOwnerType, typename _elementType>
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Divide ( const value_type  scalar)
inline
template<class _matrixOwnerType, typename _elementType>
reference vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Element ( size_type  rowIndex,
size_type  colIndex 
)
inline

Access an element by indices (non const). This method allows to access an element without any bounds checking. It doesn't create any temporary row reference as a matrix[][] would do.

Returns
a reference to the element at rowIndex, colIndex
template<class _matrixOwnerType, typename _elementType>
const_reference vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Element ( size_type  rowIndex,
size_type  colIndex 
) const
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ElementwiseDivide ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  otherMatrix)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ElementwiseMax ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  otherMatrix)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType1 , class __matrixOwnerType2 >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ElementwiseMaxOf ( const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &  matrix1,
const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &  matrix2 
)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ElementwiseMin ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  otherMatrix)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType1 , class __matrixOwnerType2 >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ElementwiseMinOf ( const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &  matrix1,
const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &  matrix2 
)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ElementwiseMultiply ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  otherMatrix)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType1 , class __matrixOwnerType2 >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ElementwiseProductOf ( const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &  matrix1,
const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &  matrix2 
)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType1 , class __matrixOwnerType2 >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ElementwiseRatioOf ( const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &  matrix1,
const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &  matrix2 
)
inline
template<class _matrixOwnerType, typename _elementType>
iterator vctDynamicMatrixBase< _matrixOwnerType, _elementType >::end ( void  )
inline

Returns an iterator on the last element (STL compatibility).

template<class _matrixOwnerType, typename _elementType>
const_iterator vctDynamicMatrixBase< _matrixOwnerType, _elementType >::end ( void  ) const
inline
template<class _matrixOwnerType, typename _elementType>
void vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ExchangeColumns ( const size_type  col1Index,
const size_type  col2Index 
)
inline

Exchange two colums of the matrix

template<class _matrixOwnerType, typename _elementType>
void vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ExchangeRows ( const size_type  row1Index,
const size_type  row2Index 
)
inline

Exchange two rows of the matrix

template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
bool vctDynamicMatrixBase< _matrixOwnerType, _elementType >::FastCopyOf ( const vctDynamicConstMatrixBase< __matrixOwnerType, value_type > &  source,
bool  performSafetyChecks = vctFastCopy::PerformChecks 
)
throw (std::runtime_error
)
inline

Fast copy. This method uses memcpy whenever it is possible to perform a fast copy from another matrix to this matrix.

  • The method will first verify that the source and destination have the same size (rows and columns) and throws an exception otherwise (std::runtime_error). See cmnThrow for details.
  • If any of the two matrices is not compact or if the two matrices use a different storage order, this method will return false. If both matrices are compact and use the same storage order, a single memcpy is performed and the method returns true.
  • If the two matrices are compact by row or column, this method will use multiple calls to memcpy, i.e. one per row or column and the method returns true
  • To avoid the tests above, one can set the parameter performSafetyChecks to vctFastCopy::SkipChecks (boolean defined false). This should be used only when the programmer knows for sure that the source and destination are compatible (size, storage order and compactness).
  • As opposed to Assign, this method doesn't perform any type conversion.
  • Since no constructor is called for the contained elements, this function performs a "shallow copy". If the contained objects have a pointer as data member, the copied object will carry on the same pointer (hence pointing at the same memory block which could easily lead to bugs).

The basic and safe use of this method for a matrix would be:

if (!destination.FastCopyOf(source)) {
destination.Assign(source);
}

If the method is to be called many times (in a loop for example), it is recommended to check that the source and destination are compatible once and then use the option to turn off the different safety checks for each FastCopyOf.

bool canUseFastCopy = destination.FastCopyCompatible(source);
for (index = 0; index < 1000; index++) {
DoSomethingUseful(source);
if (canUseFastCopy) {
destination.FastCopyOf(source, vctFastCopy::SkipChecks); // Do not check again
} else {
destination.Assign(source);
}
}

Finally, this method will work on either matrices which have allocated their memory of matrix references (such as vctDynamicMatrixRef). So, to copy a part of a matrix, the programmer can do:

typedef unsigned short PixelType;
vctDynamicMatrixRef<PixelType> upperLeftRef(image, 0, 0, 320, 240);
// use FastCopyCompatible to make sure the sizes and strides match
// and then use FastCopyOf without the safety checks
working.FastCopyOf(upperLeft, vctFastCopy::SkipChecks);
Parameters
sourceMatrix used to set the content of this matrix.
performSafetyChecksFlag set to false to avoid safety checks, use with extreme caution. To make your code more readable use vctFastCopy::SkipChecks or vctFastCopy::PerformChecks.
template<class _matrixOwnerType, typename _elementType>
template<size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, class __dataPtrType >
bool vctDynamicMatrixBase< _matrixOwnerType, _elementType >::FastCopyOf ( const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, value_type, __dataPtrType > &  source,
bool  performSafetyChecks = vctFastCopy::PerformChecks 
)
throw (std::runtime_error
)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::FloorOf ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  otherMatrix)
inline
template<class _matrixOwnerType, typename _elementType>
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::FloorSelf ( void  )
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType , typename __elementType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ForceAssign ( const vctDynamicConstMatrixBase< __matrixOwnerType, __elementType > &  other)
inline
template<class _matrixOwnerType, typename _elementType>
template<size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, class __elementType , class __dataPtrType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ForceAssign ( const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, __elementType, __dataPtrType > &  other)
inline
template<class _matrixOwnerType, typename _elementType>
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Multiply ( const value_type  scalar)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::NegationOf ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  otherMatrix)
inline
template<class _matrixOwnerType, typename _elementType>
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::NegationSelf ( void  )
inline
template<class _matrixOwnerType, typename _elementType>
reference vctDynamicMatrixBase< _matrixOwnerType, _elementType >::operator() ( size_type  rowIndex,
size_type  colIndex 
)
throw (std::out_of_range
)
inline

Overloaded operator () for simplified (non const) element access with bounds checking

template<class _matrixOwnerType, typename _elementType>
const_reference vctDynamicMatrixBase< _matrixOwnerType, _elementType >::operator() ( size_type  rowIndex,
size_type  colIndex 
) const
throw (std::out_of_range
)
inline
template<class _matrixOwnerType, typename _elementType>
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::operator*= ( const value_type  scalar)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::operator+= ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  otherMatrix)
inline
template<class _matrixOwnerType, typename _elementType>
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::operator+= ( const value_type  scalar)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::operator-= ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  otherMatrix)
inline
template<class _matrixOwnerType, typename _elementType>
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::operator-= ( const value_type  scalar)
inline
template<class _matrixOwnerType, typename _elementType>
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::operator/= ( const value_type  scalar)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType , typename __elementType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::operator= ( const vctDynamicConstMatrixBase< __matrixOwnerType, __elementType > &  other)
inline
template<class _matrixOwnerType, typename _elementType>
RowRefType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::operator[] ( size_type  index)
inline

Reference a row of this matrix by index.

Returns
a reference to the element[index]
template<class _matrixOwnerType, typename _elementType>
ConstRowRefType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::operator[] ( size_type  index) const
inline
template<class _matrixOwnerType, typename _elementType>
template<class __vectorOwnerType1 , class __vectorOwnerType2 >
void vctDynamicMatrixBase< _matrixOwnerType, _elementType >::OuterProductOf ( const vctDynamicConstVectorBase< __vectorOwnerType1, _elementType > &  colVector,
const vctDynamicConstVectorBase< __vectorOwnerType2, _elementType > &  rowVector 
)
inline

Compute the outer product of two vectors and store the result to this matrix. The outer product (v1*v2)[i,j] = v1[i] * v2[j]

template<class _matrixOwnerType, typename _elementType>
const OwnerType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Owner ( void  ) const
inline
template<class _matrixOwnerType, typename _elementType>
OwnerType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Owner ( void  )
inline
template<class _matrixOwnerType, typename _elementType>
pointer vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Pointer ( size_type  rowIndex,
size_type  colIndex 
)
inline

Return a non const pointer to an element of the container, specified by its indices. Addition to the STL requirements.

template<class _matrixOwnerType, typename _elementType>
pointer vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Pointer ( void  )
inline

Returns a non const pointer to the first element of the container. Addition to the STL requirements.

template<class _matrixOwnerType, typename _elementType>
const_pointer vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Pointer ( size_type  rowIndex,
size_type  colIndex 
) const
inline
template<class _matrixOwnerType, typename _elementType>
const_pointer vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Pointer ( void  ) const
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ProductOf ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  matrix,
const value_type  scalar 
)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ProductOf ( const value_type  scalar,
const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  matrix 
)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType1 , class __matrixOwnerType2 >
void vctDynamicMatrixBase< _matrixOwnerType, _elementType >::ProductOf ( const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &  matrix1,
const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &  matrix2 
)
inline

Product of two matrices. If the sizes of the matrices don't match, an exception is thrown.

Parameters
matrix1The left operand of the binary operation.
matrix2The right operand of the binary operation.
Returns
The matrix "this" modified.
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::RatioOf ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  matrix,
const value_type  scalar 
)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::RatioOf ( const value_type  scalar,
const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  matrix 
)
inline
template<class _matrixOwnerType, typename _elementType>
reverse_iterator vctDynamicMatrixBase< _matrixOwnerType, _elementType >::rbegin ( void  )
inline

Returns a reverse iterator on the last element (STL compatibility).

template<class _matrixOwnerType, typename _elementType>
const_reverse_iterator vctDynamicMatrixBase< _matrixOwnerType, _elementType >::rbegin ( void  ) const
inline
template<class _matrixOwnerType, typename _elementType>
vctDynamicMatrixRef<_elementType> vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Ref ( const size_type  rows,
const size_type  cols,
const size_type  startRow = 0,
const size_type  startCol = 0 
)
throw (std::out_of_range
)
inline

Create a reference to a sub matrix

template<class _matrixOwnerType, typename _elementType>
vctDynamicConstMatrixRef<_elementType> vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Ref ( const size_type  rows,
const size_type  cols,
const size_type  startRow = 0,
const size_type  startCol = 0 
) const
throw (std::out_of_range
)
inline
template<class _matrixOwnerType, typename _elementType>
reverse_iterator vctDynamicMatrixBase< _matrixOwnerType, _elementType >::rend ( void  )
inline

Returns a reverse iterator on the element before first (STL compatibility).

template<class _matrixOwnerType, typename _elementType>
const_reverse_iterator vctDynamicMatrixBase< _matrixOwnerType, _elementType >::rend ( void  ) const
inline
template<class _matrixOwnerType, typename _elementType>
RowRefType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Row ( size_type  index)
throw (std::out_of_range
)
inline

Create a row reference.

template<class _matrixOwnerType, typename _elementType>
ConstRowRefType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Row ( size_type  index) const
throw (std::out_of_range
)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
void vctDynamicMatrixBase< _matrixOwnerType, _elementType >::RowInversePermutationOf ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  inputMatrix,
const index_type  permutedRowIndexes[] 
)
inline

Assign a permutation of the rows of the input matrix to the rows of this matrix. Both matrices must have the same size.

Parameters
inputMatrixthe input matrix for the permutation.
permutedRowIndexesan array of row indices. The assignment performed is: this->Row( permutedRowIndexes[i] ) <– inputMatrix.Row(i).
Note
The current implementation does not validate that the input permuted indexes is an actual permutation of the numbers 0..(ROWS-1). Nor does it assure that the input permutation array has the right size. Both are the caller's responsibility.
Do not use this method for an in-place permutation of the input matrix.
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
void vctDynamicMatrixBase< _matrixOwnerType, _elementType >::RowPermutationOf ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  inputMatrix,
const index_type  permutedRowIndexes[] 
)
inline

Assign a permutation of the rows of the input matrix to the rows of this matrix. Both matrices must have the same size.

Parameters
inputMatrixthe input matrix for the permutation.
permutedRowIndexesan array of row indices. The assignment performed is: this->Row(i) <– inputMatrix.Row( permutedRowIndexes[i] ).
Note
The current implementation does not validate that the input permuted indexes is an actual permutation of the numbers 0..(ROWS-1). Nor does it assure that the input permutation array has the right size. Both are the caller's responsibility.
Do not use this method for an in-place permutation of the input matrix.
template<class _matrixOwnerType, typename _elementType>
VectorPointerType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::RowPointers ( VectorPointerType rowPointers)
throw (std::runtime_error
)
inline

Resize and fill a vector of pointers on the rows of the matrix. This method is provided to ease the interfacing with C libraries using matrices stored as value_type**.

To use this method, one must first create a dynamic vector of pointers, update it with the RowPointers method and then call the C function:

vctDynamicMatrix<double> myMatrix = ...;
myMatrix.RowPointers(rowPointers);
c_function(rowPointers.Pointer());
Note
This method will throw an exception if the rows are not compact, i.e. if the column stride is not equal to 1.
template<class _matrixOwnerType, typename _elementType>
ConstVectorPointerType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::RowPointers ( ConstVectorPointerType rowPointers) const
throw (std::runtime_error
)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __inputMatrixOwnerType , class __indexVectorOwnerType >
void vctDynamicMatrixBase< _matrixOwnerType, _elementType >::SelectColsFrom ( const vctDynamicConstMatrixBase< __inputMatrixOwnerType, _elementType > &  inputMatrix,
const vctDynamicConstVectorBase< __indexVectorOwnerType, index_type > &  colIndexVector 
)
inline

Select a subset of columns from another matrix

template<class _matrixOwnerType, typename _elementType>
template<class __inputMatrixOwnerType , class __indexVectorOwnerType >
void vctDynamicMatrixBase< _matrixOwnerType, _elementType >::SelectRowsFrom ( const vctDynamicConstMatrixBase< __inputMatrixOwnerType, _elementType > &  inputMatrix,
const vctDynamicConstVectorBase< __indexVectorOwnerType, index_type > &  rowIndexVector 
)
inline

Select a subset of rows from another matrix

template<class _matrixOwnerType, typename _elementType>
value_type vctDynamicMatrixBase< _matrixOwnerType, _elementType >::SetAll ( const value_type  value)
inline

Assign the given value to all the elements.

Parameters
valuethe value used to set all the elements of the matrix
Returns
The value used to set all the elements
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Subtract ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  otherMatrix)
inline
template<class _matrixOwnerType, typename _elementType>
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Subtract ( const value_type  scalar)
inline
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType1 , class __matrixOwnerType2 >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::SumOf ( const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &  matrix1,
const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &  matrix2 
)
inline

Binary elementwise operations between two matrices. For each element of the matrices, performs $ this[i] \leftarrow op(matrix1[i], matrix2[i])$ where $op$ is either an addition (SumOf), a subtraction (DifferenceOf), a multiplication (ElementwiseProductOf), a division (ElementwiseRatioOf), a minimum (ElementwiseMinOf) or a maximum (ElementwiseMaxOf).

Parameters
matrix1The first operand of the binary operation
matrix2The second operand of the binary operation
Returns
The matrix "this" modified.
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::SumOf ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  matrix,
const value_type  scalar 
)
inline

Binary elementwise operations between a matrix and a scalar. For each element of the matrix "this", performs $ this[i] \leftarrow op(matrix[i], scalar)$ where $op$ is either an addition (SumOf), a subtraction (DifferenceOf), a multiplication (ProductOf), a division (RatioOf), a minimum (ClippedAboveOf) or a maximum (ClippedBelowOf).

Parameters
matrixThe first operand of the binary operation.
scalarThe second operand of the binary operation.
Returns
The matrix "this" modified.
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::SumOf ( const value_type  scalar,
const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  matrix 
)
inline

Binary elementwise operations between a scalar and a matrix. For each element of the matrix "this", performs $ this[i] \leftarrow op(scalar, matrix[i])$ where $op$ is either an addition (SumOf), a subtraction (DifferenceOf), a multiplication (ProductOf), a division (RatioOf), a minimum (ClippedAboveOf) or a maximum (ClippedBelowOf).

Parameters
scalarThe first operand of the binary operation.
matrixThe second operand of the binary operation.
Returns
The matrix "this" modified.
template<class _matrixOwnerType, typename _elementType>
template<class __matrixOwnerType >
ThisType& vctDynamicMatrixBase< _matrixOwnerType, _elementType >::TransposeOf ( const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &  otherMatrix)
inline
template<class _matrixOwnerType, typename _elementType>
RefTransposeType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::TransposeRef ( void  )
inline

Return a transposed reference to this matrix.

template<class _matrixOwnerType, typename _elementType>
ConstRefTransposeType vctDynamicMatrixBase< _matrixOwnerType, _elementType >::TransposeRef ( void  ) const
inline
template<class _matrixOwnerType, typename _elementType>
vctDynamicMatrixBase< _matrixOwnerType, _elementType >::VCT_CONTAINER_TRAITS_TYPEDEFS ( _elementType  )
template<class _matrixOwnerType, typename _elementType>
bool vctDynamicMatrixBase< _matrixOwnerType, _elementType >::Zeros ( void  )
inline

Assign zero to all elements. This methods assumes that the element type has a zero and this zero value can be set using memset(0). If the matrix is not compact this method will use SetAll(0) and memset otherwise. This provides a slightly more efficent way to set all elements to zero.

Returns
true if the matrix is compact and memset was used, false otherwise.

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