gstlearn  1.0.0
CCC
Table Class Reference

#include <Table.hpp>

Inheritance diagram for Table:
MatrixRectangular ASerializable AMatrix AStringable ICloneable

Public Member Functions

 Table (int nrow=0, int ncol=0, bool skip_title=false, bool skip_description=false)
 
 Table (const Table &m)
 
Tableoperator= (const Table &m)
 
virtual ~Table ()
 
virtual String toString (const AStringFormat *strfmt=nullptr) const override
 Cloneable interface. More...
 
VectorDouble getRange (int icol) const
 
VectorDouble getAllRange () const
 
void plot (int isimu) const
 
void setColumnNames (const VectorString &colNames)
 
void setColumnName (int icol, const String &name)
 
void setRowNames (const VectorString &rowNames)
 
void setRowName (int irow, const String &name)
 
VectorString getColumnNames () const
 
VectorString getRowNames () const
 
String getColumnName (int icol) const
 
String getRowName (int irow) const
 
const StringgetTitle () const
 
void setTitle (const String &title)
 
void setSkipDescription (bool skipDescription)
 
void setSkipTitle (bool skipTitle)
 
- Public Member Functions inherited from MatrixRectangular
 MatrixRectangular (int nrow=0, int ncol=0)
 
 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)
 
void reset (int nrows, int ncols, double value=0.)
 
void resetFromArray (int nrows, int ncols, const double *tab, bool byCol=true)
 
void resetFromVD (int nrows, int ncols, const VectorDouble &tab, bool byCol=true)
 
void resetFromVVD (const VectorVectorDouble &tab, bool byCol=true)
 
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.)
 
virtual bool isSparse () 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
 
virtual void transposeInPlace ()
 
virtual AMatrixtranspose () const
 
virtual void addScalar (double v)
 
virtual void addScalarDiag (double v)
 
virtual void prodScalar (double v)
 
virtual double getValue (int irow, int icol) const
 
virtual double & getValueRef (int irow, int icol)
 
virtual void setValue (int irow, int icol, double value)
 
virtual void setValuesByArrays (const VectorInt &irows, const VectorInt &icols, const VectorDouble &values)
 
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)
 
bool isSame (const AMatrix &m, double eps=EPSILON10)
 
bool isSameSize (const AMatrix &m) const
 
bool isEmpty () const
 
double compare (const AMatrix &mat) const
 
int getNRows () const
 
int getNCols () const
 
int getNTotal () const
 
VectorDouble getValues (bool byCol=true) const
 
VectorDouble getDiagonal (int shift=0) const
 
VectorDouble getRow (int irow) const
 
VectorDouble getColumn (int icol) const
 
bool isColumnDefined (int icol) const
 
bool isRowDefined (int irow) const
 
int getNumberColumnDefined () const
 
int getNumberRowDefined () 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.)
 
void getValuesAsTriplets (VectorInt &irows, VectorInt &icols, VectorDouble &values) const
 
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)
 
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 fill (double value)
 
void fillRandom (int seed=432432, double zeroPercent=0.1)
 
void setValues (const VectorDouble &values, bool byCol=true)
 
double getMeanByColumn (int icol) const
 
double getMinimum () const
 
double getMaximum () const
 
void copyReduce (const AMatrix *x, const VectorInt &activeRows, const VectorInt &activeCols)
 
void setFlagCheckAddress (bool flagCheckAddress)
 
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
 
- Public Member Functions inherited from ASerializable
 ASerializable ()
 
 ASerializable (const ASerializable &r)
 
ASerializableoperator= (const ASerializable &r)
 
virtual ~ASerializable ()
 
bool deserialize (std::istream &is, bool verbose=true)
 
bool serialize (std::ostream &os, bool verbose=true) const
 
bool dumpToNF (const String &neutralFilename, bool verbose=false) const
 

Static Public Member Functions

static Tablecreate (int nrow=0, int ncol=0)
 
static TablecreateFromNames (const VectorString &rownames, const VectorString &colnames)
 
static TablecreateFromNF (const String &neutralFilename, bool verbose=true)
 
static TablecreateFromTable (const Table &table)
 
- Static Public Member Functions inherited from MatrixRectangular
static MatrixRectangularcreateFromVVD (const VectorVectorDouble &X)
 
static MatrixRectangularcreateFromVD (const VectorDouble &X, int nrow, int ncol, bool byCol=false)
 
- Static Public Member Functions inherited from ASerializable
static String buildFileName (int status, const String &filename, bool ensureDirExist=false)
 
static String getHomeDirectory (const String &sub="")
 
static String getWorkingDirectory ()
 
static String getTestData (const String &subdir, const String &filename)
 
static String getFileIdentity (const String &filename, bool verbose=false)
 
static void setContainerName (bool useDefault, const String &containerName="", bool verbose=false)
 
static void unsetContainerName ()
 
static void setPrefixName (const String &prefixName)
 
static void unsetPrefixName ()
 
static const StringgetContainerName ()
 
static const StringgetPrefixName ()
 
static bool createDirectory (const String &dir)
 
static String getExecDirectory ()
 
static String getDirectory (const String &path)
 

Public Attributes

 DECLARE_TOTL
 Has a specific implementation in the Target language. More...
 
