gstlearn  0.2.1
Geostatistics & Machine Learning toolbox
MatrixRectangular Class Reference

#include <MatrixRectangular.hpp>

Inheritance diagram for MatrixRectangular:
AMatrix AStringable ICloneable Table

Public Member Functions

 MatrixRectangular (int nrow=0, int ncol=0, bool sparse=false)
 
 MatrixRectangular (const MatrixRectangular &m)
 
MatrixRectangularoperator= (const MatrixRectangular &r)
 
virtual ~MatrixRectangular ()
 
bool mustBeSymmetric () const override
 Cloneable interface. More...
 
bool mustBeDiagonal () const override
 
bool mustBeDiagCst () const override
 
void addRow (int nrow_added=1)
 
void addColumn (int ncolumn_added=1)
 
MatrixRectangularreduce (const VectorInt &validRows, const VectorInt &validCols) const
 
- Public Member Functions inherited from AMatrix
virtual ~AMatrix ()
 
void init (int nrows, int ncols, bool sparse=false)
 
int getNRows () const
 
int getNCols () const
 
int getNTotal () const
 
virtual double getValue (int irow, int icol) const
 
virtual double getValue (int rank) const
 
virtual double & getValueRef (int irow, int icol)
 
VectorDouble getValues () const
 
void getValuesAsTriplets (VectorInt &irows, VectorInt &icols, VectorDouble &values) const
 
VectorDouble getDiagonal (int shift=0) const
 
VectorDouble getRow (int irow) const
 
VectorDouble getColumn (int icol) const
 
void add (int irow, int icol, double value)
 
void add (const AMatrix &tab, double value=1.)
 
void subtract (const AMatrix &tab, double value=1.)
 
virtual void setColumn (int icol, const VectorDouble &tab)
 
virtual void setRow (int irow, const VectorDouble &tab)
 
virtual void setDiagonal (const VectorDouble &tab)
 
virtual void setDiagonal (double value=1.)
 
const cs * getCs () const
 
Triplet getCsToTriplet (bool flag_from_1=false) const
 
bool isSameSize (const AMatrix &m) const
 
bool isSparse () const
 
bool isEmpty () const
 
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) const
 
virtual bool isDiagonal (bool printWhyNot=false) const
 
virtual bool isDiagCst (bool printWhyNot=false) const
 
bool isSame (const AMatrix &m, double eps=EPSILON10)
 
void reset (int nrows, int ncols, bool sparse=false)
 
void reset (int nrows, int ncols, double value, bool sparse=false)
 
void reset (int nrows, int ncols, const double *tab, bool sparse=false)
 
void reset (int nrows, int ncols, const VectorDouble &tab, bool sparse=false, bool flagByRow=true)
 
void reset (const VectorVectorDouble &tab, bool flagByRow=true)
 
double compare (const AMatrix &mat) const
 
void toSparseInPlace ()
 
AMatrixtoSparse () const
 
virtual void transposeInPlace ()
 
virtual AMatrixtranspose () const
 
virtual void addScalar (double v)
 
virtual void addScalarDiag (double v)
 
virtual void prodScalar (double v)
 
void prodVector (const double *inv, double *outv) const
 
void prodVector (const VectorDouble &inv, VectorDouble &outv) const
 
void multiplyRow (const VectorDouble &vec)
 
void multiplyColumn (const VectorDouble &vec)
 
void divideRow (const VectorDouble &vec)
 
void divideColumn (const VectorDouble &vec)
 
virtual void addMatrix (const AMatrix &y)
 
virtual void prodMatrix (const AMatrix &x, const AMatrix &y)
 
virtual void linearCombination (double cx, double cy, const AMatrix &y)
 
int invert ()
 
int solve (const VectorDouble &b, VectorDouble &x) const
 
void dumpElements (const String &title, int ifrom, int ito) const
 
virtual String toString (const AStringFormat *strfmt=nullptr) const override
 
virtual void setValue (int irow, int icol, double value)
 
virtual void setValue (int rank, double value)
 
void setIdentity (double value=1.)
 
void fill (double value)
 
void fillRandom (int seed=432432, double zeroPercent=0.1)
 
void setValuesOldStyle (const double *values, bool byCol=true)
 
void setValues (const VectorDouble &values, bool byCol=true)
 
void setValuesByArrays (const VectorInt &irows, const VectorInt &icols, const VectorDouble &values)
 
double getMeanByColumn (int icol) const
 
double getMinimum () const
 
double getMaximum () const
 
void copyReduce (const AMatrix *x, const VectorInt &validRows, const VectorInt &validCols)
 
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, bool sparse=false)
 
static MatrixRectangularcreateFromVD (const VectorDouble &X, int nrow, int ncol, bool byCol=false, bool sparse=false)
 

Public Attributes

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

Protected Member Functions

virtual double & _getValueRef (int irow, int icol) override
 
- Protected Member Functions inherited from AMatrix
 AMatrix (int nrow=0, int ncol=0, bool sparse=false)
 
 AMatrix (const cs *A)
 
 AMatrix (const AMatrix &m)
 
AMatrixoperator= (const AMatrix &m)
 
virtual bool _isPhysicallyPresent (int, int) const
 
virtual void _clearContents ()
 
void _setNCols (int ncols)
 
void _setNRows (int nrows)
 
