1.4.0
CCC
 
MatrixRectangular Class Reference

#include <MatrixRectangular.hpp>

Inheritance diagram for MatrixRectangular:
AMatrixDense AMatrix AStringable ICloneable AMatrixSquare Table MatrixSquareGeneral MatrixSquareSymmetric

Detailed Description

Rectangular matrices are stored by columns

Public Member Functions

 MatrixRectangular (int nrow=0, int ncol=0)
 
 MatrixRectangular (const MatrixRectangular &r)
 
 MatrixRectangular (const AMatrix &m)
 
MatrixRectangularoperator= (const MatrixRectangular &r)
 
virtual ~MatrixRectangular ()
 
bool mustBeSymmetric () const override
 Cloneable interface. More...
 
void unsample (const AMatrix *A, const VectorInt &rowFetch, const VectorInt &colFetch)
 Set the values contained in 'A' into the current matrix. More...
 
void addRow (int nrow_added=1)
 
void addColumn (int ncolumn_added=1)
 
- Public Member Functions inherited from AMatrixDense
 AMatrixDense (int nrow=0, int ncol=0)
 
 AMatrixDense (const AMatrixDense &r)
 
 AMatrixDense (const AMatrix &m)
 
AMatrixDenseoperator= (const AMatrixDense &r)
 
virtual ~AMatrixDense ()
 
bool isDense () const override
 Interface for AMatrix. More...
 
bool isSparse () const override
 
void setValue (int irow, int icol, double value, bool flagCheck=false) override
 
virtual double getValue (int irow, int icol, bool flagCheck=false) const override
 
void updValue (int irow, int icol, const EOperator &oper, double value, bool flagCheck=false) override
 
virtual void setColumn (int icol, const VectorDouble &tab, bool flagCheck=true) override
 
virtual void setRow (int irow, const VectorDouble &tab, bool flagCheck=true) override
 
virtual void setDiagonal (const VectorDouble &tab, bool flagCheck=true) override
 
virtual void setDiagonalToConstant (double value=1.) override
 
virtual void addScalar (double v) override
 
virtual void addScalarDiag (double v) override
 
virtual void prodScalar (double v) override
 
virtual void fill (double value) override
 
virtual void multiplyRow (const VectorDouble &vec) override
 
virtual void multiplyColumn (const VectorDouble &vec) override
 
virtual void divideRow (const VectorDouble &vec) override
 
virtual void divideColumn (const VectorDouble &vec) override
 
virtual VectorDouble prodVecMat (const VectorDouble &x, bool transpose=false) const override
 
virtual VectorDouble prodMatVec (const VectorDouble &x, bool transpose=false) const override
 
virtual VectorDouble getRow (int irow) const override
 
virtual VectorDouble getColumn (int icol) const override
 
virtual void prodMatMatInPlace (const AMatrix *x, const AMatrix *y, bool transposeX=false, bool transposeY=false) override
 
void addMatInPlace (const AMatrixDense &y, double cx=1., double cy=1.)
 The next functions use specific definition of matrix (to avoid dynamic_cast) rather than manipulating AMatrix. They are not generic of AMatrix anymore. WARNING: output matrix should not match any of input matrices (speed up). More...
 
virtual void prodNormMatMatInPlace (const AMatrixDense *a, const AMatrixDense *m, bool transpose=false)
 
virtual void prodNormMatInPlace (const AMatrixDense &a, const VectorDouble &vec=VectorDouble(), bool transpose=false)
 
VectorDouble getEigenValues () const
 
const MatrixSquareGeneralgetEigenVectors () const
 
const Eigen::MatrixXd * getTab () const
 
- Public Member Functions inherited from AMatrix
 AMatrix (int nrow=0, int ncol=0)
 
 AMatrix (const AMatrix &m)
 
AMatrixoperator= (const AMatrix &m)
 
virtual ~AMatrix ()
 
virtual void reset (int nrows, int ncols)
 
virtual void resetFromValue (int nrows, int ncols, double value)
 Reset the matrix to new dimensions and fill with a new value. More...
 
virtual void resetFromArray (int nrows, int ncols, const double *tab, bool byCol=true)
 Reset the matrix from an array of double values. More...
 
virtual void resetFromVD (int nrows, int ncols, const VectorDouble &tab, bool byCol=true)
 Reset the matrix from a vector of double values. More...
 
virtual void resetFromVVD (const VectorVectorDouble &tab, bool byCol=true)
 Reset the matrix from an array of double values. More...
 
virtual String toString (const AStringFormat *strfmt=nullptr) const override
 Interface to AStringable. More...
 
virtual bool isSquare (bool printWhyNot=false) const
 
virtual bool isValid (int irow, int icol, bool printWhyNot=false) const
 
virtual bool isIdentity (bool printWhyNot=false) const
 
virtual bool isSymmetric (bool printWhyNot=false, double eps=EPSILON10) const
 
virtual void transposeInPlace ()
 
virtual AMatrixtranspose () const
 
virtual NF_Triplet getMatrixToTriplet (int shiftRow=0, int shiftCol=0) const
 
void addMatInPlace (const AMatrix &y, double cx=1., double cy=1.)
 
void prodMatInPlace (const AMatrix *matY, bool transposeY=false)
 
void prodNormMatMatInPlace (const AMatrix *a, const AMatrix *m, bool transpose=false)
 
void prodNormMatInPlace (const AMatrix &a, const VectorDouble &vec=VectorDouble(), bool transpose=false)
 
