<div id="_htmlarea_default_style_" style="font:10pt arial,helvetica,sans-serif">Matthew, Jed,<br><br>Thanks, you're absolutely right. Why I was so
stick with this matrix product at all...<br><br><br>On Wed, 15 Jun 2011 17:46:06 +0000<br> Matthew Knepley <knepley@gmail.com>
wrote:<br>> On Wed, Jun 15, 2011 at 5:35 PM, Alexander Grayver<br>> <agrayver@gfz-potsdam.de>wrote:<br>> <br>>> Thanks
Jed,<br>>><br>>> Actually, I'm going to use this product as a part of the <br>>>following<br>>>
expressions:<br>>><br>>> v'*A'*A*v<br>>> A'*A*v<br>>><br>>> I need it many times with different v, but constant
A.<br>>><br>>> MatPtAP with unit matrix seems to be ok, I guess.<br>>><br>> <br>> No, you do not need that at all for the
above. Use<br>> <br>> MatMult(A, v, w)<br>> VecDot(w, w, &prod)
prod = v' A' A v<br>> MatMultTranspose(A, w, y) y = A' A v<br>> <br>> Matt<br>> <br>>
Regards,<br>>> Alexander<br>>><br>>><br>>> On Wed, 15 Jun 2011 19:00:15 +0200<br>>> Jed Brown
<jed@59A2.org> wrote:<br>>> > On Wed, Jun 15, 2011 at 18:54, Alexander Grayver<br>>>
><agrayver@gfz-potsdam.de>wrote:<br>>> ><br>>> >> I've got simple question.<br>>> >> What is the most
efficient way to compute B = A'*A <br>>>using<br>>> >>petsc?<br>>> >> Matrix A is sparse MPIAIJ.<br>>>
>><br>>> ><br>>> > What are you going to do with B = A'*A?<br>>> ><br>>> > The most efficient thing is
MatCreateTranspose() which<br>>> >does no computation.<br>>> ><br>>> ><br>>>
http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatCreateTranspose.html<br>>> ><br>>>
><br>>> > If you need B assembled, then create a diagonal matrix<br>>> >and use MatPtAP()<br>>> ><br>>>
><br>>> http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatPtAP.html<br>>><br>>><br>>
<br>> <br>> -- <br>> What most experimenters take for granted before they <br>>begin their experiments<br>> is infinitely more
interesting than any results to which <br>>their experiments<br>> lead.<br>> -- Norbert Wiener<br><br></div>