#include <Matrix.hpp>
Public Member Functions | |
Matrix () | |
Default constructor. | |
Matrix (const Table &data) | |
Constructor with initial data. More... | |
Matrix (Dimen dimen, double val=0) | |
Constructor with a specific initial value. More... | |
Matrix (const Vector &data, Dimen dimen, bool byrow=true) | |
Constructor with initial data. More... | |
void | setData (const Table &data) |
Set matrix data. More... | |
void | setData (Dimen dimen, double val=0) |
Set Matrix data with a specific value. More... | |
void | setData (const Vector &data, Dimen dimen, bool byrow=true) |
Set matrix data. More... | |
Table | getData () const |
Get matrix data. More... | |
Dimen | dimen () const |
Get matrix dimension. More... | |
bool | dimen (Dimen dimen) |
Set matrix dimension. More... | |
int | nrow () const |
The number of rows. More... | |
int | ncol () const |
The number of columns. More... | |
Matrix | round (int ndec=4) const |
Round every element to specific decimal digits. More... | |
bool | square () const |
Test if the matrix is a square matrix. More... | |
bool | symmetric () const |
Test if the matrix is symmetric. More... | |
Vector | getRow (int m) const |
Get a row data. More... | |
Vector | getCol (int n) const |
Get a column data. More... | |
void | setRow (int m, const Vector &row) |
Set a row data. More... | |
void | setCol (int n, const Vector &col) |
Set a column data. More... | |
void | exchange (int i, int j, bool row=true) |
Exchange two rows or two columns. More... | |
Matrix | transpose () const |
Transpose matrix. More... | |
int | rank (const Epsilon &eps=Epsilon()) const |
Rank of matrix. More... | |
Matrix | submat (int frow, int lrow, int fcol, int lcol) |
Submatrix. More... | |
Matrix | resid (int i, int j) const |
Residual matrix. More... | |
double & | operator() (int m, int n) |
Access a specific element of the matrix. More... | |
double | operator() (int m, int n) const |
Access a specific element of the matrix (read only). More... | |
Matrix | operator+ (const Matrix &mat) const |
Matrix addition. More... | |
Matrix | operator- (const Matrix &mat) const |
Matrix subtraction. More... | |
Matrix | operator* (const Matrix &mat) const |
Matrix multiplication. More... | |
bool | operator== (const Matrix &mat) const |
Matrix equality. More... | |
bool | operator!= (const Matrix &mat) const |
Matrix inequality. More... | |
mathkit::Matrix::Matrix | ( | const Table & | data) |
Constructor with initial data.
data | The initial data. |
Definition at line 13 of file Matrix.cpp.
mathkit::Matrix::Matrix | ( | Dimen | dimen, |
double | val = 0 |
||
) |
Constructor with a specific initial value.
dimen | The dimension of the matrix. |
val | The specific initial value. |
Definition at line 18 of file Matrix.cpp.
Constructor with initial data.
data | A vector contains the initial data. |
dimen | The dimension of the matrix. |
byrow | The initial data is in row major or column major form. |
Definition at line 23 of file Matrix.cpp.
void mathkit::Matrix::setData | ( | const Table & | data) |
void mathkit::Matrix::setData | ( | Dimen | dimen, |
double | val = 0 |
||
) |
Set Matrix data with a specific value.
dimen | The dimension of the matrix. |
val | The specific value. |
Definition at line 32 of file Matrix.cpp.
Set matrix data.
data | A vector contains the new data. |
dimen | The dimension of the matrix. |
byrow | The new data is in row major or column major form. |
Definition at line 37 of file Matrix.cpp.
Table mathkit::Matrix::getData | ( | ) | const |
Dimen mathkit::Matrix::dimen | ( | ) | const |
bool mathkit::Matrix::dimen | ( | Dimen | dimen) |
Set matrix dimension.
The dimension could be set only when the matrix data is empty. Else this operation would fail.
This method should only be used when the matrix is contructed by default contructor and need to load data using stream extraction operator (>>).
dimen | The dimension. |
Definition at line 62 of file Matrix.cpp.
int mathkit::Matrix::nrow | ( | ) | const |
int mathkit::Matrix::ncol | ( | ) | const |
Matrix mathkit::Matrix::round | ( | int | ndec = 4 ) | const |
Round every element to specific decimal digits.
ndec | The number of decimal digits. |
Definition at line 76 of file Matrix.cpp.
bool mathkit::Matrix::square | ( | ) | const |
Test if the matrix is a square matrix.
Definition at line 85 of file Matrix.cpp.
bool mathkit::Matrix::symmetric | ( | ) | const |
Test if the matrix is symmetric.
Definition at line 89 of file Matrix.cpp.
Vector mathkit::Matrix::getRow | ( | int | m) | const |
Get a row data.
m | The row index (start from zero). |
Definition at line 94 of file Matrix.cpp.
Vector mathkit::Matrix::getCol | ( | int | n) | const |
Get a column data.
n | The column index (start from zero). |
Definition at line 100 of file Matrix.cpp.
void mathkit::Matrix::setRow | ( | int | m, |
const Vector & | row | ||
) |
Set a row data.
m | The row index (start from zero). |
row | The new row data. |
Definition at line 104 of file Matrix.cpp.
void mathkit::Matrix::setCol | ( | int | n, |
const Vector & | col | ||
) |
Set a column data.
n | The column index (start from zero). |
col | The new column data. |
Definition at line 108 of file Matrix.cpp.
void mathkit::Matrix::exchange | ( | int | i, |
int | j, | ||
bool | row = true |
||
) |
Exchange two rows or two columns.
i | The index of first row/column to exchange. |
j | The index of second row/column to exchange. |
row | Which stuff to exchange (row or column). |
Definition at line 112 of file Matrix.cpp.
Matrix mathkit::Matrix::transpose | ( | ) | const |
Rank of matrix.
eps | An Epsilon functor to test zero elements. |
Definition at line 132 of file Matrix.cpp.
Matrix mathkit::Matrix::submat | ( | int | frow, |
int | lrow, | ||
int | fcol, | ||
int | lcol | ||
) |
Submatrix.
frow | The first row index. |
lrow | The last row index. |
fcol | The first column index. |
lcol | The last column index. |
Definition at line 162 of file Matrix.cpp.
Matrix mathkit::Matrix::resid | ( | int | i, |
int | j | ||
) | const |
Residual matrix.
i | The row index (zero based). |
j | The column index (zero based). |
Definition at line 171 of file Matrix.cpp.
double & mathkit::Matrix::operator() | ( | int | m, |
int | n | ||
) |
Access a specific element of the matrix.
m | The row index (start from zero). |
n | The column index (start from zero). |
Definition at line 185 of file Matrix.cpp.
double mathkit::Matrix::operator() | ( | int | m, |
int | n | ||
) | const |
Access a specific element of the matrix (read only).
m | The row index (start from zero). |
n | The column index (start from zero). |
Definition at line 189 of file Matrix.cpp.
Matrix addition.
mat | The right matrix operand. |
Definition at line 193 of file Matrix.cpp.
Matrix subtraction.
mat | The right matrix operand. |
Definition at line 200 of file Matrix.cpp.
Matrix multiplication.
mat | The right matrix operand. |
Definition at line 207 of file Matrix.cpp.
bool mathkit::Matrix::operator== | ( | const Matrix & | mat) | const |
Matrix equality.
mat | The right matrix operand. |
Definition at line 216 of file Matrix.cpp.
bool mathkit::Matrix::operator!= | ( | const Matrix & | mat) | const |
Matrix inequality.
mat | The right matrix operand. |
Definition at line 220 of file Matrix.cpp.