Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
concepts::DenseMatrix< F > Class Template Reference

Dense matrix. More...

#include <denseMatrix.hh>

Inheritance diagram for concepts::DenseMatrix< F >:
Inheritance graph
[legend]
Collaboration diagram for concepts::DenseMatrix< F >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef Cmplxtype< F >::type c_type
 Real type of data type.
typedef _Matrix_iterator< F,
const F &, const F * > 
const_iterator
typedef _Matrix_iterator< F, F
&, F * > 
iterator
typedef Realtype< F >::type r_type
 Real type of data type.
typedef F type
 Type of data, e.g. matrix entries.
typedef F value_type
typedef F value_type

Public Member Functions

void add (const ElementMatrix< F > &A, uint offm=0, uint offn=0)
 Addition of another element matrix with possible offset.
template<class T >
void addInto (Matrix< T > &dest, const T fact, const uint rowoffset=0, const uint coloffset=0) const
 allows to add a Real Matrix to a complex one.
void addInto (Matrix< F > &dest, const F fact, const uint rowoffset=0, const uint coloffset=0) const
 This matrix is added into to the given matrix.
template<class T >
void addIntoT (Matrix< T > &dest, const T fact, const uint rowoffset=0, const uint coloffset=0) const
 allows to add a Real Matrix to a complex one.
iterator begin (uint r=0)
 Iterator over the elements, standing at position (r,0).
const_iterator begin (uint r=0) const
 Constant iterator over the elements, standing at position (r,0)
uint col () const
 Returns current column.
void compress (const Real threshold=EPS)
 Compresses the matrix by dropping small entries.
 DenseMatrix (int m, int n, bool transpose=false)
 Constructor for an empty matrix.
 DenseMatrix (const Matrix< F > &m, bool t=false)
 Copy constructor.
 DenseMatrix (const Vector< F > &v, bool t=false)
 Transformation constructor from a vector of length n.
template<class G >
 DenseMatrix (const Space< G > &spcX, const Space< G > &spcY, BilinearForm< F, G > &bf)
 Constructor.
template<class G >
 DenseMatrix (const Space< G > &spc, BilinearForm< F, G > &bf)
 Constructor.
 DenseMatrix (const LiCo< F > &L)
 Constructor.
 DenseMatrix (const Compose< F > &L)
 Constructor.
template<class G >
 DenseMatrix (const Space< G > &spcX, const Space< G > &spcY)
 Constructor for an empty matrix.
 DenseMatrix (const DenseMatrix< F > &m)
 Copy constructor.
virtual const uint dimX () const
 Returns the size of the image space of the operator (number of rows of the corresponding matrix)
virtual const uint dimY () const
 Returns the size of the source space of the operator (number of columns of the corresponding matrix)
iterator end ()
 Iterator, standing behind last element.
const_iterator end () const
 Constant iterator, standing behind last element.
const Array< F > & getData () const
 Returns the data array.
int getIndex () const
bool isTranspose () const
 Returns true if the matrix is transposed.
uint m () const
 Returns the number of rows.
uint n () const
 Returns the number of columns.
const uint nofCols () const
 Number of columns.
const uint nofRows () const
 Number of rows.
 operator const F * () const
 Returns a pointer to the data array.
 operator F * ()
 Returns a pointer to the data array.
virtual void operator() (const Function< c_type > &fncY, Function< c_type > &fncX)
 Application operator for complex function fncY.
virtual F & operator() (const uint i, const uint j)
 Returns and allows access to entry with indices i and j.
virtual void operator() (const Function< r_type > &fncY, Function< F > &fncX)
 Computes fncX = A(fncY) where A is this matrix.
template<class H , class I >
void operator() (const Vector< H > &fncY, Vector< I > &fncX)
virtual F operator() (const uint i, const uint j) const
 Returns entry with indices i and j.
ElementMatrix< F > & operator*= (const F n)
 Scaling operator.
virtual bool operator== (const Matrix< F > &otherMat) const
void resize (uint m, uint n)
 Sets a new size.
uint row () const
 Returns current row.
void setIndex (int i)
void setTranspose (bool t)
uint size () const
 Returns the number of entries in the matrix.
bool storeMatlab (const std::string filename, std::string name="", bool append=false) const
 Stores the matrix in a Matlab matrix.
virtual void transpMult (const Vector< c_type > &fncY, Vector< c_type > &fncX)
virtual void transpMult (const Vector< r_type > &fncY, Vector< F > &fncX)
 Computes fncX = AT fncY where A is this matrix.
bool transpose ()
 Transposes the matrix.
void zeros ()
 Fills the matrix with zeros.

