From: Wolfgang Bangerth Date: Wed, 24 May 2000 10:49:33 +0000 (+0000) Subject: Implement Jacobi preconditioning. X-Git-Tag: v8.0.0~20474 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0db834e94f32c227a40281957aac82dbdfbd3fd0;p=dealii.git Implement Jacobi preconditioning. git-svn-id: https://svn.dealii.org/trunk@2932 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/block_sparse_matrix.h b/deal.II/lac/include/lac/block_sparse_matrix.h index 9512228649..6006592770 100644 --- a/deal.II/lac/include/lac/block_sparse_matrix.h +++ b/deal.II/lac/include/lac/block_sparse_matrix.h @@ -383,6 +383,24 @@ class BlockSparseMatrix : public Subscriptor const BlockVector &x, const BlockVector &b) const; + /** + * Apply the Jacobi + * preconditioner, which + * multiplies every element of + * the #src# vector by the + * inverse of the respective + * diagonal element and + * multiplies the result with the + * damping factor #omega#. + * + * The matrix needs to be square + * for this operation. + */ + template + void precondition_Jacobi (BlockVector &dst, + const BlockVector &src, + const number omega = 1.) const; + /** * Return a (constant) reference * to the underlying sparsity @@ -711,6 +729,22 @@ residual (BlockVector &dst, +template +template +void +BlockSparseMatrix:: +precondition_Jacobi (BlockVector &dst, + const BlockVector &src, + const number omega) const +{ + Assert (rows == columns, ExcMatrixNotBlockSquare()); + + for (unsigned int i=0; i