- Public Attributes inherited from MatrixRectangular
 DECLARE_TOTL
 Has a specific implementation in the Target language. More...
 

Protected Member Functions

virtual bool _deserialize (std::istream &is, bool verbose=false) override
 Interface for ASerializable. More...
 
virtual bool _serialize (std::ostream &os, bool verbose=false) const override
 
String _getNFName () const override
 
void _clearContents () override
 
- Protected Member Functions inherited from MatrixRectangular
virtual double & _getValueRef (int irow, int icol) override
 
- Protected Member Functions inherited from AMatrix
 AMatrix (int nrow=0, int ncol=0)
 
 AMatrix (const AMatrix &m)
 
AMatrixoperator= (const AMatrix &m)
 
virtual bool _isPhysicallyPresent (int, int) const
 
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 ()
 
void _fillFromVVD (const VectorVectorDouble &X)
 
bool _getFlagCheckAddress () const
 
- Protected Member Functions inherited from ASerializable
bool _fileOpenWrite (const String &filename, std::ofstream &os, bool verbose=false) const
 
bool _fileOpenRead (const String &filename, std::ifstream &is, bool verbose=false) const
 

Private Attributes

String _title
 
VectorString _rowNames
 
VectorString _colNames
 
bool _skipTitle
 
bool _skipDescription
 

Additional Inherited Members

- Static Protected Member Functions inherited from ASerializable
static bool _commentWrite (std::ostream &os, const String &comment)
 
template<typename T >
static bool _recordWrite (std::ostream &os, const String &title, const T &val)
 
template<typename T >
static bool _recordWriteVec (std::ostream &os, const String &title, const VectorT< T > &vec)
 
template<typename T >
static bool _recordRead (std::istream &is, const String &title, T &val)
 
template<typename T >
static bool _recordReadVec (std::istream &is, const String &title, VectorT< T > &vec, int nvalues)
 
static bool _onlyBlanks (char *string)
 
static bool _tableRead (std::istream &is, const String &string, int ntab, double *tab)
 
static bool _tableWrite (std::ostream &os, const String &string, int ntab, const VectorDouble &tab)
 

Detailed Description

Stores an array of values as a Table, i.e. a MatrixRectangular where rows and columns can be optionally decorated

Constructor & Destructor Documentation

◆ Table() [1/2]

Table::Table ( int  nrow = 0,
int  ncol = 0,
bool  skip_title = false,
bool  skip_description = false 
)

◆ Table() [2/2]

Table::Table ( const Table m)

◆ ~Table()

Table::~Table ( )
virtual

Member Function Documentation

◆ _clearContents()

void Table::_clearContents ( )
overrideprotectedvirtual

Reimplemented from AMatrix.

◆ _deserialize()

bool Table::_deserialize ( std::istream &  is,
bool  verbose = false 
)
overrideprotectedvirtual

Interface for ASerializable.

Implements ASerializable.

◆ _getNFName()

String Table::_getNFName ( ) const
inlineoverrideprotectedvirtual

Implements ASerializable.

◆ _serialize()

bool Table::_serialize ( std::ostream &  os,
bool  verbose = false 
) const
overrideprotectedvirtual

Implements ASerializable.

◆ create()

Table * Table::create ( int  nrow = 0,
int  ncol = 0 
)
static

◆ createFromNames()

Table * Table::createFromNames ( const VectorString rownames,
const VectorString colnames 
)
static

◆ createFromNF()

Table * Table::createFromNF ( const String neutralFilename,
bool  verbose = true 
)
static

◆ createFromTable()

Table * Table::createFromTable ( const Table table)
static

◆ getAllRange()

VectorDouble Table::getAllRange ( ) const

◆ getColumnName()

String Table::getColumnName ( int  icol) const

◆ getColumnNames()

VectorString Table::getColumnNames ( ) const
inline

◆ getRange()

VectorDouble Table::getRange ( int  icol) const

◆ getRowName()

String Table::getRowName ( int  irow) const

◆ getRowNames()

VectorString Table::getRowNames ( ) const
inline

◆ getTitle()

const String& Table::getTitle ( ) const
inline

◆ operator=()

Table & Table::operator= ( const Table m)

◆ plot()

void Table::plot ( int  isimu) const

Plot the contents of the statistics

◆ setColumnName()

void Table::setColumnName ( int  icol,
const String name 
)

◆ setColumnNames()

void Table::setColumnNames ( const VectorString colNames)

◆ setRowName()

void Table::setRowName ( int  irow,
const String name 
)

◆ setRowNames()

void Table::setRowNames ( const VectorString rowNames)

◆ setSkipDescription()

void Table::setSkipDescription ( bool  skipDescription)
inline

◆ setSkipTitle()

void Table::setSkipTitle ( bool  skipTitle)
inline

◆ setTitle()

void Table::setTitle ( const String title)
inline

◆ toString()

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

Cloneable interface.

Print the contents of the statistics

Reimplemented from AMatrix.

Member Data Documentation

◆ _colNames

VectorString Table::_colNames
private

◆ _rowNames

VectorString Table::_rowNames
private

◆ _skipDescription

bool Table::_skipDescription
private

◆ _skipTitle

bool Table::_skipTitle
private

◆ _title

String Table::_title
private

◆ DECLARE_TOTL

Table::DECLARE_TOTL

Has a specific implementation in the Target language.


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