Static Public Member Functions

template<class G >
static void assembly (Matrix< F > &dest, const Space< G > &spc, BilinearForm< F, G > &bf, const Real threshold=0.0)
 Assembly operator for dest using the bilinear form bf.
template<class G >
static void assembly (Matrix< F > &dest, BilinearForm< F, G > &bf, const ElementPairList< G > &pairs)
 Assembly operator for dest using the bilinear form bf.
template<class G >
static void assembly (Matrix< F > &dest, const Space< G > &spcX, const Space< G > &spcY, BilinearForm< F, G > &bf, const Real threshold=0.0)
 Assembly operator for dest using the bilinear form bf.
Timing Interface

These functions are used to get timings from class internal computations.

The values are stored in a user defined concepts::InOutParameters structure in different arrays (see setTimings). These arrays can be grouped into a table for easier postprocessing with

    concepts::ResultsTable table;
    table.addMap(concepts::ResultsTable::DOUBLE, "jacobian", output);
    table.addMap(concepts::ResultsTable::DOUBLE, "whole_sumfact", output);
    std::ofstream ofs("table.gnuplot");
    ofs << std::setprecision(20);
    table.print<concepts::ResultsTable::GNUPLOT>(ofs);
static void setTimings (InOutParameters *timings)
 Sets the class to store the timing values in.
static bool timings ()
 Returns true if the class is able to do timings.

Protected Member Functions

virtual std::ostream & info (std::ostream &os) const

Protected Attributes

Array< F > data_
 Data.
uint dimX_
 Dimension of image space and the source space.
uint dimY_
uint m_
 Number of rows.
uint n_
 Number of columns.
bool t_
 Transpose.

Detailed Description

template<class F>
class concepts::DenseMatrix< F >

Dense matrix.

The matrix has the size $m \times n$ where m is the dimension of the image space (spaceX) and n is the dimension of the source space (spaceY).

The matrix is setup and assembled in the constructor. It calls the bilinear form on every element of the space and uses the T matrices of the elements to assemble the element matrices into the global matrix.

There are quite a few solver which can be used to solve the system.

See also:
TMatrixBase
CG
GMRes

Definition at line 39 of file denseMatrix.hh.


Member Typedef Documentation

template<class F>
typedef Cmplxtype<F>::type concepts::DenseMatrix< F >::c_type

Real type of data type.

Reimplemented from concepts::Matrix< F >.

Definition at line 44 of file denseMatrix.hh.

template<class F>
typedef _Matrix_iterator<F, const F&, const F*> concepts::Matrix< F >::const_iterator [inherited]
template<class F>
typedef _Matrix_iterator<F, F&, F*> concepts::Matrix< F >::iterator [inherited]
template<class F>
typedef Realtype<F>::type concepts::DenseMatrix< F >::r_type

Real type of data type.

Reimplemented from concepts::Matrix< F >.

Definition at line 42 of file denseMatrix.hh.

template<class F>
typedef F concepts::Operator< F >::type [inherited]

Type of data, e.g. matrix entries.

Reimplemented in concepts::AfterIteration< F >, and concepts::SubMatrixN< F >.

Definition at line 43 of file compositions.hh.

template<class F>
typedef F concepts::Matrix< F >::value_type [inherited]

Definition at line 35 of file matrix.hh.

template<class F>
typedef F concepts::ElementMatrix< F >::value_type [inherited]

Reimplemented from concepts::ElementMatrixBase< F >.

Definition at line 195 of file element.hh.


Constructor & Destructor Documentation

template<class F>
template<class G >
concepts::DenseMatrix< F >::DenseMatrix ( const Space< G > &  spcX,
const Space< G > &  spcY,
BilinearForm< F, G > &  bf 
)

Constructor.

Computes the global matrix by assembling the element matrices.

This constructor features a double loop over the elements of the image and the source space. On each combination, the bilinear form is called.

Using this constructor, if spcX != spcY or if you have local matrices which express the interaction of the two elements. You can force this constructor to execute the double loop in such a way that only for diagonal combinations of the elements in both space the integration and assembling is executed. Use single and set it to true.

In non-symmetric FEM (eg. DGFEM), one has to solve AT u = f. This constructor computes A and not AT.

Parameters:
spcXImage space
spcYSource space
bfBilinear form
template<class F>
template<class G >
concepts::DenseMatrix< F >::DenseMatrix ( const Space< G > &  spc,
BilinearForm< F, G > &  bf 
)

Constructor.

Computes the global matrix by assembling the element matrices.

This constructor features a single loop over the elements of the space. On each element, the bilinear form is called.

