gstlearn  1.0.0
CCC
MatrixInt Class Reference

#include <MatrixInt.hpp>

Inheritance diagram for MatrixInt:
AStringable ICloneable

Public Member Functions

 MatrixInt (int nrow=0, int ncol=0)
 
 MatrixInt (const MatrixInt &m)
 
MatrixIntoperator= (const MatrixInt &r)
 
virtual ~MatrixInt ()
 
virtual String toString (const AStringFormat *strfmt=nullptr) const override
 ICloneable interface. More...
 
void reset (int nrows, int ncols)
 
int getValue (int irow, int icol) const
 
int getValue (int irank) const
 
int & getValueRef (int irow, int icol)
 
void setValue (int rank, int value)
 
void setValue (int irow, int icol, int value)
 
int getMatrixSize () const
 
int size () const
 
VectorInt getValues () const
 
VectorInt getValuesPerRow (int irow) const
 
VectorInt getValuesPerColumn (int icol) const
 
VectorVectorInt getMatrix () const
 
void setValues (const VectorInt &values, bool byCol=true)
 
void setValuesOldStyle (const int *values, bool byCol=true)
 
void transposeInPlace ()
 
bool empty () const
 
void fill (int value)
 
int getNCols () const
 
void setNCols (int cols)
 
int getNRows () const
 
void setNRows (int rows)
 
int operator() (int irow, int icol) const
 
int & operator() (int irow, int icol)
 
- 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 MatrixIntcreateFromVVD (const VectorVectorInt &X)
 

Private Member Functions

void _allocate ()
 
void _deallocate ()
 
bool _isIndexValid (int irow, int icol) const
 
bool _isRankValid (int rank) const
 
bool _isNumbersValid (int nrows, int ncols) const
 
int _getIndexToRank (int irow, int icol) const
 

Private Attributes

int _nRows
 
int _nCols
 
VectorInt _rectMatrix
 

Detailed Description

Rectangular matrices are stored by columns

Constructor & Destructor Documentation

◆ MatrixInt() [1/2]

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

◆ MatrixInt() [2/2]

MatrixInt::MatrixInt ( const MatrixInt m)

◆ ~MatrixInt()

MatrixInt::~MatrixInt ( )
virtual

Member Function Documentation

◆ _allocate()

void MatrixInt::_allocate ( )
private

◆ _deallocate()

void MatrixInt::_deallocate ( )
private

◆ _getIndexToRank()

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

◆ _isIndexValid()

bool MatrixInt::_isIndexValid ( int  irow,
int  icol 
) const
private

◆ _isNumbersValid()

bool MatrixInt::_isNumbersValid ( int  nrows,
int  ncols 
) const
private

◆ _isRankValid()

bool MatrixInt::_isRankValid ( int  rank) const
private

◆ createFromVVD()

MatrixInt * MatrixInt::createFromVVD ( const VectorVectorInt X)
static

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

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

◆ empty()

bool MatrixInt::empty ( ) const
inline

◆ fill()

void MatrixInt::fill ( int  value)

◆ getMatrix()

VectorVectorInt MatrixInt::getMatrix ( ) const

◆ getMatrixSize()

int MatrixInt::getMatrixSize ( ) const

◆ getNCols()

int MatrixInt::getNCols ( ) const
inline

◆ getNRows()

int MatrixInt::getNRows ( ) const
inline

◆ getValue() [1/2]

int MatrixInt::getValue ( int  irank) const

◆ getValue() [2/2]

int MatrixInt::getValue ( int  irow,
int  icol 
) const

◆ getValueRef()

int & MatrixInt::getValueRef ( int  irow,
int  icol 
)

◆ getValues()

VectorInt MatrixInt::getValues ( ) const

◆ getValuesPerColumn()

VectorInt MatrixInt::getValuesPerColumn ( int  icol) const

◆ getValuesPerRow()

VectorInt MatrixInt::getValuesPerRow ( int  irow) const

◆ operator()() [1/2]

int& MatrixInt::operator() ( int  irow,
int  icol 
)
inline

Set value operator override

◆ operator()() [2/2]

int MatrixInt::operator() ( int  irow,
int  icol 
) const
inline

Get value operator override

◆ operator=()

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

◆ reset()

void MatrixInt::reset ( int  nrows,
int  ncols 
)

◆ setNCols()

void MatrixInt::setNCols ( int  cols)
inline

◆ setNRows()

void MatrixInt::setNRows ( int  rows)
inline

◆ setValue() [1/2]

void MatrixInt::setValue ( int  irow,
int  icol,
int  value 
)

◆ setValue() [2/2]

void MatrixInt::setValue ( int  rank,
int  value 
)

◆ setValues()

void MatrixInt::setValues ( const VectorInt 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 int* array

Parameters
valuesInput array (Dimension: nrow * ncol)
byColtrue for Column major; false for Row Major

◆ setValuesOldStyle()

void MatrixInt::setValuesOldStyle ( const int *  values,
bool  byCol = true 
)

◆ size()

int MatrixInt::size ( ) const
inline

◆ toString()

String MatrixInt::toString ( const AStringFormat strfmt = nullptr) const
overridevirtual

ICloneable interface.

AStringable Interface

Reimplemented from AStringable.

◆ transposeInPlace()

void MatrixInt::transposeInPlace ( )

Member Data Documentation

◆ _nCols

int MatrixInt::_nCols
private

◆ _nRows

int MatrixInt::_nRows
private

◆ _rectMatrix

VectorInt MatrixInt::_rectMatrix
private

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