On Thu, Dec 22, 2016 at 7:07 AM, Florian Lindner <[email protected]>
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

Reply via email to