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

#include <matrix.h>

Inheritance diagram for MathTL::Matrix< C >:
MathTL::MatrixBlock< C > MathTL::DecomposableMatrix< C > MathTL::Hessenberg< C >

List of all members.

Public Types

typedef Vector< C >::size_type size_type

Public Member Functions

 Matrix (const size_type n=0)
 Matrix (const Matrix< C > &M)
 Matrix (const SymmetricMatrix< C > &M)
 Matrix (const LowerTriangularMatrix< C > &M)
 Matrix (const UpperTriangularMatrix< C > &M)
template<class MATRIX1 , class MATRIX2 >
 Matrix (const KroneckerMatrix< C, MATRIX1, MATRIX2 > &M)
 Matrix (const Vector< C > &v)
 Matrix (const size_type row_dimension, const size_type column_dimension)
 Matrix (const size_type row_dimension, const size_type column_dimension, const char *str, const bool byrow=true)
MatrixBlock< C > * clone () const
 clone the matrix (requirement from MatrixBlock)
MatrixBlock< C > * clone_transposed () const
 transpose the matrix (requirement from MatrixBlock)
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)
void reshape (const size_type rows)
void reshape (Vector< C > &v) const
void col (Vector< C > &v) const
void decol (const Vector< C > &v, const size_type rows)
void diagonal (const size_type n, const C diag)
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
template<class MATRIX >
void get_block (const size_type firstrow, const size_type firstcolumn, const size_type rows, const size_type columns, MATRIX &M, const bool resizeM=false) 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 MATRIX >
void set_block (const size_type firstrow, const size_type firstcolumn, const MATRIX &M, const bool reflect=false)
template<class C2 >
bool operator== (const Matrix< C2 > &M) const
template<class C2 >
bool operator!= (const Matrix< C2 > &M) const
Matrix< C > & operator= (const Matrix< C > &M)
void swap (Matrix< C > &M)
void reflect (Matrix< C > &M) const
void scale (const C s)
template<class VECTOR >
void apply (const VECTOR &x, VECTOR &Mx) const
void apply (const Vector< C > &x, Vector< C > &Mx) const
 special version for Vector<C> (requirement from MatrixBlock)
template<class VECTOR >
void apply_transposed (const VECTOR &x, VECTOR &Mtx) const
void apply_transposed (const Vector< C > &x, Vector< C > &Mtx) const
 special version for Vector<C> (requirement from MatrixBlock)
void compress (const double eta=1e-16)
void print (std::ostream &os, const unsigned int tabwidth=10, const unsigned int precision=3) const
void matlab_output (const char *file, const char *Matrixname, const int binary) const

Protected Attributes

Vector< C > entries_
size_type rowdim_
size_type coldim_

Detailed Description

template<class C>
class MathTL::Matrix< C >

This class models finite, densely populated matrices M = (m_{i,j})_{0<=i<m, 0<=j<n} with entries from an arbitrary (scalar) class C, designed for numerical computations.


Member Typedef Documentation

template<class C>
typedef Vector<C>::size_type MathTL::Matrix< C >::size_type

type of indexes and size type (cf. STL containers)

Reimplemented from MathTL::MatrixBlock< C >.

Reimplemented in MathTL::DecomposableMatrix< C >.


Constructor & Destructor Documentation

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

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

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

copy constructor

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

copy constructor from symmetric matrices

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

copy constructor from a lower triangular matrix

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

copy constructor from an upper triangular matrix

template<class C>
template<class MATRIX1 , class MATRIX2 >
MathTL::Matrix< C >::Matrix ( const KroneckerMatrix< C, MATRIX1, MATRIX2 > &  M)

copy constructor from a Kronecker matrix

template<class C>
MathTL::Matrix< C >::Matrix ( const Vector< C > &  v)

copy constructor from a (column) vector

template<class C>
MathTL::Matrix< C >::Matrix ( const size_type  row_dimension,
const size_type  column_dimension 
) [inline]

construct m*n rectangular matrix

