#include <symmetric_matrix.h>
Public Types | |
typedef LowerTriangularMatrix < C >::size_type | size_type |
Public Member Functions | |
SymmetricMatrix (const size_type n=0) | |
SymmetricMatrix (const SymmetricMatrix< C > &M) | |
SymmetricMatrix (const size_type n, const char *str, const bool byrow=true) | |
void | resize (const size_type n) |
const C | operator() (const size_type row, const size_type column) const |
const C | get_entry (const size_type row, const size_type column) const |
C & | operator() (const size_type row, const size_type column) |
void | set_entry (const size_type row, const size_type column, const C value) |
template<class C2 > | |
bool | operator== (const SymmetricMatrix< C2 > &M) const |
template<class C2 > | |
bool | operator!= (const SymmetricMatrix< C2 > &M) const |
SymmetricMatrix< C > & | operator= (const SymmetricMatrix< C > &M) |
template<class VECTOR > | |
void | apply (const VECTOR &x, VECTOR &Mx) const |
template<class VECTOR > | |
void | apply_transposed (const VECTOR &x, VECTOR &Mtx) const |
void | print (std::ostream &os, const unsigned int tabwidth=5, const unsigned int precision=2) const |
This class models finite, densely populated, symmetric matrices M = (m_{i,j})_{0<=i<m, 0<=j<n} with entries from an arbitrary (scalar) class C, designed for numerical computations.
Internally, we only store the lower triangular part.
typedef LowerTriangularMatrix<C>::size_type MathTL::SymmetricMatrix< C >::size_type |
type of indexes and size type (cf. STL containers)
Reimplemented from MathTL::LowerTriangularMatrix< C >.
MathTL::SymmetricMatrix< C >::SymmetricMatrix | ( | const size_type | n = 0 | ) | [inline, explicit] |
default constructor, yields zero square matrix which is empty per default
MathTL::SymmetricMatrix< C >::SymmetricMatrix | ( | const SymmetricMatrix< C > & | M | ) | [inline] |
copy constructor
MathTL::SymmetricMatrix< C >::SymmetricMatrix | ( | const size_type | n, |
const char * | str, | ||
const bool | byrow = true |
||
) |
Construct n*n matrix from a string holding its entries, separated by a blank. Please note that we internally only store the lower triangular part of the matrix, so the string only has to contain those entries.
n | row and column dimension |
str | input string |
byrow | indicates whether coefficients are stored row by row in the stream |
void MathTL::SymmetricMatrix< C >::apply | ( | const VECTOR & | x, |
VECTOR & | Mx | ||
) | const |
matrix-vector multiplication Mx = (*this) * x; we assume that the vector Mx has the correct size and is not identical to x
Reimplemented from MathTL::LowerTriangularMatrix< C >.
void MathTL::SymmetricMatrix< C >::apply_transposed | ( | const VECTOR & | x, |
VECTOR & | Mtx | ||
) | const |
transposed matrix-vector multiplication Mtx = (*this)^T * x; we assume that the vector Mtx has the correct size and is not identical to x (this is identical to apply(), since we have a symmetric matrix)
Reimplemented from MathTL::LowerTriangularMatrix< C >.
const C MathTL::SymmetricMatrix< C >::get_entry | ( | const size_type | row, |
const size_type | column | ||
) | const [inline] |
read-only access to a matrix entry
Reimplemented from MathTL::LowerTriangularMatrix< C >.
bool MathTL::SymmetricMatrix< C >::operator!= | ( | const SymmetricMatrix< C2 > & | M | ) | const [inline] |
non-equality test
const C MathTL::SymmetricMatrix< C >::operator() | ( | const size_type | row, |
const size_type | column | ||
) | const [inline] |
read-only access to a matrix entry
Reimplemented from MathTL::LowerTriangularMatrix< C >.
C & MathTL::SymmetricMatrix< C >::operator() | ( | const size_type | row, |
const size_type | column | ||
) | [inline] |
read-write access to a matrix entry (you should not use this, since it destroys the matrix structure!)
Reimplemented from MathTL::LowerTriangularMatrix< C >.
SymmetricMatrix< C > & MathTL::SymmetricMatrix< C >::operator= | ( | const SymmetricMatrix< C > & | M | ) |
assignment from another symmetric matrix
bool MathTL::SymmetricMatrix< C >::operator== | ( | const SymmetricMatrix< C2 > & | M | ) | const [inline] |
equality test with another matrix
void MathTL::SymmetricMatrix< C >::print | ( | std::ostream & | os, |
const unsigned int | tabwidth = 5 , |
||
const unsigned int | precision = 2 |
||
) | const |
stream output with user-defined tabwidth and precision (cf. deal.II)
Reimplemented from MathTL::LowerTriangularMatrix< C >.
void MathTL::SymmetricMatrix< C >::resize | ( | const size_type | n | ) | [inline] |
resize matrix and initialize with zero
void MathTL::SymmetricMatrix< C >::set_entry | ( | const size_type | row, |
const size_type | column, | ||
const C | value | ||
) | [inline] |
write access to a matrix entry (you should not use this, since it destroys the matrix structure!)
Reimplemented from MathTL::LowerTriangularMatrix< C >.