#include <matrix.h>
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_ |
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.
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 >.
MathTL::Matrix< C >::Matrix | ( | const size_type | n = 0 | ) | [inline, explicit] |
default constructor, yields zero square matrix which is empty per default
MathTL::Matrix< C >::Matrix | ( | const Matrix< C > & | M | ) | [inline] |
copy constructor
MathTL::Matrix< C >::Matrix | ( | const SymmetricMatrix< C > & | M | ) | [inline] |
copy constructor from symmetric matrices
MathTL::Matrix< C >::Matrix | ( | const LowerTriangularMatrix< C > & | M | ) | [inline] |
copy constructor from a lower triangular matrix
MathTL::Matrix< C >::Matrix | ( | const UpperTriangularMatrix< C > & | M | ) | [inline] |
copy constructor from an upper triangular matrix
MathTL::Matrix< C >::Matrix | ( | const KroneckerMatrix< C, MATRIX1, MATRIX2 > & | M | ) |
copy constructor from a Kronecker matrix
MathTL::Matrix< C >::Matrix | ( | const Vector< C > & | v | ) |
copy constructor from a (column) vector
MathTL::Matrix< C >::Matrix | ( | const size_type | row_dimension, |
const size_type | column_dimension | ||
) | [inline] |
construct m*n rectangular matrix
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.
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::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
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
void MathTL::Matrix< C >::col | ( | Vector< C > & | v | ) | const |
glue all columns together
const Matrix< C >::size_type MathTL::Matrix< C >::column_dimension | ( | ) | const [inline, virtual] |
column dimension
Implements MathTL::MatrixBlock< C >.
Reimplemented in MathTL::DecomposableMatrix< 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)
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()...)
void MathTL::Matrix< C >::diagonal | ( | const size_type | n, |
const C | diag | ||
) |
resize the matrix, prepare an n-by-n diagonal matrix
bool MathTL::Matrix< C >::empty | ( | ) | const [inline] |
return true if matrix is empty (cf. STL containers)
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
const C MathTL::Matrix< C >::get_entry | ( | const size_type | row, |
const size_type | column | ||
) | const [inline] |
read-only access to a matrix entry
void MathTL::Matrix< C >::matlab_output | ( | const char * | file, |
const char * | Matrixname, | ||
const int | binary | ||
) | const |
write matrix into Matlab file
const Matrix< C >::size_type MathTL::Matrix< C >::memory_consumption | ( | ) | const [inline] |
(estimate for the) memory consumption in bytes
bool MathTL::Matrix< C >::operator!= | ( | const Matrix< C2 > & | M | ) | const [inline] |
non-equality test
const C MathTL::Matrix< C >::operator() | ( | const size_type | row, |
const size_type | column | ||
) | const [inline] |
read-only access to a matrix entry
C & MathTL::Matrix< C >::operator() | ( | const size_type | row, |
const size_type | column | ||
) | [inline] |
read-write access to a matrix entry
Matrix< C > & MathTL::Matrix< C >::operator= | ( | const Matrix< C > & | M | ) |
assignment from another matrix
bool MathTL::Matrix< C >::operator== | ( | const Matrix< C2 > & | M | ) | const |
equality test with another matrix
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 >.
void MathTL::Matrix< C >::reflect | ( | Matrix< C > & | M | ) | const |
create reflected matrix (flip row and column numbers)
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...)
void MathTL::Matrix< C >::reshape | ( | Vector< C > & | v | ) | const [inline] |
Matlab reshape functionality: rearrange the entries as a column vector
void MathTL::Matrix< C >::resize | ( | const size_type | rows, |
const size_type | columns | ||
) |
resize matrix and initialize with zero
const Matrix< C >::size_type MathTL::Matrix< C >::row_dimension | ( | ) | const [inline, virtual] |
row dimension
Implements MathTL::MatrixBlock< C >.
Reimplemented in MathTL::DecomposableMatrix< C >.
void MathTL::Matrix< C >::scale | ( | const C | s | ) | [inline] |
in place scaling *this *= s
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
void MathTL::Matrix< C >::set_entry | ( | const size_type | row, |
const size_type | column, | ||
const C | value | ||
) | [inline] |
write access to a matrix entry
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 >.
void MathTL::Matrix< C >::swap | ( | Matrix< C > & | M | ) | [inline] |
swap entries of two matrices
size_type MathTL::Matrix< C >::coldim_ [protected] |
column dimension
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
size_type MathTL::Matrix< C >::rowdim_ [protected] |
row dimension