#include <vctDynamicMatrix.h>
Inheritance diagram for vctDynamicMatrix< _elementType >:


This class defines a matrix object of dynamic size with memory allocation.
The algebraic operations are mostly inherited from the base classes vctDynamicMatrixBase and vctDynamicConstMatrixBase. Here, we will briefly describe the specific properties of vctDynamicMatrix, with a few usage examples.
// define a typical element type typedef double ElementType; // the matrixRows and matrixCols variables can be set to any value at // any time before creating the matrix. size_t matrixRows = 12; size_t matrixCols = 9; // constructor allocation vctDynamicMatrix<ElementType> m1(matrixRows, matrixCols); // Create an empty matrix and later allocate memory. vctDynamicMatrix<ElementType> m2; m2.SetSize(matrixRows, matrixCols); // Create a dynamic matrix of some size and then change it. // This operation does not preserve any elements in the resized // matrix vctDynamicMatrix<Elements> m3(3 * matrixRows, 3 * matrixCols); m3.SetSize(2 * matrixRows, 2 * matrixCols); // resize a matrix and keep as many elements as possible. m3.resize(matrixRows, matrixCols); // Store an algebraic result to a new matrix. In this case, // memory is allocated by the algebraic operation, and then // attached to the matrix object. vctDynamicMatrix<double> m4 = m3 - m2;
// 12 by 7 matrix stored column first vctDynamicMatrix<double> m1(12, 7, VCT_COL_MAJOR); // a similar matrix filled with zeroes vctDynamicMatrix<double> m1(12, 7, 0.0, VCT_COL_MAJOR); // resize the matrix and change its storage order m1.SetSize(5, 7, VCT_ROW_MAJOR);
// Initialize all elements to the same value vctDynamicMatrix<ElementType> v5(matrixRows, matrixCols, 2.0); // Initialize the elements by specific values. NOTE: All the // arguments MUST be of type ElementType vctDynamicMatrix<ElementType> matrix(2, 4); matrix.Assign(7.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0); // correct matrix.Assign(7, 1, 2, 3, 4, 5, 6, 7); // WRONG, missing dot // Assign one matrix to another. vctDynamicMatrix<int> matrixInt; matrixInt.Assign(matrix); matrixInt = matrix; // same operation
A few more notes.
| _elementType | the type of an element in the matrix |
Definition at line 137 of file vctDynamicMatrix.h.
| typedef vctDynamicMatrixBase<vctDynamicMatrixOwner<_elementType>, _elementType> vctDynamicMatrix< _elementType >::BaseType |
Type of the base class.
Reimplemented from vctDynamicMatrixBase< vctDynamicMatrixOwner< _elementType >, _elementType >.
Reimplemented in vctReturnDynamicMatrix< _elementType >.
Definition at line 147 of file vctDynamicMatrix.h.
| typedef vctDynamicMatrix<_elementType> vctDynamicMatrix< _elementType >::ThisType |
Type of the matrix itself.
Reimplemented from vctDynamicMatrixBase< vctDynamicMatrixOwner< _elementType >, _elementType >.
Reimplemented in mtsMatrix< _elementType >.
Definition at line 148 of file vctDynamicMatrix.h.
| vctDynamicMatrix< _elementType >::vctDynamicMatrix | ( | ) | [inline] |
Default constructor. Initialize an empty matrix.
Definition at line 152 of file vctDynamicMatrix.h.
| vctDynamicMatrix< _elementType >::vctDynamicMatrix | ( | size_type | rows, | |
| size_type | cols, | |||
| value_type | value, | |||
| bool | storageOrder = VCT_DEFAULT_STORAGE | |||
| ) | [inline] |
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.
Definition at line 174 of file vctDynamicMatrix.h.
| vctDynamicMatrix< _elementType >::vctDynamicMatrix | ( | const nsize_type & | matrixSize, | |
| value_type | value, | |||
| bool | storageOrder = VCT_DEFAULT_STORAGE | |||
| ) | [inline] |
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.
Definition at line 179 of file vctDynamicMatrix.h.
| vctDynamicMatrix< _elementType >::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< _elementType >::vctDynamicMatrix | ( | const ThisType & | otherMatrix | ) | [inline] |
Copy constructor: Allocate memory to store a copy of the other matrix, and copy the elements of the other matrix to this matrix.
Definition at line 196 of file vctDynamicMatrix.h.
| vctDynamicMatrix< _elementType >::vctDynamicMatrix | ( | const vctDynamicConstMatrixBase< __matrixOwnerType, __otherMatrixElementType > & | otherMatrix, | |
| bool | storageOrder | |||
| ) | [inline] |
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.
Definition at line 208 of file vctDynamicMatrix.h.
| vctDynamicMatrix< _elementType >::vctDynamicMatrix | ( | const vctDynamicConstMatrixBase< __matrixOwnerType, value_type > & | otherMatrix | ) | [inline] |
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.
Definition at line 219 of file vctDynamicMatrix.h.
| vctDynamicMatrix< _elementType >::vctDynamicMatrix | ( | const vctDynamicConstMatrixBase< __matrixOwnerType, __otherMatrixElementType > & | otherMatrix | ) | [inline, 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.
Definition at line 231 of file vctDynamicMatrix.h.
| vctDynamicMatrix< _elementType >::vctDynamicMatrix | ( | size_type | rows, | |
| size_type | cols, | |||
| value_type | value, | |||
| bool | storageOrder = VCT_DEFAULT_STORAGE | |||
| ) | [inline] |
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.
Definition at line 174 of file vctDynamicMatrix.h.
| vctDynamicMatrix< _elementType >::vctDynamicMatrix | ( | const nsize_type & | matrixSize, | |
| value_type | value, | |||
| bool | storageOrder = VCT_DEFAULT_STORAGE | |||
| ) | [inline] |
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.
Definition at line 179 of file vctDynamicMatrix.h.
| ThisType& vctDynamicMatrix< _elementType >::operator= | ( | const vctDynamicConstMatrixBase< __matrixOwnerType, __elementType > & | otherMatrix | ) | [inline] |
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.
Reimplemented from vctDynamicMatrixBase< vctDynamicMatrixOwner< _elementType >, _elementType >.
Definition at line 245 of file vctDynamicMatrix.h.
| ThisType& vctDynamicMatrix< _elementType >::operator= | ( | const ThisType & | otherMatrix | ) | [inline] |
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.
Definition at line 257 of file vctDynamicMatrix.h.
| ThisType& vctDynamicMatrix< _elementType >::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.
| ThisType& vctDynamicMatrix< _elementType >::operator= | ( | const value_type & | value | ) | [inline] |
Assignement of a scalar to all elements. See also SetAll.
Definition at line 275 of file vctDynamicMatrix.h.
| void vctDynamicMatrix< _elementType >::resize | ( | size_type | rows, | |
| size_type | cols | |||
| ) | [inline] |
Non-destructive size change. Change the size to the specified size, and preserve as many rows and columns as possible from the former matrix.
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).
Definition at line 314 of file vctDynamicMatrix.h.
Referenced by vctDynamicMatrix< svlTarget2D >::resize().
| void vctDynamicMatrix< _elementType >::resize | ( | const nsize_type & | newSizes | ) | [inline] |
Non-destructive size change. Change the size to the specified size, and preserve as many rows and columns as possible from the former matrix.
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).
Definition at line 318 of file vctDynamicMatrix.h.
| void vctDynamicMatrix< _elementType >::SetSize | ( | size_type | rows, | |
| size_type | cols, | |||
| bool | storageOrder | |||
| ) | [inline] |
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.
Definition at line 340 of file vctDynamicMatrix.h.
Referenced by nmrNNLSDynamicData::Allocate(), nmrNNLSSolver::Allocate(), nmrSVDRSSolver::Allocate(), nmrLDPSolver::Allocate(), nmrHFTISolver::Allocate(), nmrLSSolver::Allocate(), nmrPInverseSolver::Allocate(), nmrLSEISolver::Allocate(), nmrSVDSolver::Allocate(), nmrLSISolver::Allocate(), nmrLUSolver::AllocateLU(), nmrLUSolver::AllocateP(), vctDynamicMatrix< svlTarget2D >::DeSerializeRaw(), vctDynamicMatrix< svlTarget2D >::ForceAssign(), nmrNNLSDynamicData::nmrNNLSDynamicData(), mtsMatrix< _elementType >::operator=(), vctDynamicMatrix< svlTarget2D >::operator=(), nmrNNLSDynamicData::SetRef(), nmrNNLSDynamicData::SetRefOutput(), nmrNNLSDynamicData::SetRefWorkspaces(), and vctDynamicMatrix< svlTarget2D >::vctDynamicMatrix().
| void vctDynamicMatrix< _elementType >::SetSize | ( | const nsize_type & | matrixSize, | |
| bool | storageOrder | |||
| ) | [inline] |
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.
Definition at line 344 of file vctDynamicMatrix.h.
| void vctDynamicMatrix< _elementType >::SetSize | ( | size_type | rows, | |
| size_type | cols | |||
| ) | [inline] |
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.
Definition at line 348 of file vctDynamicMatrix.h.
| void vctDynamicMatrix< _elementType >::SetSize | ( | const nsize_type & | matrixSize | ) | [inline] |
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.
Definition at line 352 of file vctDynamicMatrix.h.
| void vctDynamicMatrix< _elementType >::DeSerializeRaw | ( | std::istream & | inputStream | ) | [inline] |
Binary deserialization
Reimplemented in mtsMatrix< _elementType >.
Definition at line 358 of file vctDynamicMatrix.h.
Referenced by mtsMatrix< _elementType >::DeSerializeRaw().