1.11.1
CCC
 
Loading...
Searching...
No Matches
gstlrn::MatrixDense Class Reference

#include <MatrixDense.hpp>

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

Detailed Description

Dense Matrix This class provides all the functions that can be performed using a Matrix stored in "Dense" format (in opposition to the "Sparse" format). This class can be derived in the case the matrix is Square, and even more if it is Square and Symmetric.

Public Member Functions

 MatrixDense (Id nrow=0, Id ncol=0)
 
 MatrixDense (const MatrixDense &r)
 
 MatrixDense (const AMatrix &r)
 
MatrixDenseoperator= (const MatrixDense &r)
 
virtual ~MatrixDense ()
 
DECLARE_TOLATEX EIGEN_MAKE_ALIGNED_OPERATOR_NEW bool isDense () const override
 Cloneable interface.
 
bool isSparse () const override
 
double getValue (Id irow, Id icol) const override
 
void setValue (Id irow, Id icol, double value) override
 
void updValue (Id irow, Id icol, const EOperator &oper, double value) override
 
 getColumn (Id icol) const override
 
void setColumn (Id icol, const 1 &tab) override
 
void setColumnToConstant (Id icol, double value) override
 
 getRow (Id irow) const override
 
void setRow (Id irow, const 1 &tab) override
 
void setRowToConstant (Id irow, double value) override
 
void setDiagonal (const 1 &tab) override
 
void setDiagonalToConstant (double value=1.) override
 
void multiplyRow (const 1 &vec) override
 
void multiplyColumn (const 1 &vec) override
 
void divideRow (const 1 &vec) override
 
void divideColumn (const 1 &vec) override
 
void fill (double value) override
 
bool mustBeSymmetric () const override
 
void prodMatMatInPlace (const AMatrix *x, const AMatrix *y, bool transposeX=false, bool transposeY=false) override
 
MatrixDenseaddCst (double a)
 
MatrixDenseprodCst (double a)
 
template<bool transposeX, bool transposeY>
void prodMatMatNoCheck (const MatrixDense &x, const MatrixDense &y)
 
void prodNormMatMatInPlace (const AMatrix *a, const AMatrix *m, bool transpose=false) override
 
void prodNormMatVecInPlace (const AMatrix *a, const 1 &vec, bool transpose=false) override
 
void prodNormMatInPlace (const AMatrix *a, bool transpose=false) override
 
void addMatNoCheck (const MatrixDense &y, const double cx=1., const double cy=1.)
 
Id invert2 (MatrixDense &res) const
 
void unsample (const AMatrix *A, const 1 &rowFetch, const 1 &colFetch, bool flagInvertRow=false, bool flagInvertCol=false)
 Set the values contained in 'A' into the current matrix.
 
MatrixDense compressMatLC (const MatrixDense &matLC, bool transpose=false)
 Perform the compressing product, according to 'transpose'.
 
void addRow (Id nrow_added=1)
 
void addColumn (Id ncolumn_added=1)
 
double sum () const
 
constvect getViewOnColumn (Id icol) const
 
vect getViewOnColumnModify (Id icol)
 
MatrixDenseoperator+= (double a)
 
MatrixDenseoperator-= (double a)
 
MatrixDense operator+ (double a) const
 
MatrixDense operator- (double a) const
 
MatrixDenseoperator*= (double a)
 
MatrixDense operator* (double a) const
 
MatrixDenseoperator/= (double a)
 
MatrixDense operator/ (double a) const
 
Eigen::Map< const Eigen::MatrixXd, Eigen::Unaligned > eigenMat () const
 
Eigen::Map< Eigen::MatrixXd, Eigen::Unaligned > eigenMat ()
 
- Public Member Functions inherited from gstlrn::AMatrix
 AMatrix (Id nrow=0, Id ncol=0)
 
 AMatrix (const AMatrix &m)
 
AMatrixoperator= (const AMatrix &m)
 
 AMatrix (AMatrix &&m)=default
 
AMatrixoperator= (AMatrix &&m)=default
 
virtual ~AMatrix ()
 
String toString (const AStringFormat *strfmt=nullptr) const override
 Interface to AStringable.
 
virtual bool isSquare (bool printWhyNot=false) const
 
virtual bool isSymmetric (double eps=EPSILON10, bool printWhyNot=false) 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
 
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)
 
