1.8.0
CCC
 
Loading...
Searching...
No Matches
gstlrn::AMatrix Class Referenceabstract

TODO : Transform into template for storing something else than double. More...

#include <AMatrix.hpp>

Inheritance diagram for gstlrn::AMatrix:
gstlrn::AStringable gstlrn::ICloneable gstlrn::MatrixDense gstlrn::MatrixSparse gstlrn::MatrixSquare gstlrn::Table gstlrn::InvNuggetOp gstlrn::ProjMatrix gstlrn::MatrixSymmetric

Detailed Description

TODO : Transform into template for storing something else than double.

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:

  • Dense Matrices storage and algebra rely on Eigen3 library
  • Sparse Matrices storage and algebra rely on Eigen3 library

Public Member Functions

 AMatrix (Id nrow=0, Id ncol=0)
 
 AMatrix (const AMatrix &m)
 
AMatrixoperator= (const AMatrix &m)
 
virtual ~AMatrix ()
 
String toString (const AStringFormat *strfmt=nullptr) const override
 Interface to AStringable.
 
virtual bool isSparse () const =0
 Functions to be implemented in derived classes.
 
virtual bool isDense () const =0
 
virtual double getValue (Id irow, Id icol) const =0
 
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 addScalar (double v)=0
 
virtual void addScalarDiag (double v)=0
 
virtual void prodScalar (double v)=0
 
virtual void fill (double value)=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 bool isSquare (bool printWhyNot=false) const
 
virtual bool isSymmetric (double eps=EPSILON10, bool printWhyNot=false) const
 
virtual bool mustBeSymmetric () const
 
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 AMatrixtranspose () const
 
virtual getRow (Id irow) const
 
virtual getColumn (Id icol) 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)
 
virtual void linearCombination (double val1, const AMatrix *mat1, double val2=1., const AMatrix *mat2=nullptr, double val3=1., const AMatrix *mat3=nullptr)
 Perfom the algebraic equation this = val1 * mat1 + val2 * mat2 + val3 * mat3.
 
virtual void addMat (const AMatrix &y, double cx=1., double cy=1.)
 
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
 
 prodMatVec (const 1 &x, bool transpose=false) const
 
void prodMatVecInPlace (const 1 &x, 1 &y, bool transpose=false) const
 
void prodMatVecInPlaceC (const constvect x, vect y, bool transpose=false) const
 
void addProdMatVecInPlaceC (const constvect x, vect y, bool transpose=false) const
 
 prodVecMat (const 1 &x, bool transpose=false) const
 
void prodVecMatInPlace (const 1 &x, 1 &y, bool transpose=false) const
 
void prodVecMatInPlaceC (const constvect x, vect y, bool transpose=false) const
 
void addProdVecMatInPlaceC (const constvect x, vect y, bool transpose=false) const
 
double prodVecMatVec (const 1 &x, const 1 &y) const
 
void prodMat (const AMatrix *matY, bool transposeY=false)
 
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.)
 
void fillRandom (Id seed=432432, double zeroPercent=0)
 
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)
 
AStringableoperator= (const AStringable &r)
 
virtual ~AStringable ()
 
virtual void display (const AStringFormat *strfmt=nullptr) const final
 
virtual void display (Id level) const final
 
- Public Member Functions inherited from gstlrn::ICloneable
 ICloneable ()
 
virtual ~ICloneable ()
 
virtual ICloneableclone () const =0
 
std::shared_ptr< ICloneablecloneShared () const
 
std::unique_ptr< ICloneablecloneUnique () const
 

Constructor & Destructor Documentation

◆ AMatrix() [1/2]

gstlrn::AMatrix::AMatrix ( Id  nrow = 0,
Id  ncol = 0 
)

◆ AMatrix() [2/2]

gstlrn::AMatrix::AMatrix ( const AMatrix m)

◆ ~AMatrix()

gstlrn::AMatrix::~AMatrix ( )
virtual

Member Function Documentation

◆ addMat()

void gstlrn::AMatrix::addMat ( const AMatrix y,
double  cx = 1.,
double  cy = 1. 
)
virtual

Add a matrix (multiplied by a constant)

Add the matrix 'y' to the current Matrix

