<div dir="ltr"><div dir="ltr">On Thu, Apr 9, 2020 at 3:41 PM Park, Heeho via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Calibri,Arial,Helvetica,sans-serif">
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Calibri,Arial,Helvetica,sans-serif">
<div>
<p>Hi PETSc developers,<br>
</p>
<p><br>
</p>
<p>I am trying to formulate<br>
</p>
<p><br>
</p>
<p>p^T J^T J p <br>
</p>
<p><br>
</p>
<p>where p is a solution vector length n, J is Jacobian n-by-n matrix. <br>
</p>
<p><br>
</p>
<p>Ref: <a href="https://en.wikipedia.org/wiki/Gauss%E2%80%93Newton_algorithm" target="_blank">https://en.wikipedia.org/wiki/Gauss%E2%80%93Newton_algorithm</a> under Large-scale optimization<br>
</p>
<p><br>
</p>
<p>It is known that for parallel computations, the best way to perform this computation (with csr matrix) is<br>
</p>
<p><br>
</p>
<p>J^T J p = SUM_i [ c_i ( c_i dot p) ] which results in a vector.</p></div></div></div></blockquote><div>I don't think so. Why not just do</div><div><br></div><div> y = J p</div><div><br></div><div> y^t y = p^T J^T J p</div><div><br></div><div> Thanks,</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"><div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Calibri,Arial,Helvetica,sans-serif"><div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Calibri,Arial,Helvetica,sans-serif"><div>
<p>In PFLOTRAN, we use mpibaij matrix. I could not find a PETSc command to perform this with one command.</p>
<p>Is there one I couldn't find? if not, is using MATGETROW with C for-loop a good way to do this?<br>
</p>
<p><br>
</p>
<p>I currently use, MatMult(J,p,w); MatMultTranspose(J,w,w2); VecDotRealPart(p,w2);<br>
</p>
<p><br>
</p>
<p>Best,<br>
</p>
<p><br>
</p>
<div id="gmail-m_1328558010341724865Signature">
<div name="divtagdefaultwrapper">
<div>
<div>Heeho Daniel Park<br>
<br>
! ------------------------------------ !<br>
Sandia National Laboratories</div>
<div>Org: 08844, R&D</div>
<div>Work: 505-844-1319<br>
! ------------------------------------ !<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>