namespace ewalena
0.2.15
ewalena is not an acronym
|
#include <include/ewalena/lac/matrix.h>
Public Member Functions | |
void | identity () |
void | invert (const Matrix< ValueType > &M) |
bool | is_symmetric () const |
Matrix () | |
Matrix (const unsigned int m, const unsigned int n, const bool zero=true) | |
Matrix (std::pair< const unsigned int, const unsigned int > mn_pair, const bool zero=true) | |
template<int dim> | |
Matrix (const class Tensor< dim, 2, ValueType > &T) | |
Matrix (const class VectorBasis< ValueType > &V) | |
Matrix (const Matrix &M) | |
template<int dim> | |
Matrix (const Tensor< dim, 2, ValueType > &T) | |
template<typename ValueType > | |
Matrix (const VectorBasis< ValueType > &V) | |
void | mult (const Matrix< ValueType > &M_a, const Matrix< ValueType > &M_b) |
void | multT (const Matrix< ValueType > &M_a, const Matrix< ValueType > &M_b) |
unsigned int | n_cols () const |
unsigned int | n_rows () const |
ValueType | norm () |
ValueType & | operator() (const unsigned int i, const unsigned int j) |
const ValueType & | operator() (const unsigned int i, const unsigned int j) const |
void | operator*= (const ValueType &scalar) |
void | operator+= (const Matrix< ValueType > &M) |
void | operator-= (const Matrix< ValueType > &M) |
void | operator/= (const ValueType &scalar) |
void | operator= (const Matrix< ValueType > &M) |
bool | operator== (const Matrix< ValueType > &M) const |
void | reinit (const unsigned int m, const unsigned int n, const bool zero=true) |
void | reinit () |
unsigned int | size () const |
void | Tmult (const Matrix< ValueType > &M_a, const Matrix< ValueType > &M_b) |
~Matrix () | |
Protected Member Functions | |
const ValueType * | operator* () const |
ValueType * | operator* () |
Private Attributes | |
unsigned int | __n_cols |
unsigned int | __n_rows |
ValueType * | data |
Friends | |
std::ostream & | operator<< (std::ostream &output, const Matrix< ValueType > &M) |
A class that denotes a simple matrix with no special qualities, ie. no special symmetries, data access, etc.
Matrices are in row-column format.
ewalena::Matrix< ValueType >::Matrix | ( | ) |
Constructor.
ewalena::Matrix< ValueType >::~Matrix | ( | ) |
Destructor.
ewalena::Matrix< ValueType >::Matrix | ( | const unsigned int | m, |
const unsigned int | n, | ||
const bool | zero = true |
||
) | [explicit] |
Initialize a matrix of size m
n
. By default, matrix elements are set to zero otherwise if zero=false
, matrix elements are left in an unspecified state.
ewalena::Matrix< ValueType >::Matrix | ( | std::pair< const unsigned int, const unsigned int > | mn_pair, |
const bool | zero = true |
||
) |
Initialize a matrix of size equal to the first, and second, integers of a pair.
ewalena::Matrix< ValueType >::Matrix | ( | const class Tensor< dim, 2, ValueType > & | T | ) |
Initialize a matrix with a tensor T
with a memory copy.
ewalena::Matrix< ValueType >::Matrix | ( | const class VectorBasis< ValueType > & | V | ) |
Initialize a matrix with a vector basis V
with a memory copy.
ewalena::Matrix< ValueType >::Matrix | ( | const Matrix< ValueType > & | M | ) |
Initialize a matrix with another matrix M
with a memory copy.
ewalena::Matrix< ValueType >::Matrix | ( | const Tensor< dim, 2, ValueType > & | T | ) |
ewalena::Matrix< ValueType >::Matrix | ( | const VectorBasis< ValueType > & | V | ) |
void ewalena::Matrix< ValueType >::identity | ( | ) | [inline] |
Make this matrix the identity matrix (all previous data is overwritten).
void ewalena::Matrix< ValueType >::invert | ( | const Matrix< ValueType > & | M | ) | [inline] |
Return the inverse of matrix .
bool ewalena::Matrix< ValueType >::is_symmetric | ( | ) | const [inline] |
Return true
if this matrix is symmetric, otherwise return false.
void ewalena::Matrix< ValueType >::mult | ( | const Matrix< ValueType > & | M_a, |
const Matrix< ValueType > & | M_b | ||
) | [inline] |
Multiply two matrices together: .
void ewalena::Matrix< ValueType >::multT | ( | const Matrix< ValueType > & | M_a, |
const Matrix< ValueType > & | M_b | ||
) | [inline] |
Multiply transpose two matrices together: .
unsigned int ewalena::Matrix< ValueType >::n_cols | ( | ) | const [inline] |
Return the number of columns this matrix has.
unsigned int ewalena::Matrix< ValueType >::n_rows | ( | ) | const [inline] |
Return the number of rows this matrix has.
ValueType ewalena::Matrix< ValueType >::norm | ( | ) | [inline] |
Return the norm of this matrix.
ValueType & ewalena::Matrix< ValueType >::operator() | ( | const unsigned int | i, |
const unsigned int | j | ||
) | [inline] |
Read-write access to the (i
, j
)th component of this matrix.
const ValueType & ewalena::Matrix< ValueType >::operator() | ( | const unsigned int | i, |
const unsigned int | j | ||
) | const [inline] |
Read only access to the i
th, j
th index of this matrix.
const ValueType* ewalena::Matrix< ValueType >::operator* | ( | ) | const [inline, protected] |
Read only access operator to the underlying C array structure associated with this matrix.
ValueType* ewalena::Matrix< ValueType >::operator* | ( | ) | [inline, protected] |
Read-write access operator to the underlying C array structure associated with this matrix.
void ewalena::Matrix< ValueType >::operator*= | ( | const ValueType & | scalar | ) | [inline] |
Inline multiplication operator. Multiply every element in M
by a scalar
.
void ewalena::Matrix< ValueType >::operator+= | ( | const Matrix< ValueType > & | M | ) | [inline] |
Inline addition operator. Add M
to this
matrix.
void ewalena::Matrix< ValueType >::operator-= | ( | const Matrix< ValueType > & | M | ) | [inline] |
Inline subtraction operator. Subtract M
from this
matrix.
void ewalena::Matrix< ValueType >::operator/= | ( | const ValueType & | scalar | ) | [inline] |
Inline division operator. Divide every element in M
by a scalar
.
void ewalena::Matrix< ValueType >::operator= | ( | const Matrix< ValueType > & | M | ) |
Equal operator. This is equivalent to a copy.
bool ewalena::Matrix< ValueType >::operator== | ( | const Matrix< ValueType > & | M | ) | const [inline] |
Equivalence operator. Return true if this
matrix is an identical copy of the matrix M
.
void ewalena::Matrix< ValueType >::reinit | ( | const unsigned int | m, |
const unsigned int | n, | ||
const bool | zero = true |
||
) |
Reinitialise this matrix to size m
, n
.
void ewalena::Matrix< ValueType >::reinit | ( | ) |
Reinitialise the contents of this matrix.
unsigned int ewalena::Matrix< ValueType >::size | ( | ) | const [inline] |
Return the number of columns this matrix has.
void ewalena::Matrix< ValueType >::Tmult | ( | const Matrix< ValueType > & | M_a, |
const Matrix< ValueType > & | M_b | ||
) | [inline] |
Transpose multiply two matrices togerher: .
std::ostream& operator<< | ( | std::ostream & | output, |
const Matrix< ValueType > & | M | ||
) | [friend] |
Output operator to stream.
unsigned int ewalena::Matrix< ValueType >::__n_cols [private] |
Internal reference to this matrix column size, ie. the number of columns this matrix has.
unsigned int ewalena::Matrix< ValueType >::__n_rows [private] |
Internal reference to this matrix row-size, ie. the number of rows this matrix has.
ValueType* ewalena::Matrix< ValueType >::data [private] |
Internal object denoting this matrix data.