Parameters
yMatrix to be added
cxMultiplicative parameter for this
cyMultiplicative parameter for y

Reimplemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ addProdMatVecInPlaceC()

void gstlrn::AMatrix::addProdMatVecInPlaceC ( const constvect  x,
vect  y,
bool  transpose = false 
) const

◆ addProdVecMatInPlaceC()

void gstlrn::AMatrix::addProdVecMatInPlaceC ( const constvect  x,
vect  y,
bool  transpose = false 
) const

◆ addScalar()

virtual void gstlrn::AMatrix::addScalar ( double  v)
pure virtual

Add a value to each matrix component

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ addScalarDiag()

virtual void gstlrn::AMatrix::addScalarDiag ( double  v)
pure virtual

Add value to matrix diagonal

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ addValue()

void gstlrn::AMatrix::addValue ( Id  irow,
Id  icol,
double  value 
)

Add a value to a matrix term

◆ clear()

void gstlrn::AMatrix::clear ( )

◆ compare()

double gstlrn::AMatrix::compare ( const AMatrix mat) const

Returns the sum of absolute difference between argument and this

◆ copyElements()

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)

Parameters
mInput matrix
factorMultiplicative factor (applied to each element)

◆ copyReduce()

void gstlrn::AMatrix::copyReduce ( const AMatrix x,
const 1 &  validRows,
const 1 &  validCols 
)

◆ divideColumn()

virtual void gstlrn::AMatrix::divideColumn ( const 1 &  vec)
pure virtual

Divide a Matrix column-wise

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ divideRow()

virtual void gstlrn::AMatrix::divideRow ( const 1 &  vec)
pure virtual

Divide a Matrix row-wise

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ dumpElements()

void gstlrn::AMatrix::dumpElements ( const String title,
Id  ifrom,
Id  ito 
) const

Dump a specific range of samples from the internal storage

◆ dumpRange()

void gstlrn::AMatrix::dumpRange ( const char *  title)

◆ dumpStatistics()

void gstlrn::AMatrix::dumpStatistics ( const String title) const

Dump statistics on the Matrix

◆ empty()

bool gstlrn::AMatrix::empty ( ) const
inline

Returns if the current matrix is Empty

◆ fill()

virtual void gstlrn::AMatrix::fill ( double  value)
pure virtual

Set all the values of the Matrix at once

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ fillRandom()

void gstlrn::AMatrix::fillRandom ( Id  seed = 432432,
double  zeroPercent = 0 
)

◆ getColumn()

gstlrn::AMatrix::getColumn ( Id  icol) const
virtual

Extract a Column

Reimplemented in gstlrn::MatrixDense.

◆ getColumnByRowRange()

gstlrn::AMatrix::getColumnByRowRange ( Id  icol,
Id  rowFrom,
Id  rowTo 
) const

Extract a portion of a Column

◆ getDiagonal()

const & gstlrn::AMatrix::getDiagonal ( Id  shift = 0) const

Extract a Diagonal (main or secondary) of this

◆ getMatrixToTriplet()

NF_Triplet gstlrn::AMatrix::getMatrixToTriplet ( Id  shiftRow = 0,
Id  shiftCol = 0 
) const
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.

◆ getMaximum()

double gstlrn::AMatrix::getMaximum ( ) const

◆ getMeanByColumn()

double gstlrn::AMatrix::getMeanByColumn ( Id  icol) const

◆ getMinimum()

double gstlrn::AMatrix::getMinimum ( ) const

◆ getNColDefined()

Id gstlrn::AMatrix::getNColDefined ( ) const

Define the number of defined columns

◆ getNCols()

Id gstlrn::AMatrix::getNCols ( ) const
inline

Returns the number of columns

◆ getNormInf()

double gstlrn::AMatrix::getNormInf ( ) const

◆ getNRowDefined()

Id gstlrn::AMatrix::getNRowDefined ( ) const

Define the number of defined rows

◆ getNRows()

Id gstlrn::AMatrix::getNRows ( ) const
inline

Returns the number of rows

◆ getRow()

gstlrn::AMatrix::getRow ( Id  irow) const
virtual

Extract a Row

Reimplemented in gstlrn::MatrixDense.

◆ getValue()

