MathTL
 All Classes Functions Variables Typedefs Enumerations
Public Types | Public Member Functions | Static Protected Member Functions | Protected Attributes
MathTL::LowerTriangularMatrix< C > Class Template Reference

#include <triangular_matrix.h>

Inheritance diagram for MathTL::LowerTriangularMatrix< C >:
MathTL::SymmetricMatrix< C > MathTL::UpperTriangularMatrix< C >

List of all members.

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_

Detailed Description

template<class C>
class MathTL::LowerTriangularMatrix< C >

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.


Member Typedef Documentation

template<class C>
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 >.


Constructor & Destructor Documentation

template<class C >
MathTL::LowerTriangularMatrix< C >::LowerTriangularMatrix ( const size_type  n = 0) [explicit]

default constructor, yields zero square matrix which is empty per default

template<class C>
MathTL::LowerTriangularMatrix< C >::LowerTriangularMatrix ( const LowerTriangularMatrix< C > &  M) [inline]

copy constructor

template<class C>
MathTL::LowerTriangularMatrix< C >::LowerTriangularMatrix ( const size_type  rows,
const size_type  columns 
)

construct m*n rectangular matrix

template<class C>
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.

Parameters:
row_dimensionrow dimension
column_dimensioncolumn dimension
strinput string
byrowindicates whether coefficients are stored row by row in the stream

Member Function Documentation

template<class C >
template<class VECTOR >
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 >.

template<class C >
template<class VECTOR >
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 >.

template<class C >
const LowerTriangularMatrix< C >::size_type MathTL::LowerTriangularMatrix< C >::column_dimension ( ) const [inline]

column dimension

Reimplemented in MathTL::UpperTriangularMatrix< C >.

template<class C >
bool MathTL::LowerTriangularMatrix< C >::empty ( ) const [inline]

return true if matrix is empty (cf. STL containers)

template<class C >
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 >.

template<class C>
void MathTL::LowerTriangularMatrix< C >::inverse ( LowerTriangularMatrix< C > &  MInv) const

compute the inverse of *this (if possible), M will be properly scaled

template<class C >
const LowerTriangularMatrix< C >::size_type MathTL::LowerTriangularMatrix< C >::memory_consumption ( ) const [inline]

(estimate for the) memory consumption in bytes

template<class C >
template<class C2 >
bool MathTL::LowerTriangularMatrix< C >::operator!= ( const LowerTriangularMatrix< C2 > &  M) const [inline]

non-equality test

template<class C >
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 >.

template<class 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 >.

template<class C>
LowerTriangularMatrix< C > & MathTL::LowerTriangularMatrix< C >::operator= ( const LowerTriangularMatrix< C > &  M)

assignment from another lower triangular matrix

template<class C >
template<class C2 >
bool MathTL::LowerTriangularMatrix< C >::operator== ( const LowerTriangularMatrix< C2 > &  M) const

equality test with another matrix

template<class C >
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 >.

template<class C >
void MathTL::LowerTriangularMatrix< C >::resize ( const size_type  rows,
const size_type  columns 
)

resize matrix and initialize with zero

Reimplemented in MathTL::UpperTriangularMatrix< C >.

template<class C >
const LowerTriangularMatrix< C >::size_type MathTL::LowerTriangularMatrix< C >::row_dimension ( ) const [inline]

row dimension

Reimplemented in MathTL::UpperTriangularMatrix< C >.

template<class C>
void MathTL::LowerTriangularMatrix< C >::scale ( const C  s) [inline]

in place scaling *this *= s

template<class C>
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 >.

template<class C >
const LowerTriangularMatrix< C >::size_type MathTL::LowerTriangularMatrix< C >::size ( ) const [inline]

size as an STL-compatible container for matrix entries

template<class C >
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

template<class C >
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


Member Data Documentation

template<class C>
size_type MathTL::LowerTriangularMatrix< C >::coldim_ [protected]

column dimension

template<class C>
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

template<class C>
size_type MathTL::LowerTriangularMatrix< C >::rowdim_ [protected]

row dimension


The documentation for this class was generated from the following files:
 All Classes Functions Variables Typedefs Enumerations