template<class C>
MathTL::Matrix< C >::Matrix ( const size_type  row_dimension,
const size_type  column_dimension,
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::Matrix< 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

template<class C >
template<class VECTOR >
void MathTL::Matrix< 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

template<class C>
void MathTL::Matrix< C >::col ( Vector< C > &  v) const

glue all columns together

template<class C >
const Matrix< C >::size_type MathTL::Matrix< C >::column_dimension ( ) const [inline, virtual]

column dimension

Implements MathTL::MatrixBlock< C >.

Reimplemented in MathTL::DecomposableMatrix< C >.

template<class C >
void MathTL::Matrix< C >::compress ( const double  eta = 1e-16) [inline]

set all values with modulus below a threshold to zero (fabs<C> should exist)

template<class C>
void MathTL::Matrix< C >::decol ( const Vector< C > &  v,
const size_type  rows 
)

reverse the col() call, with #rows rows (#rows should divide v.size()...)

template<class C>
void MathTL::Matrix< C >::diagonal ( const size_type  n,
const C  diag 
)

resize the matrix, prepare an n-by-n diagonal matrix

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

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

template<class C >
template<class MATRIX >
void MathTL::Matrix< C >::get_block ( const size_type  firstrow,
const size_type  firstcolumn,
const size_type  rows,
const size_type  columns,
MATRIX &  M,
const bool  resizeM = false 
) const

read access to a subblock

template<class C >
const C MathTL::Matrix< C >::get_entry ( const size_type  row,
const size_type  column 
) const [inline]

read-only access to a matrix entry

template<class C >
void MathTL::Matrix< C >::matlab_output ( const char *  file,
const char *  Matrixname,
const int  binary 
) const

write matrix into Matlab file

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

(estimate for the) memory consumption in bytes

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

non-equality test

template<class C >
const C MathTL::Matrix< C >::operator() ( const size_type  row,
const size_type  column 
) const [inline]

read-only access to a matrix entry

template<class C >
C & MathTL::Matrix< C >::operator() ( const size_type  row,
const size_type  column 
) [inline]

read-write access to a matrix entry

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

assignment from another matrix

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

equality test with another matrix

template<class C >
void MathTL::Matrix< C >::print ( std::ostream &  os,
const unsigned int  tabwidth = 10,
const unsigned int  precision = 3 
) const [virtual]

stream output with user-defined tabwidth and precision (cf. deal.II)

Implements MathTL::MatrixBlock< C >.

Reimplemented in MathTL::DecomposableMatrix< C >.

template<class C>
void MathTL::Matrix< C >::reflect ( Matrix< C > &  M) const

create reflected matrix (flip row and column numbers)

template<class C >
void MathTL::Matrix< C >::reshape ( const size_type  rows)

Matlab reshape functionality: rearrange the entries with a given number of rows (#rows should divide m*n...)

template<class C>
void MathTL::Matrix< C >::reshape ( Vector< C > &  v) const [inline]

Matlab reshape functionality: rearrange the entries as a column vector

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

resize matrix and initialize with zero

template<class C >
const Matrix< C >::size_type MathTL::Matrix< C >::row_dimension ( ) const [inline, virtual]

row dimension

Implements MathTL::MatrixBlock< C >.

Reimplemented in MathTL::DecomposableMatrix< C >.

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

in place scaling *this *= s

template<class C >
template<class MATRIX >
void MathTL::Matrix< C >::set_block ( const size_type  firstrow,
const size_type  firstcolumn,
const MATRIX &  M,
const bool  reflect = false 
)

write access to a subblock; if the "reflect" flag is set, rows and columns of the block are reflected before writing

template<class C>
void MathTL::Matrix< C >::set_entry ( const size_type  row,
const size_type  column,
const C  value 
) [inline]

write access to a matrix entry

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

size as an STL-compatible container for matrix entries

Reimplemented in MathTL::DecomposableMatrix< C >.

template<class C>
void MathTL::Matrix< C >::swap ( Matrix< C > &  M) [inline]

swap entries of two matrices


Member Data Documentation

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

column dimension

template<class C>
Vector<C> MathTL::Matrix< C >::entries_ [protected]

internal storage of densely populated matrices is just an appropriately sized vector, which holds the matrix entries in row major ordering

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

row dimension


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