virtual double gstlrn::AMatrix::getValue ( Id  irow,
Id  icol 
) const
pure virtual

Gets the value at row 'irow' and column 'icol'

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ getValues()

gstlrn::AMatrix::getValues ( bool  byCol = true) const

Returns the contents of the whole matrix as a VectorDouble

◆ invert()

Id gstlrn::AMatrix::invert ( )

Matrix inversion in place

◆ isColumnDefined()

bool gstlrn::AMatrix::isColumnDefined ( Id  icol) const

Checks if a Column is valid (contains a non TEST value)

◆ isDense()

virtual bool gstlrn::AMatrix::isDense ( ) const
pure virtual

Returns if the matrix belongs to the MatrixDense class

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ isIdentity()

bool gstlrn::AMatrix::isIdentity ( bool  printWhyNot = false) const

Check if the matrix is square and Identity

Indicate if the current matrix is the Identity

Parameters
printWhyNotPrint the message is the answer is false
Returns
true if the current matrix is the Identity

◆ isNonNegative()

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

Returns
True if the matrix is non-negative; False otherwise
Parameters
[in]verboseTrue for the verbose option

◆ isRowDefined()

bool gstlrn::AMatrix::isRowDefined ( Id  irow) const

Checks if a Row is valid (contains a non TEST value)

◆ isSame()

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

Parameters
mMatrix to be compared to the current Matrix
epsEpsilon for double equality comparison
printWhyNotPrint the message is the answer is false
Returns
true if 'm' is equal to the current Matrix

◆ isSameSize()

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

Parameters
mMatrix to be compared to the current Matrix
Returns
true if 'm' has same dimensions as the current Matrix
Remarks
: message is issued if dimensions are different

◆ isSparse()

virtual bool gstlrn::AMatrix::isSparse ( ) const
pure virtual

Functions to be implemented in derived classes.

Returns if the current matrix is Sparse

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ isSquare()

bool gstlrn::AMatrix::isSquare ( bool  printWhyNot = false) const
virtual

Check if the matrix is (non empty) square

Indicate if the given matrce is a square matrix

Parameters
printWhyNotPrint the message is the answer is false
Returns
true if the matrix is square

Reimplemented in gstlrn::MatrixSquare.

◆ isSymmetric()

bool gstlrn::AMatrix::isSymmetric ( double  eps = EPSILON10,
bool  printWhyNot = false 
) const
virtual

Check if the input matrix is (non empty and square) symmetric

Indicate if the current matrix is symmetric

Parameters
epsEpsilon for double equality comparison
printWhyNotPrint the message is the answer is false
Returns
true if the current matrix is symmetric

Reimplemented in gstlrn::MatrixSymmetric.

◆ isValid()

bool gstlrn::AMatrix::isValid ( Id  irow,
Id  icol,
bool  printWhyNot = false 
) const

Indicate if the given indices are valid for the current matrix size

Indicate if the given indices are valid for the current matrix size

Parameters
irowRow index
icolColumn index
printWhyNotPrint the message is the answer is false
Returns
true if indices are valid for the current matrix size

◆ linearCombination()

void gstlrn::AMatrix::linearCombination ( double  val1,
const AMatrix mat1,
double  val2 = 1.,
const AMatrix mat2 = nullptr,
double  val3 = 1.,
const AMatrix mat3 = nullptr 
)
virtual

Perfom the algebraic equation this = val1 * mat1 + val2 * mat2 + val3 * mat3.

Perform 'this' = 'val1' * 'mat1' + 'val2' * 'mat2' + 'val3' * 'mat3'

Parameters
val1Coefficient of first matrx
mat1First matrix (optional)
val2Coefficient of second matrix
mat2Second matrix (optional)
val3Coefficient of third matrix
mat3Third matrix (optional)

Reimplemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ makePositiveColumn()

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

◆ multiplyColumn()

virtual void gstlrn::AMatrix::multiplyColumn ( const 1 &  vec)
pure virtual

Multiply a Matrix column-wise

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ multiplyRow()

virtual void gstlrn::AMatrix::multiplyRow ( const 1 &  vec)
pure virtual

Multiply a Matrix row-wise

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ mustBeSymmetric()

virtual bool gstlrn::AMatrix::mustBeSymmetric ( ) const
inlinevirtual

