Mathlib
1.0.0.0
A hobbyist C++ library for numerical algorithms
|
MatrixX
is a templated class that implements dynamic matrices.
More...
#include <MatrixX.h>
Public Member Functions | |
MatrixX () | |
Default constructor. No memory allocations are performed here. More... | |
MatrixX (int n) | |
Construct a column vector \(v \in \mathbf{R}^{n}\). More... | |
MatrixX (int m, int n) | |
Construct a matrix \(A \in \mathbf{R}^{m \times n}\). More... | |
MatrixX (const MatrixX &m) | |
Copy constructor. Creates a deep copy of the MatrixX object passed. More... | |
MatrixX (std::initializer_list< std::initializer_list< scalarType >>) | |
Allocates and initializes a matrix using the curly brace initializer list. More... | |
std::vector< scalarType > | getRawData () const |
int | rows () const |
Getter method for the number of rows of a matrix. More... | |
int | cols () const |
Getter method for the number of columns of a matrix. More... | |
int | size () const |
Getter method for the size (the total number of elements) of the matrix. More... | |
scalarType | operator() (const int i, const int j) const |
Coefficient accessor. This routine overloads the parentheses operator () . A(i,j) is used the retrieve the element \(a_{ij}\) belonging to the matrix \(A\). This is const-version of the method, that works on const MatrixX objects. More... | |
scalarType & | operator() (const int i, const int j) |
Coefficient accessor. This routine retrieves the element in the (i,j) place of the matrix. This works on non-const MatrixX objects. More... | |
MatrixX | operator+ (const MatrixX &m) const |
Matrix addition. This routine overloads the binary addition operator + and is used to add two matrices. More... | |
MatrixX | operator- (const MatrixX &m) const |
Matrix subtraction. This routine overloads the binary subtraction operator - and is used to subtract two matrices. More... | |
MatrixX & | operator<< (const scalarType x) |
Overload the << operator to initialize a matrix. More... | |
MatrixX & | operator, (const scalarType x) |
Overload the , operator to initialize a matrix. More... | |
MatrixX & | operator= (const MatrixX &right_hand_side) |
Copy assignment operator. More... | |
MatrixX & | operator= (const MatrixRowSlice< scalarType > &rhs) |
MatrixX & | operator= (const MatrixColSlice< scalarType > &rhs) |
bool | operator== (const MatrixX &right_hand_side) |
Boolean comparision operator. Compares if \(A = B\). More... | |
MatrixX & | operator+= (const MatrixX &m) |
Addition assignment operator More... | |
MatrixX & | operator-= (const MatrixX &m) |
Subtraction assignment operator More... | |
MatrixRowSlice< scalarType > | MatrixX (int i) |
MatrixColSlice< scalarType > | MatrixX (int j) |
MatrixX< scalarType > | transpose () const |
Transpose the matrix. More... | |
Private Attributes | |
std::vector< scalarType > | A |
int | _rows |
int | _cols |
int | _size |
std::vector< scalarType >::iterator | currentPosition |
MatrixX
is a templated class that implements dynamic matrices.
scalarType |
Default constructor. No memory allocations are performed here.
scalarType |
Construct a column vector \(v \in \mathbf{R}^{n}\).
scalarType |
m | |
n |
MatrixX< scalarType >::MatrixX | ( | std::initializer_list< std::initializer_list< scalarType >> | list | ) |
Allocates and initializes a matrix using the curly brace initializer list.
scalarType |
list |
MatrixRowSlice<scalarType> MatrixX< scalarType >::MatrixX | ( | int | i | ) |
MatrixColSlice<scalarType> MatrixX< scalarType >::MatrixX | ( | int | j | ) |
int MatrixX< scalarType >::cols |
Getter method for the number of columns of a matrix.
scalarType |
std::vector< scalarType > MatrixX< scalarType >::getRawData |
scalarType & MatrixX< scalarType >::operator() | ( | const int | i, |
const int | j | ||
) |
Coefficient accessor. This routine retrieves the element in the (i,j) place of the matrix. This works on non-const MatrixX objects.
scalarType |
i | |
j |
scalarType MatrixX< scalarType >::operator() | ( | const int | i, |
const int | j | ||
) | const |
Coefficient accessor. This routine overloads the parentheses operator ()
. A(i,j)
is used the retrieve the element \(a_{ij}\) belonging to the matrix \(A\). This is const-version of the method, that works on const MatrixX objects.
MatrixX< typename scalarType > MatrixX< scalarType >::operator+ | ( | const MatrixX< scalarType > & | m | ) | const |
Matrix addition. This routine overloads the binary addition operator +
and is used to add two matrices.
scalarType |
m |
MatrixX< typename scalarType > & MatrixX< scalarType >::operator, | ( | const scalarType | x | ) |
Overload the ,
operator to initialize a matrix.
scalarType |
x |
MatrixX< typename scalarType > MatrixX< scalarType >::operator- | ( | const MatrixX< scalarType > & | m | ) | const |
Matrix subtraction. This routine overloads the binary subtraction operator -
and is used to subtract two matrices.
scalarType |
m |
MatrixX< typename scalarType > & MatrixX< scalarType >::operator<< | ( | const scalarType | x | ) |
Overload the <<
operator to initialize a matrix.
scalarType |
x |
MatrixX< scalarType > & MatrixX< scalarType >::operator= | ( | const MatrixColSlice< scalarType > & | rhs | ) |
MatrixX< scalarType > & MatrixX< scalarType >::operator= | ( | const MatrixRowSlice< scalarType > & | rhs | ) |
MatrixX< typename scalarType > & MatrixX< scalarType >::operator= | ( | const MatrixX< scalarType > & | rhs | ) |
Copy assignment operator.
scalarType |
right_hand_side |
int MatrixX< scalarType >::rows |
Getter method for the number of rows of a matrix.
scalarType |
int MatrixX< scalarType >::size |
Getter method for the size (the total number of elements) of the matrix.
scalarType |
Transpose the matrix.
scalarType |
|
private |
|
private |
|
private |
|
private |
|
private |