|
SpatiumLib
|
Mathematical matrix with an arbitrary number number of rows and columns. More...
#include <Matrix.h>


Public Member Functions | |
| Matrix (size_t rows, size_t cols) | |
| Constructor. More... | |
| Matrix (std::initializer_list< std::initializer_list< double >> array) | |
| Constructor. More... | |
| bool | operator== (const Matrix &other) const |
| Compare operator. Is equal. More... | |
| bool | operator!= (const Matrix &other) const |
| Compare operator. Is unequal. More... | |
| size_t | rows () const |
| Get the number of rows. More... | |
| size_t | cols () const |
| Get the number of columns. More... | |
| std::vector< double > | data () const |
| Get all matrix elements. More... | |
| void | clear () |
| Clear all matrix elements. More... | |
| Matrix | transposed () const |
| Get transposed matrix. More... | |
| double | determinant () const |
| Calculate determinant. More... | |
| double | minor (size_t row, size_t col) const |
| Calulcate minor. More... | |
| Matrix | omit (size_t row, size_t col) const |
| Omit a given row and column. More... | |
| Matrix | inverse () const |
| Calculate inverse of matrix. More... | |
| double | operator() (size_t row, size_t col) const |
| Access element by value. More... | |
| double & | operator() (size_t row, size_t col) |
| Access element by reference. More... | |
| Matrix | operator+ (const Matrix &other) const |
| Add by matrix. More... | |
| Matrix | operator- (const Matrix &other) const |
| Subtract by matrix. More... | |
| Matrix | operator * (const Matrix &other) const |
| Multiply by matrix. More... | |
| Matrix | operator * (double scalar) const |
| Multiply by scalar. More... | |
| Matrix | operator/ (double scalar) const |
| Divide by scalar. More... | |
| void | resize (size_t rows, size_t cols) |
| Resize. More... | |
Static Public Member Functions | |
| static Matrix | identity (size_t order) |
| Construct identity matrix. More... | |
Protected Member Functions | |
| double | determinant (const Matrix &matrix) const |
| Calculate determinant. More... | |
Protected Attributes | |
| size_t | m_rows |
| size_t | m_cols |
| std::vector< double > | m_data |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Matrix &matrix) |
| Output to ostream. More... | |
Mathematical matrix with an arbitrary number number of rows and columns.
Matrix is a class to represent a mathematical matrix, i.e. a 2D array defined by a number of rows and columns. The content of the matrix is stored in column-major format.
|
inline |
Constructor.
| [in] | rows | Number of rows |
| [in] | cols | Number of columns |
|
inline |
Constructor.
| [in] | array | 2D Initializer list |
|
inline |
Clear all matrix elements.
|
inline |
Get the number of columns.
|
inline |
Get all matrix elements.
|
inline |
Calculate determinant.
The determinant is calculated through expansion by minors.
| std::out_of_range | Matrix is not square |
|
inlineprotected |
Calculate determinant.
Recursive function.
|
inlinestatic |
Construct identity matrix.
|
inline |
|
inline |
Calulcate minor.
The minor is the determinant of the matrix formed by omitting a given row and column.
| [in] | row | Row to omit |
| [out] | col | Column to omit |
|
inline |
Omit a given row and column.
| [in] | row | Row to omit |
| [out] | col | Column to omit |
|
inline |
Multiply by scalar.
| [in] | scalar | Scalar |
|
inline |
Compare operator. Is unequal.
| [in] | other | Other matrix |
|
inline |
Access element by value.
| [in] | row | Row of element |
| [in] | col | Column of element |
| std::out_of_range | Matrix element out of range |
|
inline |
Access element by reference.
| [in] | row | Row of element |
| [in] | col | Column of element |
| std::out_of_range | Matrix element out of range |
|
inline |
Divide by scalar.
| [in] | scalar | Scalar |
|
inline |
Compare operator. Is equal.
Equal matrices have equal dimensions and values.
| [in] | other | Other matrix |
|
inline |
Resize.
This will set all values to 0.
| [in] | rows | Number of rows |
| [in] | cols | Number of columns |
|
inline |
Get the number of rows.
|
inline |
Get transposed matrix.
|
friend |
Output to ostream.
|
protected |
|
protected |
|
protected |
1.8.15