Say if the matrix must be symmetric

Reimplemented in gstlrn::MatrixSymmetric, gstlrn::MatrixDense, and gstlrn::MatrixSquare.

◆ operator()() [1/2]

double & gstlrn::AMatrix::operator() ( Id  row,
Id  col 
)
inline

Set value operator

◆ operator()() [2/2]

double gstlrn::AMatrix::operator() ( Id  row,
Id  col 
) const
inline

Get value operator

◆ operator=()

AMatrix & gstlrn::AMatrix::operator= ( const AMatrix m)

◆ prodMat()

void gstlrn::AMatrix::prodMat ( const AMatrix matY,
bool  transposeY = false 
)

Perform 'this' = 'y' %*% 'this' or 'this' %*% 'y'

◆ prodMatMatInPlace()

void gstlrn::AMatrix::prodMatMatInPlace ( const AMatrix x,
const AMatrix y,
bool  transposeX = false,
bool  transposeY = false 
)
virtual

Perform 'this' = 'x' * 'y'

Store the product of 'x'(or 't(x)') by 'y' (or 't(y') in this

Parameters
xFirst Matrix
ySecond matrix
transposeXTrue if first matrix must be transposed
transposeYTrue if second matrix must be transposed

Reimplemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ prodMatVec()

gstlrn::AMatrix::prodMatVec ( const 1 &  x,
bool  transpose = false 
) const

Perform 'y' = 'this' * 'x'

◆ prodMatVecInPlace()

void gstlrn::AMatrix::prodMatVecInPlace ( const 1 &  x,
1 &  y,
bool  transpose = false 
) const

Returns 'y' = 'this' %*% 'x'

Parameters
xInput vector
yOutput vector
transposeTrue if the matrix 'this' must be transposed

◆ prodMatVecInPlaceC()

void gstlrn::AMatrix::prodMatVecInPlaceC ( const constvect  x,
vect  y,
bool  transpose = false 
) const

◆ prodNormMatInPlace()

void gstlrn::AMatrix::prodNormMatInPlace ( const AMatrix a,
bool  transpose = false 
)
virtual

Perform 'this' = 't(A)' %*% 'A' or 'A' %*% 't(A)'

Reimplemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ prodNormMatMatInPlace()

void gstlrn::AMatrix::prodNormMatMatInPlace ( const AMatrix a,
const AMatrix m,
bool  transpose = false 
)
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'

Parameters
aMatrix A
mMatrix M
transposeTrue for first implementation, False for the second

Reimplemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ prodNormMatVecInPlace()

void gstlrn::AMatrix::prodNormMatVecInPlace ( const AMatrix a,
const 1 &  vec,
bool  transpose = false 
)
virtual

Perform 'this' = 't(A)' %*% 'vec' %*% 'A' or 'A' %*% 'vec' %*% 't(A)'

Reimplemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ prodScalar()

virtual void gstlrn::AMatrix::prodScalar ( double  v)
pure virtual

Multiply each matrix component by a value

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ prodVecMat()

gstlrn::AMatrix::prodVecMat ( const 1 &  x,
bool  transpose = false 
) const

Perform 'y' = 'x' * 'this'

◆ prodVecMatInPlace()

void gstlrn::AMatrix::prodVecMatInPlace ( const 1 &  x,
1 &  y,
bool  transpose = false 
) const

◆ prodVecMatInPlaceC()

void gstlrn::AMatrix::prodVecMatInPlaceC ( const constvect  x,
vect  y,
bool  transpose = false 
) const

◆ prodVecMatVec()

double gstlrn::AMatrix::prodVecMatVec ( const 1 &  x,
const 1 &  y 
) const

Perform x %*% 'this' %*% y

◆ reset()

void gstlrn::AMatrix::reset ( Id  nrows,
Id  ncols 
)
virtual

Reimplemented in gstlrn::Table.

◆ resetFromArray()

void gstlrn::AMatrix::resetFromArray ( Id  nrows,
Id  ncols,
const double *  tab,
bool  byCol = true 
)
virtual

Reset the matrix from an array of double values.

Parameters
nrowsNew number of rows
ncolsNew number of columns
tabThe array of values
byColTrue if values are column-major in the array

