From: Stefano Zampini Date: Tue, 24 Jan 2023 07:30:34 +0000 (+0300) Subject: Use a single API call to perform y = alpha * x X-Git-Tag: v9.5.0-rc1~369^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61706c32c92029f239c1a6eef411f7ed01825c64;p=dealii.git Use a single API call to perform y = alpha * x --- diff --git a/source/lac/petsc_vector_base.cc b/source/lac/petsc_vector_base.cc index 9282eafc70..061c0ee72a 100644 --- a/source/lac/petsc_vector_base.cc +++ b/source/lac/petsc_vector_base.cc @@ -942,13 +942,8 @@ namespace PETScWrappers Assert(size() == v.size(), ExcDimensionMismatch(size(), v.size())); - // there is no simple operation for this - // in PETSc. there are multiple ways to - // emulate it, we choose this one: - const PetscErrorCode ierr = VecCopy(v.vector, vector); + const PetscErrorCode ierr = VecAXPBY(vector, a, 0.0, v.vector); AssertThrow(ierr == 0, ExcPETScError(ierr)); - - *this *= a; }