<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<div dir="ltr" style="font-size:12pt; color:#000000; background-color:#FFFFFF; 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">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.<br>
</p>
<p><br>
</p>
<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="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div class="BodyFragment">
<div class="PlainText">Heeho Daniel Park<br>
<br>
! ------------------------------------ !<br>
Sandia National Laboratories</div>
<div class="PlainText" style="">Org: 08844, R&D</div>
<div class="PlainText" style="">Work: 505-844-1319<br>
! ------------------------------------ !<br>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>