Use the constructor, if spcX == spcY and there is no special element interaction. This is the case for standard FEM.

Parameters:
spcImage and source space
bfBilinear form
template<class F>
template<class G >
concepts::DenseMatrix< F >::DenseMatrix ( const Space< G > &  spcX,
const Space< G > &  spcY 
)

Constructor for an empty matrix.

Parameters:
spcXImage space
spcYSource space
template<class F>
concepts::DenseMatrix< F >::DenseMatrix ( int  m,
int  n,
bool  transpose = false 
) [inline]

Constructor for an empty matrix.

Parameters:
mNumber of rows
nNumber of columns
transposeThe matrix will be stored in transposed format

Definition at line 100 of file denseMatrix.hh.

template<class F>
concepts::DenseMatrix< F >::DenseMatrix ( const LiCo< F > &  L)

Constructor.

Evaluates a linear combination and stores the result in the matrix.

template<class F>
concepts::DenseMatrix< F >::DenseMatrix ( const Compose< F > &  L)

Constructor.

Evaluates a composition and stores the result in the matrix.

template<class F>
concepts::DenseMatrix< F >::DenseMatrix ( const DenseMatrix< F > &  m)

Copy constructor.

template<class F>
concepts::DenseMatrix< F >::DenseMatrix ( const Matrix< F > &  m,
bool  t = false 
)

Copy constructor.

If t is set to true, the matrix is transposed during the copy process

template<class F>
concepts::DenseMatrix< F >::DenseMatrix ( const Vector< F > &  v,
bool  t = false 
)

Transformation constructor from a vector of length n.

If t is set to true, the matrix is a 1xn, otherwise nx1.


Member Function Documentation

template<class F>
void concepts::ElementMatrix< F >::add ( const ElementMatrix< F > &  A,
uint  offm = 0,
uint  offn = 0 
) [inherited]

Addition of another element matrix with possible offset.

template<class F>
template<class T >
void concepts::DenseMatrix< F >::addInto ( Matrix< T > &  dest,
const T  fact,
const uint  rowoffset = 0,
const uint  coloffset = 0 
) const [inline]

allows to add a Real Matrix to a complex one.

Definition at line 157 of file denseMatrix.hh.

template<class F>
void concepts::DenseMatrix< F >::addInto ( Matrix< F > &  dest,
const F  fact,
const uint  rowoffset = 0,
const uint  coloffset = 0 
) const

This matrix is added into to the given matrix.

Parameters:
destMatrix into which this matrix should be added.
factFactor by which this matrix should be multiplied.
template<class F>
template<class T >
void concepts::DenseMatrix< F >::addIntoT ( Matrix< T > &  dest,
const T  fact,
const uint  rowoffset = 0,
const uint  coloffset = 0 
) const [inline]

allows to add a Real Matrix to a complex one.

Definition at line 173 of file denseMatrix.hh.

template<class F>
template<class G >
static void concepts::Matrix< F >::assembly ( Matrix< F > &  dest,
const Space< G > &  spc,
BilinearForm< F, G > &  bf,
const Real  threshold = 0.0 
) [static, inherited]

Assembly operator for dest using the bilinear form bf.

This assembly operator does not compute element matrices for two different elements. The elements are taken from the space spc.

Examples:
linearDG1d.cc.
template<class F>
template<class G >
static void concepts::Matrix< F >::assembly ( Matrix< F > &  dest,
const Space< G > &  spcX,
const Space< G > &  spcY,
BilinearForm< F, G > &  bf,
const Real  threshold = 0.0 
) [static, inherited]

Assembly operator for dest using the bilinear form bf.

This assembly operator computes also the element matrices for two different elements (coming from spcX and spcY).

template<class F>
template<class G >
static void concepts::Matrix< F >::assembly ( Matrix< F > &  dest,
BilinearForm< F, G > &  bf,
const ElementPairList< G > &  pairs 
) [static, inherited]

Assembly operator for dest using the bilinear form bf.

This assembly operator uses the element pairs taken from pairs. For every two elements found in a ElementPair in pairs, the bilinear form is evaluated and the result assembled into dest.

template<class F>
iterator concepts::Matrix< F >::begin ( uint  r = 0) [inline, inherited]

Iterator over the elements, standing at position (r,0).

Might be implemented differently for derived classes.

Reimplemented in concepts::SparseMatrix< F >, concepts::SubMatrixN< F >, concepts::SparseMatrix< concepts::Real >, concepts::SparseMatrix< FX >, concepts::SparseMatrix< T >, concepts::SparseMatrix< Cmplx >, and concepts::SparseMatrix< Real >.