bool _isNumbersValid (int nrows, int ncols) const
 
bool _isColumnValid (int icol) const
 
bool _isRowValid (int irow) const
 
bool _isIndexValid (int irow, int icol) const
 
bool _isRowVectorConsistent (const VectorDouble &tab)
 
bool _isColVectorConsistent (const VectorDouble &tab)
 
bool _isVectorSizeConsistent (int nrows, int ncols, const VectorDouble &tab)
 
bool _isRankValid (int rank) const
 
void _clear ()
 

Private Member Functions

bool _isCompatible (const AMatrix &m) const override
 
double _getValue (int irow, int icol) const override
 
double _getValue (int irank) const override
 
void _setValue (int rank, double value) override
 
void _setValue (int irow, int icol, double value) override
 
void _setValues (const double *values, bool byCol=true) override
 
int _getMatrixSize () const override
 
void _transposeInPlace () override
 
void _allocate () override
 
void _deallocate () override
 
void _prodVector (const double *inv, double *outv) const override
 
int _invert () override
 
int _solve (const VectorDouble &b, VectorDouble &x) const override
 
int _getIndexToRank (int irow, int icol) const
 

Private Attributes

VectorDouble _rectMatrix
 

Detailed Description

Rectangular matrices are stored by columns

Constructor & Destructor Documentation

◆ MatrixRectangular() [1/2]

MatrixRectangular::MatrixRectangular ( int  nrow = 0,
int  ncol = 0,
bool  sparse = false 
)

◆ MatrixRectangular() [2/2]

MatrixRectangular::MatrixRectangular ( const MatrixRectangular m)

◆ ~MatrixRectangular()

MatrixRectangular::~MatrixRectangular ( )
virtual

Member Function Documentation

◆ _allocate()

void MatrixRectangular::_allocate ( )
overrideprivatevirtual

Implements AMatrix.

◆ _deallocate()

void MatrixRectangular::_deallocate ( )
overrideprivatevirtual

Implements AMatrix.

◆ _getIndexToRank()

int MatrixRectangular::_getIndexToRank ( int  irow,
int  icol 
) const
private

◆ _getMatrixSize()

int MatrixRectangular::_getMatrixSize ( ) const
overrideprivatevirtual

Implements AMatrix.

◆ _getValue() [1/2]

double MatrixRectangular::_getValue ( int  irow,
int  icol 
) const
overrideprivatevirtual

Implements AMatrix.

◆ _getValue() [2/2]

double MatrixRectangular::_getValue ( int  irank) const
overrideprivatevirtual

Implements AMatrix.

◆ _getValueRef()

double & MatrixRectangular::_getValueRef ( int  irow,
int  icol 
)
overrideprotectedvirtual

Gets a reference to the value at row 'irow' and column 'icol'

Implements AMatrix.

◆ _invert()

int MatrixRectangular::_invert ( )
overrideprivatevirtual

Implements AMatrix.

◆ _isCompatible()

bool MatrixRectangular::_isCompatible ( const AMatrix m) const
inlineoverrideprivatevirtual

Implements AMatrix.

◆ _prodVector()

void MatrixRectangular::_prodVector ( const double *  inv,
double *  outv 
) const
overrideprivatevirtual

Implements AMatrix.

◆ _setValue() [1/2]

void MatrixRectangular::_setValue ( int  rank,
double  value 
)
overrideprivatevirtual

Implements AMatrix.

◆ _setValue() [2/2]

void MatrixRectangular::_setValue ( int  irow,
int  icol,
double  value 
)
overrideprivatevirtual

Implements AMatrix.

◆ _setValues()

void MatrixRectangular::_setValues ( const double *  values,
bool  byCol = true 
)
overrideprivatevirtual

Implements AMatrix.

◆ _solve()

int MatrixRectangular::_solve ( const VectorDouble b,
VectorDouble x 
) const
overrideprivatevirtual

Implements AMatrix.

◆ _transposeInPlace()

void MatrixRectangular::_transposeInPlace ( )
overrideprivatevirtual

Implements AMatrix.

◆ 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 of Rectangular Matrix)

◆ createFromVD()

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

◆ createFromVVD()

MatrixRectangular * MatrixRectangular::createFromVVD ( const VectorVectorDouble X,
bool  sparse = false 
)
static

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

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

◆ mustBeDiagCst()

bool MatrixRectangular::mustBeDiagCst ( ) const
inlineoverridevirtual

Say if the matrix must be diagonal constant

Reimplemented from AMatrix.

◆ mustBeDiagonal()

bool MatrixRectangular::mustBeDiagonal ( ) const
inlineoverridevirtual

Say if the matrix must be diagonal

Reimplemented from AMatrix.

◆ mustBeSymmetric()

bool MatrixRectangular::mustBeSymmetric ( ) const
inlineoverridevirtual

Cloneable interface.

Say if the matrix must be symmetric

Reimplemented from AMatrix.

◆ operator=()

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

◆ reduce()

MatrixRectangular * MatrixRectangular::reduce ( const VectorInt validRows,
const VectorInt validCols 
) const

Member Data Documentation

◆ _rectMatrix

VectorDouble MatrixRectangular::_rectMatrix
private

◆ DECLARE_TOTL

MatrixRectangular::DECLARE_TOTL

Has a specific implementation in the Target language.


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