Public Member Functions | Private Member Functions | Private Attributes

SchurMatrix< MA_inverse, MB, MDt, MC > Class Template Reference
[Derived matrices]

Inheritance diagram for SchurMatrix< MA_inverse, MB, MDt, MC >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 SchurMatrix (const MA_inverse &Ainv, const MB &B, const MDt &Dt, const MC &C, VectorMemory< BlockVector< double > > &mem, const std::vector< unsigned int > &signature=std::vector< unsigned int >(0))
void prepare_rhs (BlockVector< double > &dst, const BlockVector< double > &src) const
void vmult (BlockVector< double > &dst, const BlockVector< double > &src) const
double residual (BlockVector< double > &dst, const BlockVector< double > &src, const BlockVector< double > &rhs) const
void postprocess (BlockVector< double > &dst, const BlockVector< double > &src, const BlockVector< double > &rhs) const
void debug_level (unsigned int l)

Private Member Functions

 SchurMatrix (const SchurMatrix< MA_inverse, MB, MDt, MC > &)
SchurMatrixoperator= (const SchurMatrix< MA_inverse, MB, MDt, MC > &)

Private Attributes

const SmartPointer< const
MA_inverse, SchurMatrix
< MA_inverse, MB, MDt, MC > > 
Ainv
const SmartPointer< const MB,
SchurMatrix< MA_inverse, MB,
MDt, MC > > 
B
const SmartPointer< const MDt,
SchurMatrix< MA_inverse, MB,
MDt, MC > > 
Dt
const SmartPointer< const MC,
SchurMatrix< MA_inverse, MB,
MDt, MC > > 
C
VectorMemory< BlockVector
< double > > & 
mem
std::vector< unsigned int > signature
unsigned int debug

Detailed Description

template<class MA_inverse, class MB, class MDt, class MC>
class SchurMatrix< MA_inverse, MB, MDt, MC >

Schur complement of a block matrix.

Given a non-singular matrix A (often positive definite) and a positive semi-definite matrix C as well as matrices B and Dt of full rank, this class implements a new matrix, the Schur complement a the system of equations of the structure

 * /        \  /   \     /   \
 * |  A  Dt |  | u |  -  | f |
 * | -B  C  |  | p |  -  | g |
 * \        /  \   /     \   /
 * 

Multiplication with the Schur matrix S is the operation

 * S p = C p + B A-inverse Dt-transpose p,
 * 

which is an operation within the space for p.

The data handed to the Schur matrix are as follows:

A: the inverse of A is stored, instead of A. This allows the application to use the most efficient form of inversion, iterative or direct.

B, C: these matrices are stored "as is".

Dt: the computation of the Schur complement involves the function Tvmult of the matrix Dt, not vmult! This way, it is sufficient to build only one matrix B for the symmetric Schur complement and use it twice.

All matrices involved are of arbitrary type and vectors are BlockVectors. This way, SchurMatrix can be coupled with any matrix classes providing vmult and Tvmult and can be even nested. Since SmartPointers of matrices are stored, the matrix blocks should be derived from Subscriptor.

Since the Schur complement of a matrix corresponds to a Gaussian block elimination, the right hand side of the condensed system must be preprocessed. Furthermore, the eliminated variable must be reconstructed after solving.

 *   g = g + B A-inverse f
 *   u = A-inverse (f - D-transpose p)
 * 

Applying these transformations, the solution of the system above by a SchurMatrix schur is coded as follows:

 *   schur.prepare_rhs (g, f);
 *   solver.solve (schur, p, g, precondition);
 *   schur.postprocess (u, p);
 * 
See also:
Block (linear algebra)
Author:
Guido Kanschat, 2000, 2001, 2002

Definition at line 93 of file schur_matrix.h.


Constructor & Destructor Documentation

template<class MA_inverse , class MB , class MDt , class MC >
SchurMatrix< MA_inverse, MB, MDt, MC >::SchurMatrix ( const MA_inverse &  Ainv,
const MB &  B,
const MDt &  Dt,
const MC &  C,
VectorMemory< BlockVector< double > > &  mem,
const std::vector< unsigned int > &  signature = std::vector<unsigned int>(0) 
)

Constructor. This constructor receives all the matrices needed. Furthermore, it gets a reference to a memory structure for obtaining block vectors.

Optionally, the length of the u-vector can be provided.

For the meaning of the matrices see the class documentation.

Definition at line 220 of file schur_matrix.h.

template<class MA_inverse , class MB , class MDt , class MC >
SchurMatrix< MA_inverse, MB, MDt, MC >::SchurMatrix ( const SchurMatrix< MA_inverse, MB, MDt, MC > &   ) [private]