void resize (int nrows, int ncols)
 Resize the matrix to new dimensions (this method doesn't change the storage type) More...
 
void addValue (int irow, int 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
 
int getNRows () const
 
int getNCols () const
 
int size () const
 
VectorDouble getValues (bool byCol=true) const
 
VectorDouble getDiagonal (int shift=0) const
 
bool isColumnDefined (int icol) const
 
bool isRowDefined (int irow) const
 
int getNumberColumnDefined () const
 
int getNumberRowDefined () const
 
bool isNonNegative (bool verbose=false) const
 
void prodMatVecInPlace (const VectorDouble &x, VectorDouble &y, bool transpose=false) const
 
int prodMatVecInPlace (const Eigen::VectorXd &x, Eigen::VectorXd &y, bool transpose=false) const
 
void prodMatVecInPlacePtr (const double *x, double *y, bool transpose=false) const
 
void prodVecMatInPlace (const VectorDouble &x, VectorDouble &y, bool transpose=false) const
 
void prodVecMatInPlacePtr (const double *x, double *y, bool transpose=false) const
 
double quadraticMatrix (const VectorDouble &x, const VectorDouble &y)
 
int invert ()
 
int solve (const VectorDouble &b, VectorDouble &x) const
 
void dumpElements (const String &title, int ifrom, int ito) const
 
void setIdentity (double value=1.)
 
void fillRandom (int seed=432432, double zeroPercent=0)
 
void setValues (const VectorDouble &values, bool byCol=true)
 
double getMeanByColumn (int icol) const
 
double getMinimum () const
 
double getMaximum () const
 
double getNormInf () const
 
void copyReduce (const AMatrix *x, const VectorInt &validRows, const VectorInt &validCols)
 
void copyElements (const AMatrix &m, double factor=1.)
 
void setFlagCheckAddress (bool flagCheckAddress)
 
void makePositiveColumn ()
 
void linearCombination (double val1, const AMatrix *mat1, double val2=1., const AMatrix *mat2=nullptr, double val3=1., const AMatrix *mat3=nullptr)
 
virtual int addProdMatVecInPlace (const Eigen::VectorXd &x, Eigen::VectorXd &y, bool transpose=false) const
 
double operator() (int row, int col) const
 
double & operator() (int row, int col)
 
- Public Member Functions inherited from AStringable
 AStringable ()
 
 AStringable (const AStringable &r)
 
AStringableoperator= (const AStringable &r)
 
virtual ~AStringable ()
 
virtual void display (const AStringFormat *strfmt=nullptr) const final
 
virtual void display (int level) const final
 
- Public Member Functions inherited from ICloneable
 ICloneable ()
 
virtual ~ICloneable ()
 
virtual ICloneableclone () const =0
 

Static Public Member Functions

static MatrixRectangularcreateFromVVD (const VectorVectorDouble &X)
 
static MatrixRectangularcreateFromVD (const VectorDouble &X, int nrow, int ncol, bool byCol=false, bool invertColumnOrder=false)
 
static MatrixRectangularglue (const AMatrix *A1, const AMatrix *A2, bool flagShiftRow, bool flagShiftCol)
 
static MatrixRectangularsample (const AMatrix *A, const VectorInt &rowKeep=VectorInt(), const VectorInt &colKeep=VectorInt())
 Create an output Rectangular Matrix by selecting some rows and columns of the Input matrix 'A'. More...
 

Public Attributes

 DECLARE_TOTL
 Has a specific implementation in the Target language. More...
 

Constructor & Destructor Documentation

◆ MatrixRectangular() [1/3]

MatrixRectangular::MatrixRectangular ( int  nrow = 0,
int  ncol = 0 
)

◆ MatrixRectangular() [2/3]

MatrixRectangular::MatrixRectangular ( const MatrixRectangular r)

◆ MatrixRectangular() [3/3]

MatrixRectangular::MatrixRectangular ( const AMatrix m)

◆ ~MatrixRectangular()

MatrixRectangular::~MatrixRectangular ( )
virtual

Member Function Documentation

◆ addColumn()

void MatrixRectangular::addColumn ( int  ncolumn_added = 1)

◆ addRow()

void MatrixRectangular::addRow ( int  nrow_added = 1)

Adding a Row or a Column (at the bottom or right of Rectangular Matrix)

◆ createFromVD()

MatrixRectangular * MatrixRectangular::createFromVD ( const VectorDouble X,
int  nrow,
int  ncol,
bool  byCol = false,
bool  invertColumnOrder = false 
)
static

◆ createFromVVD()

MatrixRectangular * MatrixRectangular::createFromVVD ( const VectorVectorDouble 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

◆ glue()

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

◆ mustBeSymmetric()

bool MatrixRectangular::mustBeSymmetric ( ) const
inlineoverridevirtual

Cloneable interface.

Interface for AMatrix

Say if the matrix must be symmetric

Reimplemented from AMatrix.

Reimplemented in MatrixSquareGeneral, and MatrixSquareSymmetric.

◆ operator=()

MatrixRectangular & MatrixRectangular::operator= ( const MatrixRectangular r)

◆ sample()

MatrixRectangular * MatrixRectangular::sample ( const AMatrix A,
const VectorInt rowKeep = VectorInt(),
const VectorInt colKeep = VectorInt() 
)
static

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

Parameters
AInput Rectangular Matrix
rowKeepSet of Rows to be kept (all if not defined)
colKeepSet of Columns to be kept (all if not defined)
Returns
Pointer to the newly created Rectangular Matrix

◆ unsample()

void MatrixRectangular::unsample ( const AMatrix A,
const VectorInt rowFetch,
const VectorInt colFetch 
)

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

Member Data Documentation

◆ DECLARE_TOTL

MatrixRectangular::DECLARE_TOTL

Has a specific implementation in the Target language.


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