22#ifndef _vctDynamicMatrix_h
23#define _vctDynamicMatrix_h
135template <
class _elementType>
165 this->
SetSize(matrixSize, storageOrder);
179 this->
SetSize(matrixSize, storageOrder);
198 this->
SetSize(otherMatrix.rows(), otherMatrix.cols(), otherMatrix.StorageOrder());
199 this->Assign(otherMatrix);
206 template <
class __matrixOwnerType,
typename __otherMatrixElementType>
208 this->
SetSize(otherMatrix.rows(), otherMatrix.cols(), storageOrder);
209 this->Assign(otherMatrix);
217 template <
class __matrixOwnerType>
219 this->
SetSize(otherMatrix.rows(), otherMatrix.cols(), otherMatrix.StorageOrder());
220 this->Assign(otherMatrix);
229 template <
class __matrixOwnerType,
typename __otherMatrixElementType>
231 this->
SetSize(otherMatrix.rows(), otherMatrix.cols(), otherMatrix.StorageOrder());
232 this->Assign(otherMatrix);
239 class __elementType,
class __dataPtrType>
241 __rowStride, __colStride,
242 __elementType, __dataPtrType> & other) {
254 template <
class __matrixOwnerType,
typename __elementType>
256 this->
SetSize(otherMatrix.rows(), otherMatrix.cols());
257 this->Assign(otherMatrix);
268 this->
SetSize(otherMatrix.rows(), otherMatrix.cols(), otherMatrix.StorageOrder());
269 this->Assign(otherMatrix);
278 class __elementType,
class __dataPtrType>
280 __rowStride, __colStride,
281 __elementType, __dataPtrType> & other) {
305 template <
class __matrixOwnerType,
typename __elementType>
307 this->
SetSize(other.sizes(), other.StorageOrder());
315 class __elementType,
class __dataPtrType>
317 __rowStride, __colStride,
318 __elementType, __dataPtrType> & other) {
319 this->
SetSize(other.sizes(), other.StorageOrder());
342 void resize(
const nsize_type & newSizes) {
343 if (newSizes == this->
sizes())
347 ThisType newData(newSizes, isRowMajor);
348 const nsize_type corner(0);
350 minSizes.ElementwiseMinOf(this->
sizes(), newSizes);
353 newDataMinSpaceRef.
Assign(myDataMinSpaceRef);
355 this->
Matrix.Own(newSizes, isRowMajor, newData.Matrix.Release());
368 void SetSize(
const nsize_type & matrixSize,
bool storageOrder) {
369 this->
Matrix.SetSize(matrixSize, storageOrder);
385 size_type myRows = 0;
386 size_type myCols = 0;
392 size_type indexRow, indexCol;
393 for (indexRow = 0; indexRow < myRows; ++indexRow) {
394 for (indexCol = 0; indexCol < myCols; ++indexCol) {
418template <
class _elementType>
430 const size_type
rows = other.rows();
431 const size_type
cols = other.cols();
432 const bool storageOrder = other.StorageOrder();
433 this->
Matrix.Own(
rows,
cols, storageOrder, nonConstOther.Matrix.Release());
439template <
class _elementType>
446 const bool storageOrder = other.StorageOrder();
447 this->
Matrix.Own(
rows,
cols, storageOrder, nonConstOther.Matrix.Release());
452template <
class _elementType>
460 const bool storageOrder = other.StorageOrder();
462 this->
Matrix.Own(
rows,
cols, storageOrder, nonConstOther.Matrix.Release());
474template <
class _matrixOwnerType1,
class _matrixOwnerType2,
class _elementType>
480 resultStorage.Add(inputMatrix2);
485template <
class _matrixOwnerType1,
class _matrixOwnerType2,
class _elementType>
491 resultStorage.Subtract(inputMatrix2);
506template <
class _matrixOwnerType,
class _elementType>
509 const _elementType & inputScalar) {
512 resultStorage.Add(inputScalar);
517template <
class _matrixOwnerType,
class _elementType>
520 const _elementType & inputScalar) {
523 resultStorage.Subtract(inputScalar);
528template <
class _matrixOwnerType,
class _elementType>
531 const _elementType & inputScalar) {
534 resultStorage.Multiply(inputScalar);
539template <
class _matrixOwnerType,
class _elementType>
542 const _elementType & inputScalar) {
545 resultStorage.Divide(inputScalar);
560template <
class _matrixOwnerType,
class _elementType>
566 resultStorage.SumOf(inputScalar, inputMatrix);
571template <
class _matrixOwnerType,
class _elementType>
577 resultStorage.DifferenceOf(inputScalar, inputMatrix);
582template <
class _matrixOwnerType,
class _elementType>
588 resultStorage.ProductOf(inputScalar, inputMatrix);
593template <
class _matrixOwnerType,
class _elementType>
599 resultStorage.RatioOf(inputScalar, inputMatrix);
611template <
class _matrixOwnerType,
class _elementType>
616 resultStorage.NegationOf(inputMatrix);
624template <
class _matrixOwnerType1,
class _matrixOwnerType2,
class _elementType>
630 resultStorage.ProductOf(inputMatrix1, inputMatrix2);
635template <
class _matrixOwnerType,
class _vectorOwnerType,
class _elementType>
641 resultStorage.ProductOf(inputMatrix, inputVector);
646template <
class _vectorOwnerType,
class _matrixOwnerType,
class _elementType>
652 resultStorage.ProductOf(inputVector, inputMatrix);
664template <
class _matrixOwnerType,
class _elementType>
669 vctDynamicMatrixLoopEngines::
670 MoMi<typename vctUnaryOperations<value_type>::AbsValue>::
671 Run(resultStorage, *
this);
676template <
class _matrixOwnerType,
class _elementType>
681 vctDynamicMatrixLoopEngines::
682 MoMi<typename vctUnaryOperations<value_type>::Negation>::
683 Run(resultStorage, *
this);
688template <
class _matrixOwnerType,
class _elementType>
693 vctDynamicMatrixLoopEngines::
694 MoMi<typename vctUnaryOperations<value_type>::Floor>::
695 Run(resultStorage, *
this);
700template <
class _matrixOwnerType,
class _elementType>
705 vctDynamicMatrixLoopEngines::
706 MoMi<typename vctUnaryOperations<value_type>::Ceil>::
707 Run(resultStorage, *
this);
712template <
class _matrixOwnerType,
class _elementType>
716 resultStorage.SetAll(_elementType(0));
717 resultStorage.Diagonal().SetAll(_elementType(1));
722template <
class _matrixOwnerType,
class __matrixOwnerType,
class _elementType,
723 class _elementOperationType>
734template <
class _matrixOwnerType,
class _elementType,
735 class _elementOperationType>
738 const _elementType & scalar) {
Definition vctForwardDeclarations.h:145
Dynamic matrix referencing existing memory (const).
Definition vctDynamicConstMatrixRef.h:81
Definition vctForwardDeclarations.h:119
Definition vctDynamicMatrixBase.h:43
ThisType & Assign(const vctDynamicConstMatrixBase< __matrixOwnerType, value_type > &other)
Definition vctDynamicMatrixBase.h:509
Definition vctForwardDeclarations.h:157
static void Run(_outputMatrixType &outputMatrix, const _input1MatrixType &input1Matrix, const _input2MatrixType &input2Matrix)
Definition vctDynamicMatrixLoopEngines.h:95
static void Run(_outputMatrixType &outputMatrix, const _inputMatrixType &inputMatrix, const _inputScalarType inputScalar)
Definition vctDynamicMatrixLoopEngines.h:347
Dynamic matrix referencing existing memory.
Definition vctDynamicMatrixRef.h:75
Definition vctForwardDeclarations.h:131
A template for a fixed size matrix with fixed spacing in memory.
Definition vctFixedSizeConstMatrixBase.h:104
Definition vctDynamicMatrix.h:419
vctDynamicMatrix< BoolType > BaseType
Definition vctDynamicMatrix.h:422
VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType)
vctReturnDynamicMatrix(const BaseType &other)
Definition vctDynamicMatrix.h:426
Definition vctDynamicVector.h:395
vctReturnDynamicVector(const BaseType &other)
Definition vctDynamicVector.h:399
void cmnDeSerializeSizeRaw(std::istream &inputStream, size_t &data) CISST_THROW(std
Definition cmnDeSerializer.h:96
void cmnDeSerializeRaw(std::istream &inputStream, _elementType &data) CISST_THROW(std
Definition cmnDeSerializer.h:82
vctDynamicMatrix()
A matrix object of dynamic size.
Definition vctDynamicMatrix.h:151
size_t size_type
Definition vctContainerTraits.h:35
ptrdiff_t stride_type
Definition vctContainerTraits.h:37
#define VCT_CONTAINER_TRAITS_TYPEDEFS(type)
Definition vctContainerTraits.h:50
#define VCT_NARRAY_TRAITS_TYPEDEFS(dimension)
Definition vctContainerTraits.h:68
bool StorageOrder(void) const
Definition vctDynamicConstMatrixBase.h:656
vctReturnDynamicMatrix< bool > vctDynamicMatrixElementwiseCompareScalar(const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &matrix, const _elementType &scalar)
Definition vctDynamicMatrix.h:737
bool IsRowMajor(void) const
Definition vctDynamicConstMatrixBase.h:635
size_type cols() const
Definition vctDynamicConstMatrixBase.h:243
OwnerType Matrix
Definition vctDynamicConstMatrixBase.h:167
@ DIMENSION
Definition vctDynamicConstMatrixBase.h:82
size_type size(void) const
Definition vctDynamicConstMatrixBase.h:228
const nsize_type & sizes(void) const
Definition vctDynamicConstMatrixBase.h:233
const_reference Element(size_type rowIndex, size_type colIndex) const
Definition vctDynamicConstMatrixBase.h:362
vctReturnDynamicMatrix< bool > vctDynamicMatrixElementwiseCompareMatrix(const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &matrix1, const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &matrix2)
Definition vctDynamicMatrix.h:725
size_type rows() const
Definition vctDynamicConstMatrixBase.h:238
vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > ThisType
Definition vctDynamicConstMatrixBase.h:86
vctReturnDynamicMatrix< _elementType > operator/(const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &inputMatrix, const _elementType &inputScalar)
Definition vctDynamicMatrix.h:541
vctReturnDynamicMatrix< _elementType > operator*(const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &inputMatrix, const _elementType &inputScalar)
Definition vctDynamicMatrix.h:530
ThisType & ForceAssign(const vctDynamicConstMatrixBase< __matrixOwnerType, __elementType > &other)
Definition vctDynamicMatrix.h:306
void SetSize(size_type rows, size_type cols, bool storageOrder)
Definition vctDynamicMatrix.h:364
vctReturnDynamicMatrix< _elementType > operator-(const vctDynamicConstMatrixBase< _matrixOwnerType1, _elementType > &inputMatrix1, const vctDynamicConstMatrixBase< _matrixOwnerType2, _elementType > &inputMatrix2)
Definition vctDynamicMatrix.h:487
void resize(size_type rows, size_type cols)
Definition vctDynamicMatrix.h:338
void DeSerializeRaw(std::istream &inputStream)
Definition vctDynamicMatrix.h:382
vctReturnDynamicMatrix< _elementType > operator+(const vctDynamicConstMatrixBase< _matrixOwnerType1, _elementType > &inputMatrix1, const vctDynamicConstMatrixBase< _matrixOwnerType2, _elementType > &inputMatrix2)
Definition vctDynamicMatrix.h:476
ThisType & operator=(const vctDynamicConstMatrixBase< __matrixOwnerType, __elementType > &otherMatrix)
Definition vctDynamicMatrix.h:255
Declaration of vctDynamicMatrixBase.
Declaration of vctDynamicMatrixOwner.
Declaration of vctDynamicMatrixRef.
vctDynamicNArrayBase< vctDynamicNArrayOwner< _elementType, _dimension >, _elementType, _dimension > BaseType
Definition vctDynamicNArray.h:133
Declaration of vctDynamicVector.
const bool VCT_DEFAULT_STORAGE
Definition vctForwardDeclarations.h:47