Definition at line 55 of file matrix.hh.

template<class F>
const_iterator concepts::Matrix< F >::begin ( uint  r = 0) const [inline, inherited]

Constant iterator over the elements, standing at position (r,0)

Might be implemented differently for derived classes.

Reimplemented in concepts::SparseMatrix< F >, concepts::SubMatrixN< F >, concepts::SparseMatrix< concepts::Real >, concepts::SparseMatrix< FX >, concepts::SparseMatrix< T >, concepts::SparseMatrix< Cmplx >, and concepts::SparseMatrix< Real >.

Definition at line 62 of file matrix.hh.

template<class F>
uint concepts::ElementMatrix< F >::col ( ) const [inline, inherited]

Returns current column.

Definition at line 262 of file element.hh.

template<class F>
void concepts::ElementMatrix< F >::compress ( const Real  threshold = EPS) [inherited]

Compresses the matrix by dropping small entries.

All matrix entries which are smaller than a certain threshold times the largest entry of the matrix are deleted from the matrix.

template<class F>
virtual const uint concepts::Operator< F >::dimX ( ) const [inline, virtual, inherited]

Returns the size of the image space of the operator (number of rows of the corresponding matrix)

Definition at line 87 of file compositions.hh.

template<class F>
virtual const uint concepts::Operator< F >::dimY ( ) const [inline, virtual, inherited]

Returns the size of the source space of the operator (number of columns of the corresponding matrix)

Definition at line 92 of file compositions.hh.

template<class F>
const_iterator concepts::Matrix< F >::end ( ) const [inline, inherited]
template<class F>
iterator concepts::Matrix< F >::end ( ) [inline, inherited]

Iterator, standing behind last element.

Definition at line 57 of file matrix.hh.

template<class F>
const Array<F>& concepts::ElementMatrixBase< F >::getData ( ) const [inline, inherited]

Returns the data array.

Definition at line 161 of file element.hh.

template<class F>
int concepts::ElementMatrix< F >::getIndex ( ) const [inline, inherited]
Deprecated:
: FIXME: what the heck is this even for?

Definition at line 242 of file element.hh.

template<class F>
virtual std::ostream& concepts::DenseMatrix< F >::info ( std::ostream &  os) const [protected, virtual]

Reimplemented from concepts::ElementMatrix< F >.

template<class F>
bool concepts::ElementMatrixBase< F >::isTranspose ( ) const [inline, inherited]

Returns true if the matrix is transposed.

Definition at line 164 of file element.hh.

template<class F>
uint concepts::ElementMatrixBase< F >::m ( ) const [inline, inherited]

Returns the number of rows.

Definition at line 140 of file element.hh.

template<class F>
uint concepts::ElementMatrixBase< F >::n ( ) const [inline, inherited]

Returns the number of columns.

Definition at line 142 of file element.hh.

template<class F>
const uint concepts::Matrix< F >::nofCols ( ) const [inline, inherited]

Number of columns.

Definition at line 49 of file matrix.hh.

template<class F>
const uint concepts::Matrix< F >::nofRows ( ) const [inline, inherited]

Number of rows.

Definition at line 47 of file matrix.hh.

template<class F>
concepts::ElementMatrixBase< F >::operator const F * ( ) const [inline, inherited]

Returns a pointer to the data array.

Definition at line 158 of file element.hh.

template<class F>
concepts::ElementMatrix< F >::operator F * ( ) [inline, inherited]

Returns a pointer to the data array.

Definition at line 251 of file element.hh.

template<class F>
virtual void concepts::DenseMatrix< F >::operator() ( const Function< r_type > &  fncY,
Function< F > &  fncX 
) [virtual]

Computes fncX = A(fncY) where A is this matrix.

Implements concepts::Matrix< F >.

template<class F>
virtual void concepts::DenseMatrix< F >::operator() ( const Function< c_type > &  fncY,
Function< c_type > &  fncX 
) [virtual]

Application operator for complex function fncY.

Computes fncX = A(fncY) where A is this operator. fncX becomes complex.

In derived classes its enough to implement the operator() for complex Operator's. If a real counterpart is not implemented, the function fncY is splitted into real and imaginary part and the application operator for real functions is called for each. Then the result is combined.

If in a derived class the operator() for complex Operator's is not implemented, a exception is thrown from here.

Implements concepts::Matrix< F >.

template<class F>
virtual F concepts::DenseMatrix< F >::operator() ( const uint  i,
const uint  j 
) const [inline, virtual]

Returns entry with indices i and j.

Implements concepts::Matrix< F >.

