<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Dec 22, 2016 at 7:07 AM, Florian Lindner <span dir="ltr"><<a href="mailto:mailinglists@xgm.de" target="_blank">mailinglists@xgm.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
what is the best / most efficient way to compute:<br>
<br>
y = y - A * b<br></blockquote><div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatMultAdd.html">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatMultAdd.html</a><br></div><div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
with vectors b, y and matrix A:<br>
<br>
* VecAXPY: I need to compute A*b first<br>
<br>
MatMult(A, b, r);<br>
VecAXPY(y, -1, r);<br>
<br>
* VecWAXPY: Same case, but I don't reuse y<br>
<br>
MatMult(A, b, r);<br>
VecWAXPY(w, -1, r, y);<br>
<br>
* VecAYPX: Don't work, because I need to multiply r = A*b with -1<br>
<br>
Is there anything else I have overseen, or should I just go with VecAXPY?<br>
<br>
Best,<br>
Florian<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div>