No copy constructor.


Member Function Documentation

template<class MA_inverse , class MB , class MDt , class MC >
void SchurMatrix< MA_inverse, MB, MDt, MC >::prepare_rhs ( BlockVector< double > &  dst,
const BlockVector< double > &  src 
) const

Do block elimination of the right hand side. Given right hand sides for both components of the block system, this function provides the right hand side for the Schur complement.

The result is stored in the first argument, which is also part of the input data. If it is necessary to conserve the data, dst must be copied before calling this function. This is reasonable, since in many cases, only the pre-processed right hand side is needed.

Definition at line 296 of file schur_matrix.h.

References Assert, BlockVectorBase< Vector< Number > >::block(), deallog, StandardExceptions::ExcDimensionMismatch(), BlockVectorBase< Vector< Number > >::l2_norm(), BlockVectorBase< Vector< Number > >::n_blocks(), LogStream::pop(), LogStream::push(), and BlockVector< Number >::reinit().

template<class MA_inverse , class MB , class MDt , class MC >
void SchurMatrix< MA_inverse, MB, MDt, MC >::vmult ( BlockVector< double > &  dst,
const BlockVector< double > &  src 
) const
template<class MA_inverse , class MB , class MDt , class MC >
double SchurMatrix< MA_inverse, MB, MDt, MC >::residual ( BlockVector< double > &  dst,
const BlockVector< double > &  src,
const BlockVector< double > &  rhs 
) const

Computation of the residual of the Schur complement.

Definition at line 283 of file schur_matrix.h.

References BlockVectorBase< Vector< Number > >::l2_norm(), and BlockVector< Number >::scale().

template<class MA_inverse , class MB , class MDt , class MC >
void SchurMatrix< MA_inverse, MB, MDt, MC >::postprocess ( BlockVector< double > &  dst,
const BlockVector< double > &  src,
const BlockVector< double > &  rhs 
) const
template<class MA_inverse , class MB , class MDt , class MC >
void SchurMatrix< MA_inverse, MB, MDt, MC >::debug_level ( unsigned int  l )

Select debugging information for log-file. Debug level 1 is defined and writes the norm of every vector before and after each operation. Debug level 0 turns off debugging information.

Definition at line 237 of file schur_matrix.h.

template<class MA_inverse , class MB , class MDt , class MC >
SchurMatrix& SchurMatrix< MA_inverse, MB, MDt, MC >::operator= ( const SchurMatrix< MA_inverse, MB, MDt, MC > &   ) [private]

No assignment.


Member Data Documentation

template<class MA_inverse , class MB , class MDt , class MC >
const SmartPointer<const MA_inverse,SchurMatrix<MA_inverse,MB,MDt,MC> > SchurMatrix< MA_inverse, MB, MDt, MC >::Ainv [private]

Pointer to inverse of upper left block.

Definition at line 186 of file schur_matrix.h.

template<class MA_inverse , class MB , class MDt , class MC >
const SmartPointer<const MB,SchurMatrix<MA_inverse,MB,MDt,MC> > SchurMatrix< MA_inverse, MB, MDt, MC >::B [private]

Pointer to lower left block.

Definition at line 190 of file schur_matrix.h.

template<class MA_inverse , class MB , class MDt , class MC >
const SmartPointer<const MDt,SchurMatrix<MA_inverse,MB,MDt,MC> > SchurMatrix< MA_inverse, MB, MDt, MC >::Dt [private]

Pointer to transpose of upper right block.

Definition at line 194 of file schur_matrix.h.

template<class MA_inverse , class MB , class MDt , class MC >
const SmartPointer<const MC,SchurMatrix<MA_inverse,MB,MDt,MC> > SchurMatrix< MA_inverse, MB, MDt, MC >::C [private]

Pointer to lower right block.

Definition at line 198 of file schur_matrix.h.

template<class MA_inverse , class MB , class MDt , class MC >
VectorMemory<BlockVector<double> >& SchurMatrix< MA_inverse, MB, MDt, MC >::mem [private]

Auxiliary memory for vectors.

Definition at line 202 of file schur_matrix.h.

template<class MA_inverse , class MB , class MDt , class MC >
std::vector<unsigned int> SchurMatrix< MA_inverse, MB, MDt, MC >::signature [private]

Optional signature of the u-vector.

Definition at line 207 of file schur_matrix.h.

template<class MA_inverse , class MB , class MDt , class MC >
unsigned int SchurMatrix< MA_inverse, MB, MDt, MC >::debug [private]

Switch for debugging information.

Definition at line 212 of file schur_matrix.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

deal.II documentation generated on Fri Feb 3 2012 06:04:11 by doxygen 1.7.2