]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use a single API call to perform y = alpha * x
authorStefano Zampini <stefano.zampini@gmail.com>
Tue, 24 Jan 2023 07:30:34 +0000 (10:30 +0300)
committerStefano Zampini <stefano.zampini@gmail.com>
Fri, 31 Mar 2023 08:56:32 +0000 (09:56 +0100)
source/lac/petsc_vector_base.cc

index 9282eafc70209851393cc3cc157817ccfc3ccaa3..061c0ee72a960c73296417d5008df6279431fc53 100644 (file)
@@ -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;
   }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.