Generic Matrix. More...
#include <rgenericmatrix.h>
Public Types | |
enum | tType { tNormal, tDiagonal, tLowerTriangular, tUpperTriangular, tSymmetric, tSparse, tSparseSymmetric, tMax } |
Public Member Functions | |
virtual void | Add (size_t i, size_t j, double val) |
virtual void | Clear (double val=NAN, bool clean=false) |
int | Compare (const RGenericMatrix &matrix) const |
size_t | GetNbCols (void) const |
size_t | GetNbLines (void) const |
virtual tType | GetType (void) const =0 |
virtual void | Init (double val) |
virtual double | operator() (size_t i, size_t j) const =0 |
virtual double & | operator() (size_t i, size_t j)=0 |
RGenericMatrix & | operator= (const RGenericMatrix &matrix) |
template<class S > | |
void | Print (S &stream, const RString &name, const char *format="%E", size_t colsize=12) const |
RGenericMatrix (size_t size) | |
RGenericMatrix (size_t lines, size_t cols) | |
RGenericMatrix (const RGenericMatrix &matrix) | |
virtual void | VerifySize (size_t newlines, size_t newcols, bool fill=false, double val=NAN)=0 |
virtual | ~RGenericMatrix (void) |
Protected Attributes | |
size_t | NbCols |
size_t | NbLines |
Detailed Description
Generic Matrix.
The RGenericMatrix class provides a representation for a generic matrix. It provides several operator acting on generic matrices. The operators are based on the operator(i,j) and are not optimized. If possible, these operators should be specialized in inheriting classes for performance purposes.
Member Enumeration Documentation
enum tType |
Constructor & Destructor Documentation
RGenericMatrix | ( | size_t | size | ) |
Construct a square matrix of a given size.
- Parameters
-
size Size of the matrix.
RGenericMatrix | ( | size_t | lines, |
size_t | cols | ||
) |
Construct a matrix (L,C).
- Parameters
-
lines Number of lines. cols Number of columns.
RGenericMatrix | ( | const RGenericMatrix & | matrix | ) |
Construct a matrix from another one.
- Parameters
-
matrix Matrix.
|
virtual |
Destruct the matrix.
Member Function Documentation
int Compare | ( | const RGenericMatrix & | matrix | ) | const |
|
virtual |
Clear the matrix. By default, it initialize the elements with Init.
- Parameters
-
val Value eventually used to assign to the elements. clean Clean eventually the memory.
Reimplemented in RMaxMatrix, and RSparseMatrix.
|
virtual |
Initialize the matrix with a given value. It uses the operator(i,j) to initialize the different elements.
- Parameters
-
val Value to assign.
Reimplemented in RMatrix, RMaxMatrix, and RSparseMatrix.
|
pure virtual |
Verify if the matrix has a given size, and increase them if necessary.
- Parameters
-
newlines New line number. newcols New column number. fill Elements must be filled with a value. val Value used eventually to fill the elements created.
Implemented in RMatrix, RMaxMatrix, RSparseMatrix, and RLowerTriangularMatrix.
|
pure virtual |
Get the type of the matrix.
Implemented in RMatrix, RMaxMatrix, RSparseMatrix, RLowerTriangularMatrix, RSymmetricMatrix, and RSparseSymmetricMatrix.
size_t GetNbLines | ( | void | ) | const |
Get the number of lines in the matrix.
size_t GetNbCols | ( | void | ) | const |
Get the number of columns in the matrix.
|
pure virtual |
Return a specific element of the matrix (const version).
- Parameters
-
i Line number of the element. j Column number of the element.
Implemented in RMatrix, RMaxMatrix, RSparseMatrix, RLowerTriangularMatrix, RSparseSymmetricMatrix, and RSymmetricMatrix.
|
pure virtual |
Return a specific element of the matrix (const version).
- Parameters
-
i Line number of the element. j Column number of the element.
Implemented in RMatrix, RMaxMatrix, RSparseMatrix, RLowerTriangularMatrix, RSparseSymmetricMatrix, and RSymmetricMatrix.
|
virtual |
Add a value associated to a given index into the matrix. By default, it calles the operator(size_t,size_t) method
- Parameters
-
i Line number of the element. j Column number of the element. val Value to add.
Reimplemented in RMaxMatrix.
RGenericMatrix& operator= | ( | const RGenericMatrix & | matrix | ) |
Assign operator.
- Parameters
-
matrix Matrix.
void Print | ( | S & | stream, |
const RString & | name, | ||
const char * | format = "%E" , |
||
size_t | colsize = 12 |
||
) | const |
Print the content of the matrix.
- Template Parameters
-
S Stream class that implements the << operator.
- Parameters
-
stream Stream. name Name of the matrix. format Format used to print the number. By default, it is "%E". colsize Size of a column. By default, it is 12.
Member Data Documentation
|
protected |
Number of lines.
|
protected |
Number of columns.