#include <AMatrix.hpp>
This class is the root of the Matrix organization in gstlearn A matrix is a 2-D organization: it is characterized by its number of rows and its number of columns. Although the user should not bother with this remark, the elements of a matrix processed in 'gstlearn' are stored in a Row-major format. This is to say that the internal rank of an element characterized by its row and column numbers is: (icol * getNRows() + irow)
Since gstlearn version v1.3:
Public Member Functions | |
| AMatrix (Id nrow=0, Id ncol=0) | |
| AMatrix (const AMatrix &m) | |
| AMatrix & | operator= (const AMatrix &m) |
| AMatrix (AMatrix &&m)=default | |
| AMatrix & | operator= (AMatrix &&m)=default |
| virtual | ~AMatrix () |
| String | toString (const AStringFormat *strfmt=nullptr) const override |
| Interface to AStringable. | |
| virtual bool | isSparse () const =0 |
| virtual bool | isDense () const =0 |
| virtual bool | isSquare (bool printWhyNot=false) const |
| virtual bool | isSymmetric (double eps=EPSILON10, bool printWhyNot=false) const |
| virtual bool | mustBeSymmetric () const |
| virtual void | setValue (Id irow, Id icol, double value)=0 |
| virtual void | updValue (Id irow, Id icol, const EOperator &oper, double value)=0 |
| virtual void | setColumn (Id icol, const 1 &tab)=0 |
| virtual void | setColumnToConstant (Id icol, double value)=0 |
| virtual void | setRow (Id irow, const 1 &tab)=0 |
| virtual void | setRowToConstant (Id irow, double value)=0 |
| virtual void | setDiagonal (const 1 &tab)=0 |
| virtual void | setDiagonalToConstant (double value=1.)=0 |
| virtual void | multiplyRow (const 1 &vec)=0 |
| virtual void | multiplyColumn (const 1 &vec)=0 |
| virtual void | divideRow (const 1 &vec)=0 |
| virtual void | divideColumn (const 1 &vec)=0 |
| virtual double | getValue (Id irow, Id icol) const =0 |
| virtual | getRow (Id irow) const |
| virtual | getColumn (Id icol) const |
| virtual void | fill (double value)=0 |
| virtual void | reset (Id nrows, Id ncols) |
| virtual void | resetFromValue (Id nrows, Id ncols, double value) |
| Reset the matrix to new dimensions and fill with a new value. | |
| virtual void | resetFromArray (Id nrows, Id ncols, const double *tab, bool byCol=true) |
| Reset the matrix from an array of double values. | |
| virtual void | resetFromVD (Id nrows, Id ncols, const 1 &tab, bool byCol=true) |
| Reset the matrix from a vector of double values. | |
| virtual void | resetFromVVD (const 1 &tab, bool byCol=true) |
| Reset the matrix from an array of double values. | |
| virtual void | transposeInPlace () |
| virtual AMatrix * | transpose () const |
| virtual void | prodMatMatInPlace (const AMatrix *x, const AMatrix *y, bool transposeX=false, bool transposeY=false) |
| virtual void | prodNormMatMatInPlace (const AMatrix *a, const AMatrix *m, bool transpose=false) |
| virtual void | prodNormMatVecInPlace (const AMatrix *a, const 1 &vec, bool transpose=false) |
| virtual void | prodNormMatInPlace (const AMatrix *a, bool transpose=false) |
| double | prodVecMatVec (const 1 &x, const 1 &y) const |
| virtual NF_Triplet | getMatrixToTriplet (Id shiftRow=0, Id shiftCol=0) const |
| void | clear () |
| void | resize (Id nrows, Id ncols) |
| Resize the matrix to new dimensions (this method doesn't change the storage type) | |
| bool | isValid (Id irow, Id icol, bool printWhyNot=false) const |
| bool | isIdentity (bool printWhyNot=false) const |
| void | addValue (Id irow, Id icol, double value) |
| bool | isSame (const AMatrix &m, double eps=EPSILON4, bool printWhyNot=false) |
| bool | isSameSize (const AMatrix &m) const |
| bool | empty () const |
| double | compare (const AMatrix &mat) const |
| Id | getNRows () const |
| Id | getNCols () const |
| Id | size () const |
| getValues (bool byCol=true) const | |
| const & | getDiagonal (Id shift=0) const |
| bool | isColumnDefined (Id icol) const |
| bool | isRowDefined (Id irow) const |
| Id | getNColDefined () const |
| Id | getNRowDefined () const |
| getColumnByRowRange (Id icol, Id rowFrom, Id rowTo) const | |
| bool | isNonNegative (bool verbose=false) const |
| Id | invert () |
| Id | solve (const 1 &b, 1 &x) const |
| void | dumpElements (const String &title, Id ifrom, Id ito) const |
| void | dumpStatistics (const String &title) const |
| void | setIdentity (double value=1.) |
| virtual void | fillRandom (double zeroPercent=0, Id seed=432432) |
| void | setValues (const 1 &values, bool byCol=true) |
| double | getMeanByColumn (Id icol) const |
| double | getMinimum () const |
| double | getMaximum () const |
| double | getNormInf () const |
| void | copyReduce (const AMatrix *x, const 1 &validRows, const 1 &validCols) |
| void | copyElements (const AMatrix &m, double factor=1.) |
| void | makePositiveColumn () |
| void | dumpRange (const char *title) |
| double | operator() (Id row, Id col) const |
| double & | operator() (Id row, Id col) |
Public Member Functions inherited from gstlrn::AStringable | |
| AStringable () | |
| AStringable (const AStringable &r) | |
| AStringable & | operator= (const AStringable &r) |
| virtual | ~AStringable () |
| virtual void | display (const AStringFormat *strfmt=nullptr) const final |
| virtual void | display (Id level) const final |
| void | printConcreteClassName () const |
Public Member Functions inherited from gstlrn::ICloneable | |
| ICloneable () | |
| virtual | ~ICloneable () |
| virtual ICloneable * | clone () const =0 |
| std::shared_ptr< ICloneable > | cloneShared () const |
| std::unique_ptr< ICloneable > | cloneUnique () const |
Static Public Member Functions | |
| template<class MA , class MB , class MC > | |
| static void | prodMatMatInPlace (MA &A, const MB &B, const MC &C, bool transposeB=false, bool transposeC=false) |
| template<typename T > | |
| static T | add (const T &other, double cst) |
| Return 'other' + 'cst'. | |
| template<typename T > | |
| static void | addInPlace (T &res, const T &other, double cst) |
| Operate 'res' = 'other' + 'cst'. | |
| template<typename T > | |
| static T | add (const T &other1, const T &other2) |
| Return 'other1' + 'other2'. | |
| template<typename T > | |
| static void | addInPlace (T &res, const T &other1, const T &other2) |
| Operate: 'res' = 'other1' + 'other2'. | |
| template<typename T > | |
| static T | product (const T &other, double cst) |
| Return 'other' * 'cst'. | |
| template<typename T > | |
| static void | productInPlace (T &res, const T &other, double cst) |
| Operate: 'res' = 'other' * 'cst'. | |
| template<typename T > | |
| static T | prodHadamard (const T &other1, const T &other2) |
| Return: 'other1' * 'other2' (where '*' designates the element-wise product) | |
| template<typename T > | |
| static void | prodHadamardInPlace (T &res, const T &other1, const T &other2) |
| Operate: 'res' = 'other1' * 'other2' (where '*' designates the element-wise prodtc) | |
| template<typename T > | |
| static T | linearCombination (double addition, double val1, const T &other1, double val2=0., const T &other2=T(), double val3=0., const T &other3=T()) |
| Return: 'val1' * 'other1' + 'val2' * 'other2' + 'val3' * 'other3' + 'addition'. | |
| template<typename T > | |
| static void | linearCombinationInPlace (T &res, double addition, double val1, const T &other1, double val2=0., const T &other2=T(), double val3=0., const T &other3=T()) |
| Operate: 'res' = 'val1' * 'other1' + 'val2' * 'other2' + 'val3' * 'other3' + 'addition'. | |
| template<typename T > | |
| static T | product (const T &other1, const T &other2, bool transpose1=false, bool transpose2=false) |
| Return: 'other1' * 'other2'. | |
| template<typename T > | |
| static void | productInPlace (T &res, const T &other1, const T &other2, bool transpose1=false, bool transpose2=false) |
| Operate: 'res' = 'other1' * 'other2'. | |
| template<typename T > | |
| static void | productInPlace (T &res, const T &other2, bool transpose2=false) |
| Operate: 'res' = 'res' * 'other1'. | |
| template<typename T > | |
| static | product (const T &other, const 1 &vec, bool transpose=false, bool flagInit=true) |
| Return: 'other' * 'vec'. | |
| template<typename T > | |
| static void | productInPlace (1 &res, const T &other, const 1 &vec, bool transpose=false, bool flagInit=true) |
| Operate: 'res' = 'other' * 'vec'. | |
| template<typename T > | |
| static void | productInPlace (vect res, const T &other, const constvect vec, bool transpose=false, bool flagInit=true) |
| Operate: 'res' = 'other' * 'vec'. | |
| template<typename T > | |
| static | product (const 1 &vec, const T &other, bool transpose=false, bool flagInit=true) |
| Return: 'vec' * 'other'. | |
| template<typename T > | |
| static void | productInPlace (1 &res, const 1 &vec, const T &other, bool transpose=false, bool flagInit=true) |
| Operate: 'res' = 'vec' * 'other'. | |
| template<typename T > | |
| static void | productInPlace (vect res, const constvect vec, const T &other, bool transpose=false, bool flagInit=true) |
| Operate: 'res' = 'vec' * 'other'. | |
| template<typename T > | |
| static T | prodnorm (const T &a, const T &m=T(), bool transpose=false) |
| Return: 'a_t' * 'm' * 'a' or 'a' * 'm' * 'a_t' (where 'a_t' is the transpose of 'a') | |
| template<typename T > | |
| static void | prodnormInPlace (T &res, const T &a, const T &m=T(), bool transpose=false) |
| Operate: 'res' = 'a_t' * 'm' * 'a' or 'a' * 'm' * 'a_t' (where 'a_t' is the transpose of 'a') | |
| template<typename T > | |
| static T | prodnorm (const T &a, const 1 &vec, bool transpose=false) |
| Return: 'a_t' * 'vec' * 'a' or 'a' * 'vec' * 'a_t' (where 'a_t' is the transpose of 'a') | |
| template<typename T > | |
| static void | prodnormInPlace (T &res, const T &a, const 1 &vec, bool transpose=false) |
| Operate: 'res' = 'a_t' * 'vec' * 'a' or 'a' * 'vec' * 'a_t' (where 'a_t' is the transpose of 'a') | |
| template<typename T > | |
| static bool | areIdentical (const T &a, const T &b, bool verbose=false) |
| Check if two matrices are exactly identical. | |
| gstlrn::AMatrix::AMatrix | ( | const AMatrix & | m | ) |
|
default |
|
virtual |
|
inlinestatic |
Return 'other' + 'cst'.
| T | Type of the matrix |
| other | Input matrix |
| cst | Constant value to be added |
|
inlinestatic |
Return 'other1' + 'other2'.
| T | Type of the matrix |
| other1 | First Input matrix |
| other2 | Second Input matrix |
|
inlinestatic |
Operate 'res' = 'other' + 'cst'.
| T | Type of the matrix |
| res | Output Matrix |
| other | Input matrix |
| cst | Constant value to be added |
|
inlinestatic |
Operate: 'res' = 'other1' + 'other2'.
| T | Type of the matrix |
| res | Output matrix |
| other1 | First Input matrix |
| other2 | Second Input matrix |
|
inlinestatic |
Check if two matrices are exactly identical.
| T |
| a | First matrix |
| b | Second matrix |
| verbose | Verbose flag |
| void gstlrn::AMatrix::clear | ( | ) |
| double gstlrn::AMatrix::compare | ( | const AMatrix & | mat | ) | const |
Returns the sum of absolute difference between argument and this
| void gstlrn::AMatrix::copyElements | ( | const AMatrix & | m, |
| double | factor = 1. |
||
| ) |
Copy the contents of matrix 'm' into 'this' Warning: matrices must have the same dimensions (not checked)
| m | Input matrix |
| factor | Multiplicative factor (applied to each element) |
| void gstlrn::AMatrix::copyReduce | ( | const AMatrix * | x, |
| const 1 & | validRows, | ||
| const 1 & | validCols | ||
| ) |
|
pure virtual |
Divide a Matrix column-wise
Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
|
pure virtual |
Divide a Matrix row-wise
Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
Dump a specific range of samples from the internal storage
| void gstlrn::AMatrix::dumpRange | ( | const char * | title | ) |
| void gstlrn::AMatrix::dumpStatistics | ( | const String & | title | ) | const |
Dump statistics on the Matrix
|
inline |
Returns if the current matrix is Empty
|
pure virtual |
Set all the values of the Matrix at once
Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
|
virtual |
Reimplemented in gstlrn::MatrixSparse.
|
virtual |
Extract a Column
Reimplemented in gstlrn::MatrixDense.
Extract a portion of a Column
| const & gstlrn::AMatrix::getDiagonal | ( | Id | shift = 0 | ) | const |
Extract a Diagonal (main or secondary) of this
|
virtual |
Extract the contents of the matrix
From a matrix of any type, creates the three vectors of the triplet (specific format for creating efficiently a Sparse matrix) It only takes the only non-zero elements of the matrix
Reimplemented in gstlrn::MatrixSparse.
| double gstlrn::AMatrix::getMaximum | ( | ) | const |
| double gstlrn::AMatrix::getMeanByColumn | ( | Id | icol | ) | const |
| double gstlrn::AMatrix::getMinimum | ( | ) | const |
| Id gstlrn::AMatrix::getNColDefined | ( | ) | const |
Define the number of defined columns
|
inline |
Returns the number of columns
| double gstlrn::AMatrix::getNormInf | ( | ) | const |
| Id gstlrn::AMatrix::getNRowDefined | ( | ) | const |
Define the number of defined rows
|
inline |
Returns the number of rows
|
virtual |
Extract a Row
Reimplemented in gstlrn::MatrixDense.
Gets the value at row 'irow' and column 'icol'
Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
| gstlrn::AMatrix::getValues | ( | bool | byCol = true | ) | const |
Returns the contents of the whole matrix as a VectorDouble
| Id gstlrn::AMatrix::invert | ( | ) |
Matrix inversion in place
| bool gstlrn::AMatrix::isColumnDefined | ( | Id | icol | ) | const |
Checks if a Column is valid (contains a non TEST value)
|
pure virtual |
Returns if the matrix belongs to the MatrixDense class
Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
| bool gstlrn::AMatrix::isIdentity | ( | bool | printWhyNot = false | ) | const |
Check if the matrix is square and Identity
Indicate if the current matrix is the Identity
| printWhyNot | Print the message is the answer is false |
| bool gstlrn::AMatrix::isNonNegative | ( | bool | verbose = false | ) | const |
Check if the matrix does not contain any negative element
Check if all the elements of a matrix are non-negative
| [in] | verbose | True for the verbose option |
| bool gstlrn::AMatrix::isRowDefined | ( | Id | irow | ) | const |
Checks if a Row is valid (contains a non TEST value)
| bool gstlrn::AMatrix::isSame | ( | const AMatrix & | m, |
| double | eps = EPSILON4, |
||
| bool | printWhyNot = false |
||
| ) |
Check if a matrix is the same as me (norm L1)
Check that Matrix 'm' is equal to the current Matrix
| m | Matrix to be compared to the current Matrix |
| eps | Epsilon for double equality comparison |
| printWhyNot | Print the message is the answer is false |
| bool gstlrn::AMatrix::isSameSize | ( | const AMatrix & | m | ) | const |
Check that 'm' has the same dimensions as 'this'
Check that Matrix 'm' share the same dimensions as current one
| m | Matrix to be compared to the current Matrix |
|
pure virtual |
Returns if the current matrix is Sparse
Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
|
virtual |
Check if the matrix is (non empty) square
Indicate if the given matrce is a square matrix
| printWhyNot | Print the message is the answer is false |
Reimplemented in gstlrn::MatrixSquare.
|
virtual |
Check if the input matrix is (non empty and square) symmetric
Indicate if the current matrix is symmetric
| eps | Epsilon for double equality comparison |
| printWhyNot | Print the message is the answer is false |
Reimplemented in gstlrn::MatrixSymmetric.
Indicate if the given indices are valid for the current matrix size
Indicate if the given indices are valid for the current matrix size
| irow | Row index |
| icol | Column index |
| printWhyNot | Print the message is the answer is false |
|
inlinestatic |
Return: 'val1' * 'other1' + 'val2' * 'other2' + 'val3' * 'other3' + 'addition'.
| T |
| addition | Constant to be added to the linear combination |
| val1 | Weight of the first matrix |
| other1 | First matrix |
| val2 | Weight of the second matrix |
| other2 | Second matrix |
| val3 | Weight of the third matrix |
| other3 | Third matrix |
|
inlinestatic |
Operate: 'res' = 'val1' * 'other1' + 'val2' * 'other2' + 'val3' * 'other3' + 'addition'.
| T |
| res | Output matrix |
| addition | Constant to be added to the linear combination |
| val1 | Weight of the first matrix |
| other1 | First matrix |
| val2 | Weight of the second matrix |
| other2 | Second matrix |
| val3 | Weight of the third matrix |
| other3 | Third matrix |
| void gstlrn::AMatrix::makePositiveColumn | ( | ) |
Modify the contents of the matrix so that each column has a positive sum of elements. If this is not the case, simply invert the sign of the column
|
pure virtual |
Multiply a Matrix column-wise
Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
|
pure virtual |
Multiply a Matrix row-wise
Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
|
inlinevirtual |
Say if the matrix must be symmetric
Reimplemented in gstlrn::MatrixSymmetric, gstlrn::MatrixDense, and gstlrn::MatrixSquare.
|
inlinestatic |
Return: 'other1' * 'other2' (where '*' designates the element-wise product)
| T | Type of the matrix |
| other1 | First input matrix |
| other2 | Second input matrix |
|
inlinestatic |
Operate: 'res' = 'other1' * 'other2' (where '*' designates the element-wise prodtc)
| T | Type of the matrix |
| res | Output matrix |
| other1 | First input matrix |
| other2 | Second input matrix |
|
virtual |
Perform 'this' = 'x' * 'y'
Store the product of 'x'(or 't(x)') by 'y' (or 't(y') in this
| x | First Matrix |
| y | Second matrix |
| transposeX | True if first matrix must be transposed |
| transposeY | True if second matrix must be transposed |
Reimplemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
|
inlinestatic |
|
inlinestatic |
Return: 'a_t' * 'vec' * 'a' or 'a' * 'vec' * 'a_t' (where 'a_t' is the transpose of 'a')
| T |
| a | First matrix |
| vec | Vector |
| transpose | True if first 'a' is transposed; otherwise second 'a' is transposed |
|
inlinestatic |
Return: 'a_t' * 'm' * 'a' or 'a' * 'm' * 'a_t' (where 'a_t' is the transpose of 'a')
| T |
| a | First matrix |
| m | Second matrix (may be omitted) |
| transpose | True if first 'a' is transposed; otherwise second 'a' is transposed |
|
inlinestatic |
Operate: 'res' = 'a_t' * 'vec' * 'a' or 'a' * 'vec' * 'a_t' (where 'a_t' is the transpose of 'a')
| T |
| res | Output matrix |
| a | First matrix |
| vec | Vector |
| transpose | True if first 'a' is transposed; otherwise second 'a' is transposed |
|
inlinestatic |
Operate: 'res' = 'a_t' * 'm' * 'a' or 'a' * 'm' * 'a_t' (where 'a_t' is the transpose of 'a')
| T |
| res | Output matrix |
| a | First matrix |
| m | Second matrix (may be omitted) |
| transpose | True if first 'a' is transposed; otherwise second 'a' is transposed |
|
virtual |
Perform 'this' = 't(A)' %*% 'A' or 'A' %*% 't(A)'
Reimplemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
|
virtual |
Perform 'this' = 't(A)' %*% 'M' %*% 'A' or 'A' %*% 'M' %*% 't(A)'
Product 't(A)' %*% 'M' %*% 'A' or 'A' %*% 'M' %*% 't(A)' stored in 'this'
| a | Matrix A |
| m | Matrix M |
| transpose | True for first implementation, False for the second |
Reimplemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
|
virtual |
Perform 'this' = 't(A)' %*% 'vec' %*% 'A' or 'A' %*% 'vec' %*% 't(A)'
Reimplemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
|
inlinestatic |
Return: 'vec' * 'other'.
| T |
| other | First matrix |
| vec | Vector |
| transpose | True if 'other' must be transposed |
| flagInit | True if the resulting vector must be initialized beforehand |
|
inlinestatic |
Return: 'other' * 'vec'.
| T |
| other | First matrix |
| vec | Vector |
| transpose | True if 'other' must be transposed |
| flagInit | True if the resulting vector must be initialized beforehand |
|
inlinestatic |
Return 'other' * 'cst'.
| T | Type of the matrix |
| other | Input matrix |
| cst | Constant value to be multiplied |
|
inlinestatic |
Return: 'other1' * 'other2'.
| T |
| other1 | First matrix |
| other2 | Second matrix |
| transpose1 | True if 'other1' must be transposed |
| transpose2 | True if 'other2' must be transposed |
|
inlinestatic |
Operate: 'res' = 'vec' * 'other'.
| T |
| res | Output vector |
| other | First matrix |
| vec | Vector |
| transpose | True if 'other' must be transposed |
| flagInit | True if the resulting vector must be initialized beforehand |
|
inlinestatic |
Operate: 'res' = 'other' * 'vec'.
| T |
| res | Output vector |
| other | First matrix |
| vec | Vector |
| transpose | True if 'other' must be transposed |
| flagInit | True if the resulting vector must be initialized beforehand |
|
inlinestatic |
Operate: 'res' = 'other' * 'cst'.
| T | Type of the matrix |
| res | Output matrix |
| other | Input matrix |
| cst | Constant value to be multiplied |
|
inlinestatic |
Operate: 'res' = 'other1' * 'other2'.
| T |
| res | Output matrix |
| other1 | First matrix |
| other2 | Second matrix |
| transpose1 | True if 'other1' must be transposed |
| transpose2 | True if 'other2' must be transposed |
|
inlinestatic |
Operate: 'res' = 'res' * 'other1'.
| T |
| res | Output matrix |
| other2 | First matrix |
| transpose2 | True if 'other2' must be transposed |
|
inlinestatic |
Operate: 'res' = 'vec' * 'other'.
| T |
| res | Output vector |
| other | First matrix |
| vec | Vector |
| transpose | True if 'other' must be transposed |
| flagInit | True if the resulting vector must be initialized beforehand |
|
inlinestatic |
Operate: 'res' = 'other' * 'vec'.
| T |
| res | Output matrix |
| other | First matrix |
| vec | Vector |
| transpose | True if 'other' must be transposed |
| flagInit | True if the resulting vector must be initialized beforehand |
| double gstlrn::AMatrix::prodVecMatVec | ( | const 1 & | x, |
| const 1 & | y | ||
| ) | const |
Perform x %*% 'this' %*% y
Reimplemented in gstlrn::Table.
|
virtual |
Reset the matrix from an array of double values.
| nrows | New number of rows |
| ncols | New number of columns |
| tab | The array of values |
| byCol | True if values are column-major in the array |
Reimplemented in gstlrn::MatrixSparse.
Reset the matrix to new dimensions and fill with a new value.
| nrows | New number of rows |
| ncols | New number of columns |
| value | The new value used to fill the matrix |
Reimplemented in gstlrn::MatrixSparse.
Reset the matrix from a vector of double values.
| nrows | New number of rows |
| ncols | New number of columns |
| tab | The vector of values |
| byCol | True if values are column-major in the vector |
Reimplemented in gstlrn::MatrixSparse.
|
virtual |
Reset the matrix from an array of double values.
| tab | The array of values |
| byCol | True if values are column-major in the array |
Reimplemented in gstlrn::MatrixSparse, gstlrn::MatrixSquare, and gstlrn::MatrixSymmetric.
Resize the matrix to new dimensions (this method doesn't change the storage type)
Modify the dimension of the matrix (if needed)
| nrows | New number of rows |
| ncols | New number of columns |
|
pure virtual |
Set the contents of a Column
Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
|
pure virtual |
Set the contents of a Column to a constant value
Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
|
pure virtual |
Set the contents of the (main) Diagonal
Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
|
pure virtual |
Set the contents of the (main) Diagonal to a constant value
Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
| void gstlrn::AMatrix::setIdentity | ( | double | value = 1. | ) |
Sets the matrix as Identity
|
pure virtual |
Set the contents of a Row
Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
|
pure virtual |
Set the contents of a Row to a constant value
Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
Sets the value at row 'irow' and column 'icol'
Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.
| void gstlrn::AMatrix::setValues | ( | const 1 & | values, |
| bool | byCol = true |
||
| ) |
Filling the matrix with an array of values Note that this array is ALWAYS dimensioned to the total number of elements in the matrix. Kept for compatibility with old code where matrix contents was stored as a VectorDouble
| values | |
| byCol | true for Column major; false for Row Major |
|
inline |
Get the total number of elements of the (full) matrix (as for VectorT)
| Id gstlrn::AMatrix::solve | ( | const 1 & | b, |
| 1 & | x | ||
| ) | const |
Solving the Matrix Linear system
|
overridevirtual |
Interface to AStringable.
Reimplemented from gstlrn::AStringable.
Reimplemented in gstlrn::ProjMatrix, and gstlrn::Table.
|
virtual |
Transpose the matrix and return it as a copy
Reimplemented in gstlrn::MatrixSparse.
|
virtual |
Transpose the matrix in place
|
pure virtual |
Update the value at row 'irow' and column 'icol'
Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.