[petsc-users] How to compute y = y - A*b
Florian Lindner
mailinglists at xgm.de
Thu Dec 22 07:07:35 CST 2016
Hello,
what is the best / most efficient way to compute:
y = y - A * b
with vectors b, y and matrix A:
* VecAXPY: I need to compute A*b first
MatMult(A, b, r);
VecAXPY(y, -1, r);
* VecWAXPY: Same case, but I don't reuse y
MatMult(A, b, r);
VecWAXPY(w, -1, r, y);
* VecAYPX: Don't work, because I need to multiply r = A*b with -1
Is there anything else I have overseen, or should I just go with VecAXPY?
Best,
Florian
More information about the petsc-users
mailing list