Reimplemented in gstlrn::MatrixSparse.

◆ resetFromValue()

void gstlrn::AMatrix::resetFromValue ( Id  nrows,
Id  ncols,
double  value 
)
virtual

Reset the matrix to new dimensions and fill with a new value.

Parameters
nrowsNew number of rows
ncolsNew number of columns
valueThe new value used to fill the matrix

Reimplemented in gstlrn::MatrixSparse.

◆ resetFromVD()

void gstlrn::AMatrix::resetFromVD ( Id  nrows,
Id  ncols,
const 1 &  tab,
bool  byCol = true 
)
virtual

Reset the matrix from a vector of double values.

Parameters
nrowsNew number of rows
ncolsNew number of columns
tabThe vector of values
byColTrue if values are column-major in the vector

Reimplemented in gstlrn::MatrixSparse.

◆ resetFromVVD()

void gstlrn::AMatrix::resetFromVVD ( const 1 &  tab,
bool  byCol = true 
)
virtual

Reset the matrix from an array of double values.

Parameters
tabThe array of values
byColTrue if values are column-major in the array

Reimplemented in gstlrn::MatrixSparse, gstlrn::MatrixSquare, and gstlrn::MatrixSymmetric.

◆ resize()

void gstlrn::AMatrix::resize ( Id  nrows,
Id  ncols 
)

Resize the matrix to new dimensions (this method doesn't change the storage type)

Modify the dimension of the matrix (if needed)

Parameters
nrowsNew number of rows
ncolsNew number of columns

◆ setColumn()

virtual void gstlrn::AMatrix::setColumn ( Id  icol,
const 1 &  tab 
)
pure virtual

Set the contents of a Column

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ setColumnToConstant()

virtual void gstlrn::AMatrix::setColumnToConstant ( Id  icol,
double  value 
)
pure virtual

Set the contents of a Column to a constant value

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ setDiagonal()

virtual void gstlrn::AMatrix::setDiagonal ( const 1 &  tab)
pure virtual

Set the contents of the (main) Diagonal

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ setDiagonalToConstant()

virtual void gstlrn::AMatrix::setDiagonalToConstant ( double  value = 1.)
pure virtual

Set the contents of the (main) Diagonal to a constant value

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ setIdentity()

void gstlrn::AMatrix::setIdentity ( double  value = 1.)

Sets the matrix as Identity

◆ setRow()

virtual void gstlrn::AMatrix::setRow ( Id  irow,
const 1 &  tab 
)
pure virtual

Set the contents of a Row

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ setRowToConstant()

virtual void gstlrn::AMatrix::setRowToConstant ( Id  irow,
double  value 
)
pure virtual

Set the contents of a Row to a constant value

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ setValue()

virtual void gstlrn::AMatrix::setValue ( Id  irow,
Id  icol,
double  value 
)
pure virtual

Sets the value at row 'irow' and column 'icol'

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.

◆ setValues()

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

Parameters
values
byColtrue for Column major; false for Row Major

◆ size()

Id gstlrn::AMatrix::size ( ) const
inline

Get the total number of elements of the (full) matrix

◆ solve()

Id gstlrn::AMatrix::solve ( const 1 &  b,
1 &  x 
) const

Solving the Matrix Linear system

◆ toString()

String gstlrn::AMatrix::toString ( const AStringFormat strfmt = nullptr) const
overridevirtual

Interface to AStringable.

Reimplemented from gstlrn::AStringable.

Reimplemented in gstlrn::ProjMatrix, gstlrn::MatrixSparse, and gstlrn::Table.

◆ transpose()

AMatrix * gstlrn::AMatrix::transpose ( ) const
virtual

Transpose the matrix and return it as a copy

Reimplemented in gstlrn::MatrixSparse.

◆ transposeInPlace()

void gstlrn::AMatrix::transposeInPlace ( )
virtual

Transpose the matrix in place

◆ updValue()

virtual void gstlrn::AMatrix::updValue ( Id  irow,
Id  icol,
const EOperator &  oper,
double  value 
)
pure virtual

Update the value at row 'irow' and column 'icol'

Implemented in gstlrn::MatrixDense, and gstlrn::MatrixSparse.


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