From cd072f5b77ce8fe28c915f1dca3277ac023dbea9 Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Wed, 27 Jun 2001 17:24:07 +0000 Subject: [PATCH] multiplications improved git-svn-id: https://svn.dealii.org/trunk@4767 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/shifted_matrix.h | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/deal.II/lac/include/lac/shifted_matrix.h b/deal.II/lac/include/lac/shifted_matrix.h index 57849269c9..96c40372b5 100644 --- a/deal.II/lac/include/lac/shifted_matrix.h +++ b/deal.II/lac/include/lac/shifted_matrix.h @@ -62,6 +62,10 @@ class ShiftedMatrix */ SmartPointer A; + /** + * Auxiliary vector. + */ + VECTOR aux; /** * Shift parameter. */ @@ -165,7 +169,8 @@ inline void ShiftedMatrix::vmult (VECTOR& dst, const VECTOR& src) const { A.vmult(dst, src); - dst.add(sigma, src); + if (sigma != 0.) + dst.add(sigma, src); } @@ -177,7 +182,8 @@ ShiftedMatrix::residual (VECTOR& dst, const VECTOR& rhs) const { A.vmult(dst, src); - dst.add(sigma, src); + if (sigma != 0.) + dst.add(sigma, src); dst.sadd(-1.,1.,rhs); return dst.l2_norm (); } @@ -221,7 +227,12 @@ ShiftedMatrixGeneralized::vmult (VECTOR& dst, const VECTOR& src) const { A.vmult(dst, src); - dst.add(sigma, src); + if (sigma != 0.) + { + aux.reinit(dst); + M.vmult(aux, src); + dst.add(sigma, aux); + } } @@ -233,7 +244,12 @@ ShiftedMatrixGeneralized::residual (VECTOR& dst, const VECTOR& rhs) const { A.vmult(dst, src); - dst.add(sigma, src); + if (sigma != 0.) + { + aux.reinit(dst); + M.vmult(aux, src); + dst.add(sigma, aux); + } dst.sadd(-1.,1.,rhs); return dst.l2_norm (); } -- 2.39.5