|
Core 1.0
|
A simple, non-optimized implementation of rectangular matrixes. More...
#include <matrix-mn.h>
Public Member Functions | |
| MatrixMN (int, int, double=0.0) | |
| Create a rectangular matrix. | |
| MatrixMN (int, double=0.0) | |
| Create a square matrix. | |
| MatrixMN (int, int, const std::vector< double > &) | |
| Create a square matrix. | |
| MatrixMN (const std::vector< std::vector< double > > &) | |
| Creates a rectangular matrix from a 2D std::vector. | |
| double & | operator() (int, int) |
| Return the matrix term value for given indexess. | |
| double | operator() (int, int) const |
| Return the matrix term value for given indexess. | |
| void | SwapRows (int, int) |
| Swap rows. | |
| MatrixMN | Transpose () const |
| Transpose. | |
| MatrixMN | Inverse () const |
| Compute the Gauss Jordan inverse. | |
| MatrixMN & | operator+= (const MatrixMN &) |
| Self sum. | |
| MatrixMN & | operator-= (const MatrixMN &) |
| Self difference. | |
| MatrixMN & | operator*= (const MatrixMN &) |
| Self product. | |
| MatrixMN & | operator*= (const double &) |
| Self multiply by a scalar. | |
| MatrixMN & | operator/= (const double &) |
| Self division by a scalar. | |
Static Public Member Functions | |
| static MatrixMN | Identity (int) |
| Create the identity matrix. | |
| static MatrixMN | Covariance (const std::vector< std::vector< double > > &vectors) |
| Create the covariance matrix of a given set of vectors. | |
Protected Member Functions | |
| int | Index (int, int) const |
| Compute the entry of a term. | |
| bool | SameSize (const MatrixMN &) const |
| Test if the matrix has the same size as the argument matrix. | |
Protected Attributes | |
| int | m = 0 |
| Rows. | |
| int | n = 0 |
| Columns. | |
| std::vector< double > | v |
| Array of data. | |
Friends | |
| MatrixMN | operator+ (const MatrixMN &a, const MatrixMN &b) |
| Sum. | |
| MatrixMN | operator- (const MatrixMN &a, const MatrixMN &b) |
| Difference. | |
| MatrixMN | operator* (const MatrixMN &a, const MatrixMN &b) |
| Product. | |
| MatrixMN | operator* (const MatrixMN &a, double b) |
| Right multiply by a scalar. | |
| MatrixMN | operator* (double b, MatrixMN &a) |
| Left multiply by a scalar. | |
| std::ostream & | operator<< (std::ostream &s, const MatrixMN &mat) |
| Overloaded. | |
A simple, non-optimized implementation of rectangular matrixes.
| MatrixMN::MatrixMN | ( | int | m, |
| int | n, | ||
| double | d = 0.0 ) |
| MatrixMN::MatrixMN | ( | int | n, |
| double | d = 0.0 ) |
Create a square matrix.
| n | Size. |
| d | Default scalar value. |
| MatrixMN::MatrixMN | ( | int | m, |
| int | n, | ||
| const std::vector< double > & | data ) |
| MatrixMN::MatrixMN | ( | const std::vector< std::vector< double > > & | data | ) |
Creates a rectangular matrix from a 2D std::vector.
| data | 2D std::vector, each row must have same number of elements. |
|
static |
Create the covariance matrix of a given set of vectors.
| vectors | Set of vectors, they must have the same size. |
|
inlineprotected |
Compute the entry of a term.
| i,j | Indexes. |
| MatrixMN MatrixMN::Inverse | ( | ) | const |
Compute the Gauss Jordan inverse.
The function only works the matrix is squared
|
inline |
Return the matrix term value for given indexess.
| i,j | Integer coordinates of the vertex. |
|
inline |
Return the matrix term value for given indexess.
| i,j | Integer coordinates of the vertex. |
| MatrixMN & MatrixMN::operator*= | ( | const double & | d | ) |
Self multiply by a scalar.
| d | Real. |
| MatrixMN & MatrixMN::operator/= | ( | const double & | d | ) |
Self division by a scalar.
| d | Real. |
|
inlineprotected |
Test if the matrix has the same size as the argument matrix.
| A | Matrix |
| void MatrixMN::SwapRows | ( | int | i, |
| int | j ) |
Swap rows.
| i,j | Indexes. |
Product.
| a,b | Matrixes. |
Right multiply by a scalar.
| a | Matrix. |
| b | Real. |
Left multiply by a scalar.
| a | Matrix. |
| b | Real. |
Difference.
| a,b | Matrixes. |
|
friend |
Overloaded.
| s | Stream. |
| mat | Matrix. |