#include <triangular_matrix.h>
Public Types | |
typedef Vector< C >::size_type | size_type |
Public Member Functions | |
LowerTriangularMatrix (const size_type n=0) | |
LowerTriangularMatrix (const LowerTriangularMatrix< C > &M) | |
LowerTriangularMatrix (const size_type rows, const size_type columns) | |
LowerTriangularMatrix (const size_type rows, const size_type columns, const char *str, const bool byrow=true) | |
const size_type | row_dimension () const |
const size_type | column_dimension () const |
const size_type | size () const |
void | resize (const size_type rows, const size_type columns) |
const size_type | memory_consumption () const |
bool | empty () const |
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 LowerTriangularMatrix< C2 > &M) const |
template<class C2 > | |
bool | operator!= (const LowerTriangularMatrix< C2 > &M) const |
LowerTriangularMatrix< C > & | operator= (const LowerTriangularMatrix< C > &M) |
void | scale (const C s) |
void | inverse (LowerTriangularMatrix< C > &MInv) const |
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=10, const unsigned int precision=3) const |
Static Protected Member Functions | |
static size_type | triangle_size (const size_type rows, const size_type columns) |
static size_type | triangle_index (const size_type row, const size_type column, const size_type rowdim, const size_type coldim) |
Protected Attributes | |
Vector< C > | entries_ |
size_type | rowdim_ |
size_type | coldim_ |
This class models finite, densely populated, lower triangular matrices M = (m_{i,j})_{0<=i<m, 0<=j<n} with entries from an arbitrary (scalar) class C, designed for numerical computations. The class also works for nonquadratic matrices, where the triangular shape is appropriately clipped or filled up with zeros.
typedef Vector<C>::size_type MathTL::LowerTriangularMatrix< C >::size_type |
type of indexes and size type (cf. STL containers)
Reimplemented in MathTL::UpperTriangularMatrix< C >, MathTL::SymmetricMatrix< C >, and MathTL::SymmetricMatrix< bool >.
MathTL::LowerTriangularMatrix< C >::LowerTriangularMatrix | ( | const size_type | n = 0 | ) | [explicit] |
default constructor, yields zero square matrix which is empty per default
MathTL::LowerTriangularMatrix< C >::LowerTriangularMatrix | ( | const LowerTriangularMatrix< C > & | M | ) | [inline] |
copy constructor
MathTL::LowerTriangularMatrix< C >::LowerTriangularMatrix | ( | const size_type | rows, |
const size_type | columns | ||
) |
construct m*n rectangular matrix
MathTL::LowerTriangularMatrix< C >::LowerTriangularMatrix | ( | const size_type | rows, |
const size_type | columns, | ||
const char * | str, | ||
const bool | byrow = true |
||
) |
Construct matrix from a string holding its entries, separated by a blank.
row_dimension | row dimension |
column_dimension | column dimension |
str | input string |
byrow | indicates whether coefficients are stored row by row in the stream |
void MathTL::LowerTriangularMatrix< 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 in MathTL::UpperTriangularMatrix< C >, MathTL::SymmetricMatrix< C >, and MathTL::SymmetricMatrix< bool >.
void MathTL::LowerTriangularMatrix< 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
Reimplemented in MathTL::UpperTriangularMatrix< C >, MathTL::SymmetricMatrix< C >, and MathTL::SymmetricMatrix< bool >.
const LowerTriangularMatrix< C >::size_type MathTL::LowerTriangularMatrix< C >::column_dimension | ( | ) | const [inline] |
column dimension
Reimplemented in MathTL::UpperTriangularMatrix< C >.
bool MathTL::LowerTriangularMatrix< C >::empty | ( | ) | const [inline] |
return true if matrix is empty (cf. STL containers)
const C MathTL::LowerTriangularMatrix< C >::get_entry | ( | const size_type | row, |
const size_type | column | ||
) | const [inline] |
read-only access to a matrix entry
Reimplemented in MathTL::UpperTriangularMatrix< C >, and MathTL::SymmetricMatrix< C >.
void MathTL::LowerTriangularMatrix< C >::inverse | ( | LowerTriangularMatrix< C > & | MInv | ) | const |
compute the inverse of *this (if possible), M will be properly scaled
const LowerTriangularMatrix< C >::size_type MathTL::LowerTriangularMatrix< C >::memory_consumption | ( | ) | const [inline] |
(estimate for the) memory consumption in bytes
bool MathTL::LowerTriangularMatrix< C >::operator!= | ( | const LowerTriangularMatrix< C2 > & | M | ) | const [inline] |
non-equality test
const C MathTL::LowerTriangularMatrix< C >::operator() | ( | const size_type | row, |
const size_type | column | ||
) | const [inline] |
read-only access to a matrix entry
Reimplemented in MathTL::UpperTriangularMatrix< C >, and MathTL::SymmetricMatrix< C >.
C & MathTL::LowerTriangularMatrix< C >::operator() | ( | const size_type | row, |
const size_type | column | ||
) | [inline] |
read-write access to a matrix entry
Reimplemented in MathTL::UpperTriangularMatrix< C >, and MathTL::SymmetricMatrix< C >.
LowerTriangularMatrix< C > & MathTL::LowerTriangularMatrix< C >::operator= | ( | const LowerTriangularMatrix< C > & | M | ) |
assignment from another lower triangular matrix
bool MathTL::LowerTriangularMatrix< C >::operator== | ( | const LowerTriangularMatrix< C2 > & | M | ) | const |
equality test with another matrix
void MathTL::LowerTriangularMatrix< C >::print | ( | std::ostream & | os, |
const unsigned int | tabwidth = 10 , |
||
const unsigned int | precision = 3 |
||
) | const |
stream output with user-defined tabwidth and precision (cf. deal.II)
Reimplemented in MathTL::UpperTriangularMatrix< C >, MathTL::SymmetricMatrix< C >, and MathTL::SymmetricMatrix< bool >.
void MathTL::LowerTriangularMatrix< C >::resize | ( | const size_type | rows, |
const size_type | columns | ||
) |
resize matrix and initialize with zero
Reimplemented in MathTL::UpperTriangularMatrix< C >.
const LowerTriangularMatrix< C >::size_type MathTL::LowerTriangularMatrix< C >::row_dimension | ( | ) | const [inline] |
row dimension
Reimplemented in MathTL::UpperTriangularMatrix< C >.
void MathTL::LowerTriangularMatrix< C >::scale | ( | const C | s | ) | [inline] |
in place scaling *this *= s
void MathTL::LowerTriangularMatrix< C >::set_entry | ( | const size_type | row, |
const size_type | column, | ||
const C | value | ||
) | [inline] |
write access to a matrix entry
Reimplemented in MathTL::UpperTriangularMatrix< C >, and MathTL::SymmetricMatrix< C >.
const LowerTriangularMatrix< C >::size_type MathTL::LowerTriangularMatrix< C >::size | ( | ) | const [inline] |
size as an STL-compatible container for matrix entries
LowerTriangularMatrix< C >::size_type MathTL::LowerTriangularMatrix< C >::triangle_index | ( | const size_type | row, |
const size_type | column, | ||
const size_type | rowdim, | ||
const size_type | coldim | ||
) | [inline, static, protected] |
return index of an entry in a lower triangular (row major storage) or upper triangular (column major storage) or symmetric matrix
LowerTriangularMatrix< C >::size_type MathTL::LowerTriangularMatrix< C >::triangle_size | ( | const size_type | rows, |
const size_type | columns | ||
) | [inline, static, protected] |
return number of nonzero entries in a triangular matrix
size_type MathTL::LowerTriangularMatrix< C >::coldim_ [protected] |
column dimension
Vector<C> MathTL::LowerTriangularMatrix< C >::entries_ [protected] |
internal storage of lower triangular matrices is just an appropriately sized vector, which holds the matrix entries in row major ordering with decreasing width
size_type MathTL::LowerTriangularMatrix< C >::rowdim_ [protected] |
row dimension