Definition at line 140 of file denseMatrix.hh.

template<class F >
template<class H , class I >
void concepts::DenseMatrix< F >::operator() ( const Vector< H > &  fncY,
Vector< I > &  fncX 
)

Definition at line 192 of file denseMatrix.hh.

Here is the call graph for this function:

template<class F>
virtual F& concepts::DenseMatrix< F >::operator() ( const uint  i,
const uint  j 
) [inline, virtual]

Returns and allows access to entry with indices i and j.

Implements concepts::Matrix< F >.

Definition at line 144 of file denseMatrix.hh.

template<class F>
ElementMatrix<F>& concepts::ElementMatrix< F >::operator*= ( const F  n) [inline, inherited]

Scaling operator.

Definition at line 254 of file element.hh.

template<class F>
virtual bool concepts::Matrix< F >::operator== ( const Matrix< F > &  otherMat) const [inline, virtual, inherited]

Definition at line 103 of file matrix.hh.

template<class F>
void concepts::ElementMatrix< F >::resize ( uint  m,
uint  n 
) [inherited]

Sets a new size.

template<class F>
uint concepts::ElementMatrix< F >::row ( ) const [inline, inherited]

Returns current row.

Definition at line 260 of file element.hh.

template<class F>
void concepts::ElementMatrix< F >::setIndex ( int  i) [inline, inherited]
Deprecated:
: FIXME: what the heck is this even for?

Definition at line 245 of file element.hh.

template<class F>
static void concepts::Matrix< F >::setTimings ( InOutParameters timings) [static, inherited]

Sets the class to store the timing values in.

Additionally, the timeCntr_ is reset to 0. This counter is used to fill in the values into the arrays listed below in subsequent calls. The following timings are taken and stored in timings:

  • evaluation of bilinear form in bilinear_form
  • application of T matrix in tmatrix_apply
  • assembling into global matrix in global_assembly
template<class F>
void concepts::ElementMatrix< F >::setTranspose ( bool  t) [inline, inherited]

Definition at line 239 of file element.hh.

template<class F>
uint concepts::ElementMatrixBase< F >::size ( ) const [inline, inherited]

Returns the number of entries in the matrix.

Definition at line 155 of file element.hh.

template<class F>
bool concepts::ElementMatrixBase< F >::storeMatlab ( const std::string  filename,
std::string  name = "",
bool  append = false 
) const [inherited]

Stores the matrix in a Matlab matrix.

Parameters:
filenamename of the matlab file, with ending '.m'
namename of the variable, e.g. "A"
appendif false, create new file, otherwise append to it
Returns:
true if the writes was successfull
template<class F>
static bool concepts::Matrix< F >::timings ( ) [static, inherited]

Returns true if the class is able to do timings.

The ability to do timings depends on a compiler switch in matrix.cc file.

template<class F>
virtual void concepts::DenseMatrix< F >::transpMult ( const Vector< r_type > &  fncY,
Vector< F > &  fncX 
) [virtual]

Computes fncX = AT fncY where A is this matrix.

Implements concepts::Matrix< F >.

template<class F>
virtual void concepts::DenseMatrix< F >::transpMult ( const Vector< c_type > &  fncY,
Vector< c_type > &  fncX 
) [virtual]

Implements concepts::Matrix< F >.

template<class F>
bool concepts::ElementMatrix< F >::transpose ( ) [inline, inherited]

Transposes the matrix.

Deprecated:
use isTranspose() and setTranspose()

Definition at line 237 of file element.hh.

template<class F>
void concepts::ElementMatrix< F >::zeros ( ) [inline, inherited]

Fills the matrix with zeros.

Definition at line 248 of file element.hh.


Member Data Documentation

template<class F>
Array<F> concepts::ElementMatrixBase< F >::data_ [protected, inherited]

Data.

Definition at line 176 of file element.hh.

template<class F>
uint concepts::Operator< F >::dimX_ [protected, inherited]

Dimension of image space and the source space.

Definition at line 96 of file compositions.hh.

template<class F>
uint concepts::Operator< F >::dimY_ [protected, inherited]

Definition at line 96 of file compositions.hh.

template<class F>
uint concepts::ElementMatrixBase< F >::m_ [protected, inherited]

Number of rows.

Definition at line 178 of file element.hh.

template<class F>
uint concepts::ElementMatrixBase< F >::n_ [protected, inherited]

Number of columns.

Definition at line 180 of file element.hh.

template<class F>
bool concepts::ElementMatrixBase< F >::t_ [protected, inherited]

Transpose.

Definition at line 182 of file element.hh.


The documentation for this class was generated from the following file:

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)