AStringableoperator= (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 ICloneableclone () const =0
 
std::shared_ptr< ICloneablecloneShared () const
 
std::unique_ptr< ICloneablecloneUnique () const
 

Static Public Member Functions

static void _addGeneral (MatrixDense &res, const MatrixDense &other, double cst)
 
static void _addGeneral (MatrixDense &res, const MatrixDense &other1, const MatrixDense &other2)
 Add matrices 'other1' and 'other2' and store the result in 'res' This code is alais-safe, as it does not modify 'other1' and 'other2' and only writes to 'res'.
 
static void _prodGeneral (MatrixDense &res, const MatrixDense &other, double cst)
 
static void _prodGeneral (MatrixDense &res, const MatrixDense &other1, const MatrixDense &other2)
 Make the elementwise product of matrices 'other1' and 'other2' and store the result in 'res' This code is alais-safe, as it does not modify 'other1' and 'other2' and only writes to 'res'.
 
static void _productGeneral (MatrixDense &res, const MatrixDense &other1, const MatrixDense &other2, bool transpose1=false, bool transpose2=false)
 
static void _prodVecAddGeneral (1 &res, const MatrixDense &other, const 1 &vec, bool transpose=false, bool flagInvert=false)
 Add the Product of a matrix by a vector.
 
static void _prodVecAddGeneral (vect &res, const MatrixDense &other, const constvect &vec, bool transpose=false, bool flagInvert=false)
 Add the Product of a matrix by a vector.
 
static void _prodnormGeneral (MatrixDense &res, const MatrixDense &a, const MatrixDense &m=MatrixDense(), bool transpose=false)
 
static void _prodnormGeneral (MatrixDense &res, const MatrixDense &a, const 1 &vec, bool transpose=false)
 
static bool _areIdenticalGeneral (const MatrixDense &a, const MatrixDense &b, bool verbose=false)
 
static MatrixDensecreate (const MatrixDense *mat)
 
static MatrixDensecreate (Id nrow, Id ncol)
 
static double traceProd (const MatrixDense &a, MatrixDense &b)
 
static MatrixDensecreateFromVVD (const 1 &X)
 
static MatrixDensecreateFromVD (const 1 &X, Id nrow, Id ncol, bool byCol=false, bool invertColumnOrder=false)
 
static MatrixDensecreateFillRandom (Id nrow, Id ncol, Id seed=13242)
 
static MatrixDenseglue (const AMatrix *A1, const AMatrix *A2, bool flagShiftRow, bool flagShiftCol)
 
static bool sample (MatrixDense &res, const AMatrix &A, const 1 &rowKeep=1(), const 1 &colKeep=1(), bool flagInvertRow=false, bool flagInvertCol=false)
 Create an output Rectangular Matrix by selecting some rows and columns of the Input matrix 'A'.
 
static void sum (const MatrixDense *mat1, const MatrixDense *mat2, MatrixDense *mat3)
 
- Static Public Member Functions inherited from gstlrn::AMatrix
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.
 

Public Attributes

 DECLARE_TOTL
 Has a specific implementation in the Target language.
 

Constructor & Destructor Documentation

◆ MatrixDense() [1/3]

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

◆ MatrixDense() [2/3]

gstlrn::MatrixDense::MatrixDense ( const MatrixDense r)

◆ MatrixDense() [3/3]

gstlrn::MatrixDense::MatrixDense ( const AMatrix r)

◆ ~MatrixDense()

gstlrn::MatrixDense::~MatrixDense ( )
virtual

Member Function Documentation

◆ _addGeneral() [1/2]

void gstlrn::MatrixDense::_addGeneral ( MatrixDense res,
const MatrixDense other,
double  cst 
)
static

◆ _addGeneral() [2/2]

void gstlrn::MatrixDense::_addGeneral ( MatrixDense res,
const MatrixDense other1,
const MatrixDense other2 
)
static

Add matrices 'other1' and 'other2' and store the result in 'res' This code is alais-safe, as it does not modify 'other1' and 'other2' and only writes to 'res'.

Parameters
resResulting matrix
other1First matrix
other2Second matrix

◆ _areIdenticalGeneral()

bool gstlrn::MatrixDense::_areIdenticalGeneral ( const MatrixDense a,
const MatrixDense b,
bool  verbose = false 
)
static

◆ _prodGeneral() [1/2]

void gstlrn::MatrixDense::_prodGeneral ( MatrixDense res,
const MatrixDense other,
double  cst 
)
static

◆ _prodGeneral() [2/2]

void gstlrn::MatrixDense::_prodGeneral ( MatrixDense res,
const MatrixDense other1,
const MatrixDense other2 
)
static

Make the elementwise product of matrices 'other1' and 'other2' and store the result in 'res' This code is alais-safe, as it does not modify 'other1' and 'other2' and only writes to 'res'.

Parameters
resResulting matrix
other1First matrix
other2Second matrix

◆ _prodnormGeneral() [1/2]

void gstlrn::MatrixDense::_prodnormGeneral ( MatrixDense res,
const MatrixDense a,
const 1 &  vec,
bool  transpose = false 
)
static

◆ _prodnormGeneral() [2/2]

void gstlrn::MatrixDense::_prodnormGeneral ( MatrixDense res,
const MatrixDense a,
const MatrixDense m = MatrixDense(),
bool  transpose = false 
)
static

◆ _productGeneral()

void gstlrn::MatrixDense::_productGeneral ( MatrixDense res,
const MatrixDense other1,
const MatrixDense other2,
bool  transpose1 = false,
bool  transpose2 = false 
)
static

◆ _prodVecAddGeneral() [1/2]

void gstlrn::MatrixDense::_prodVecAddGeneral ( 1 &  res,
const MatrixDense other,
const 1 &  vec,
bool  transpose = false,
bool  flagInvert = false 
)
static

Add the Product of a matrix by a vector.

Parameters
resResulting vector
otherInput matrix
vecInput vector
transposeShould the matrix 'other' be transposed
flagInvertProduct 'other' * 'vec' (F) or 'vec' * 'other' (T)

◆ _prodVecAddGeneral() [2/2]

void gstlrn::MatrixDense::_prodVecAddGeneral ( vect res,
const MatrixDense other,
const constvect vec,
bool  transpose = false,
bool  flagInvert = false 
)
static

Add the Product of a matrix by a vector.

Parameters
resResulting vector
otherInput matrix
vecInput vector
transposeShould the matrix 'other' be transposed
flagInvertProduct 'other' * 'vec' (F) or 'vec' * 'other' (T)

◆ addColumn()

void gstlrn::MatrixDense::addColumn ( Id  ncolumn_added = 1)

◆ addCst()

MatrixDense & gstlrn::MatrixDense::addCst ( double  a)

New methods overload

New methodes for operator overloading

◆ addMatNoCheck()

void gstlrn::MatrixDense::addMatNoCheck ( const MatrixDense y,
const double  cx = 1.,
const double  cy = 1. 
)

Add a matrix (multiplied by a constant)

◆ addRow()

void gstlrn::MatrixDense::addRow ( Id  nrow_added = 1)

◆ compressMatLC()

MatrixDense gstlrn::MatrixDense::compressMatLC ( const MatrixDense matLC,
bool  transpose = false 
)

Perform the compressing product, according to 'transpose'.

  • False: 'this'[nrows,ncols] %*% t('matLC')[ncolsCL,nrowsCL] -> mat[nrows,ncolsCL]
  • True: t('matLC')[ncolsCL,nrowsCL] %*% 'this'[nrows,ncols] -> mat[ncolsCL,ncols]
Parameters
matLC
transpose
Returns
MatrixDense

◆ create() [1/2]

MatrixDense * gstlrn::MatrixDense::create ( const MatrixDense mat)
static

◆ create() [2/2]

MatrixDense * gstlrn::MatrixDense::create ( Id  nrow,
Id  ncol 
)
static

◆ createFillRandom()

MatrixDense * gstlrn::MatrixDense::createFillRandom ( Id  nrow,
Id  ncol,
Id  seed = 13242 
)
static

◆ createFromVD()

MatrixDense * gstlrn::MatrixDense::createFromVD ( const 1 &  X,
Id  nrow,
Id  ncol,
bool  byCol = false,
bool  invertColumnOrder = false 
)
static

◆ createFromVVD()

MatrixDense * gstlrn::MatrixDense::createFromVVD ( const 1 &  X)
static

Converts a VectorVectorDouble into a Matrix Note: the input argument is stored by row (if coming from [] specification)

Parameters
XInput VectorVectorDouble argument
Returns
The returned rectangular matrix
Remarks
: the matrix is transposed implicitly while reading

◆ divideColumn()

void gstlrn::MatrixDense::divideColumn ( const 1 &  vec)
overridevirtual

Divide a Matrix column-wise

Implements gstlrn::AMatrix.

◆ divideRow()

void gstlrn::MatrixDense::divideRow ( const 1 &  vec)
overridevirtual

Divide a Matrix row-wise

Implements gstlrn::AMatrix.

◆ eigenMat() [1/2]

Eigen::Map< Eigen::MatrixXd, Eigen::Unaligned > gstlrn::MatrixDense::eigenMat ( )
inline

◆ eigenMat() [2/2]

Eigen::Map< const Eigen::MatrixXd, Eigen::Unaligned > gstlrn::MatrixDense::eigenMat ( ) const
inline

◆ fill()

void gstlrn::MatrixDense::fill ( double  value)
overridevirtual

Set all the values of the Matrix at once

Implements gstlrn::AMatrix.

◆ getColumn()

gstlrn::MatrixDense::getColumn ( Id  icol) const
overridevirtual

Extract a Column

Reimplemented from gstlrn::AMatrix.

◆ getRow()

gstlrn::MatrixDense::getRow ( Id  irow) const
overridevirtual

Extract a Row

Reimplemented from gstlrn::AMatrix.

◆ getValue()

double gstlrn::MatrixDense::getValue ( Id  irow,
Id  icol 
) const
overridevirtual

Get the value from a matrix cell

Implements gstlrn::AMatrix.

◆ getViewOnColumn()

constvect gstlrn::MatrixDense::getViewOnColumn ( Id  icol) const

◆ getViewOnColumnModify()

vect gstlrn::MatrixDense::getViewOnColumnModify ( Id  icol)

◆ glue()

MatrixDense * gstlrn::MatrixDense::glue ( const AMatrix A1,
const AMatrix A2,
bool  flagShiftRow,
bool  flagShiftCol 
)
static

◆ invert2()

Id gstlrn::MatrixDense::invert2 ( MatrixDense res) const

◆ isDense()

DECLARE_TOLATEX EIGEN_MAKE_ALIGNED_OPERATOR_NEW bool gstlrn::MatrixDense::isDense ( ) const
inlineoverridevirtual

Cloneable interface.

Interface for AMatrix

Returns if the current matrix is Dense

Implements gstlrn::AMatrix.

◆ isSparse()

bool gstlrn::MatrixDense::isSparse ( ) const
inlineoverridevirtual

Returns if the current matrix is Sparse

Implements gstlrn::AMatrix.

◆ multiplyColumn()

void gstlrn::MatrixDense::multiplyColumn ( const 1 &  vec)
overridevirtual

Multiply a Matrix column-wise

Implements gstlrn::AMatrix.

◆ multiplyRow()

void gstlrn::MatrixDense::multiplyRow ( const 1 &  vec)
overridevirtual

Multiply a Matrix row-wise

Implements gstlrn::AMatrix.

◆ mustBeSymmetric()

bool gstlrn::MatrixDense::mustBeSymmetric ( ) const
inlineoverridevirtual

Say if the matrix must be symmetric

Reimplemented from gstlrn::AMatrix.

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

◆ operator*()

MatrixDense gstlrn::MatrixDense::operator* ( double  a) const
inline

◆ operator*=()

MatrixDense & gstlrn::MatrixDense::operator*= ( double  a)
inline

◆ operator+()

MatrixDense gstlrn::MatrixDense::operator+ ( double  a) const
inline

◆ operator+=()

MatrixDense & gstlrn::MatrixDense::operator+= ( double  a)
inline

◆ operator-()

MatrixDense gstlrn::MatrixDense::operator- ( double  a) const
inline

◆ operator-=()

MatrixDense & gstlrn::MatrixDense::operator-= ( double  a)
inline

◆ operator/()

MatrixDense gstlrn::MatrixDense::operator/ ( double  a) const
inline

◆ operator/=()

MatrixDense & gstlrn::MatrixDense::operator/= ( double  a)
inline

◆ operator=()

MatrixDense & gstlrn::MatrixDense::operator= ( const MatrixDense r)

◆ prodCst()

MatrixDense & gstlrn::MatrixDense::prodCst ( double  a)

◆ prodMatMatInPlace()

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

Multiply matrix 'x' by matrix 'y' and store the result in 'this'

Reimplemented from gstlrn::AMatrix.

◆ prodMatMatNoCheck()

template<bool transposeX, bool transposeY>
void gstlrn::MatrixDense::prodMatMatNoCheck ( const MatrixDense x,
const MatrixDense y 
)
inline

◆ prodNormMatInPlace()

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

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

Reimplemented from gstlrn::AMatrix.

◆ prodNormMatMatInPlace()

void gstlrn::MatrixDense::prodNormMatMatInPlace ( const AMatrix a,
const AMatrix m,
bool  transpose = false 
)
overridevirtual

Product 't(A)' %*% 'M' %*% 'A' or 'A' %*% 'M' %*% 't(A)' stored in 'this'

Product of matrices, stored in 'this'

  • transpose = true: t('a') * 'm' * 'a'
  • transpose = false: 'a' * 'm' * t('a')
Parameters
aFirst input matrix
mSecond input matrix
transposeTrue if 'a' should be transposed beforehand
Note
: 'a' and 'm' may NOT coincide with 'this'

Reimplemented from gstlrn::AMatrix.

◆ prodNormMatVecInPlace()

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

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

Product 't(A)' %*% ['vec'] %*% 'A' or 'A' %*% ['vec'] %*% 't(A)' stored in 'this'

Parameters
aInput matrix
vecInput vector
transposeWhen True, the input Matrix is transposed

Reimplemented from gstlrn::AMatrix.

◆ sample()

bool gstlrn::MatrixDense::sample ( MatrixDense res,
const AMatrix A,
const 1 &  rowKeep = 1(),
const 1 &  colKeep = 1(),
bool  flagInvertRow = false,
bool  flagInvertCol = false 
)
static

Create an output Rectangular Matrix by selecting some rows and columns of the Input matrix 'A'.

Parameters
resOutput Rectangular Matrix
AInput Rectangular Matrix
rowKeepSet of Rows to be kept (all if not defined)
colKeepSet of Columns to be kept (all if not defined)
flagInvertRowwhen True, transform 'rowKeep' into 'rowDrop'
flagInvertColwhen True, transform 'colKeep' into 'colDrop'

◆ setColumn()

void gstlrn::MatrixDense::setColumn ( Id  icol,
const 1 &  tab 
)
overridevirtual

Set the contents of a Column

Implements gstlrn::AMatrix.

◆ setColumnToConstant()

void gstlrn::MatrixDense::setColumnToConstant ( Id  icol,
double  value 
)
overridevirtual

Set the contents of a Column to a constant value

Implements gstlrn::AMatrix.

◆ setDiagonal()

void gstlrn::MatrixDense::setDiagonal ( const 1 &  tab)
overridevirtual

Set the contents of the (main) Diagonal

Implements gstlrn::AMatrix.

◆ setDiagonalToConstant()

void gstlrn::MatrixDense::setDiagonalToConstant ( double  value = 1.)
overridevirtual

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

Implements gstlrn::AMatrix.

◆ setRow()

void gstlrn::MatrixDense::setRow ( Id  irow,
const 1 &  tab 
)
overridevirtual

Set the contents of a Row

Implements gstlrn::AMatrix.

◆ setRowToConstant()

void gstlrn::MatrixDense::setRowToConstant ( Id  irow,
double  value 
)
overridevirtual

Set the contents of a Row to a constant value

Implements gstlrn::AMatrix.

◆ setValue()

void gstlrn::MatrixDense::setValue ( Id  irow,
Id  icol,
double  value 
)
overridevirtual

Set the value for in a matrix cell

Implements gstlrn::AMatrix.

◆ sum() [1/2]

double gstlrn::MatrixDense::sum ( ) const

◆ sum() [2/2]

void gstlrn::MatrixDense::sum ( const MatrixDense mat1,
const MatrixDense mat2,
MatrixDense mat3 
)
static

◆ traceProd()

double gstlrn::MatrixDense::traceProd ( const MatrixDense a,
MatrixDense b 
)
static

◆ unsample()

void gstlrn::MatrixDense::unsample ( const AMatrix A,
const 1 &  rowFetch,
const 1 &  colFetch,
bool  flagInvertRow = false,
bool  flagInvertCol = false 
)

Set the values contained in 'A' into the current matrix.

Parameters
AInput Matrix
rowFetchSet of row indices of 'this' where values of 'A' should be stored
colFetchSet of column indices of'this' where values of 'A' should be stored
flagInvertRowwhen True, transform 'rowFetch' into 'rowAvoid'
flagInvertColwhen True, transform 'colFetch' into 'colAvoid'

◆ updValue()

void gstlrn::MatrixDense::updValue ( Id  irow,
Id  icol,
const EOperator &  oper,
double  value 
)
overridevirtual

Update the contents of a matrix cell

Implements gstlrn::AMatrix.

Member Data Documentation

◆ DECLARE_TOTL

gstlrn::MatrixDense::DECLARE_TOTL

Has a specific implementation in the Target language.


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