From 2cb1629fd9fd317ec8a8ba3035031d583c0ea34d Mon Sep 17 00:00:00 2001 From: wolf Date: Wed, 24 May 2000 10:49:33 +0000 Subject: [PATCH] Implement Jacobi preconditioning. git-svn-id: https://svn.dealii.org/trunk@2932 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/block_sparse_matrix.h | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) 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