[petsc-users] How to compute y = y - A*b
Matthew Knepley
knepley at gmail.com
Thu Dec 22 07:27:52 CST 2016
On Thu, Dec 22, 2016 at 7:07 AM, Florian Lindner <mailinglists at xgm.de>
wrote:
> Hello,
>
> what is the best / most efficient way to compute:
>
> y = y - A * b
>
http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatMultAdd.html
Matt
> 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
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20161222/9ea8a3c3/attachment.html>
More information about the petsc-users
mailing list