<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div dir="auto" style="direction: ltr; margin: 0; padding: 0; font-family: sans-serif; font-size: 11pt; color: black; ">
I don't understand, why don't you just take the dot product of w with itself?<br>
<br>
</div>
<div dir="auto" style="direction: ltr; margin: 0; padding: 0; font-family: sans-serif; font-size: 11pt; color: black; ">
<span id="OutlookSignature">
<div dir="auto" style="direction: ltr; margin: 0; padding: 0; font-family: sans-serif; font-size: 11pt; color: black; ">
Toby Isaac, Assistant Professor, GTCSE</div>
</span><br>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> petsc-users <petsc-users-bounces@mcs.anl.gov> on behalf of Park, Heeho via petsc-users <petsc-users@mcs.anl.gov><br>
<b>Sent:</b> Thursday, April 9, 2020 3:39:19 PM<br>
<b>To:</b> petsc-users@mcs.anl.gov <petsc-users@mcs.anl.gov><br>
<b>Subject:</b> [petsc-users] J^T J p calculation</font>
<div> </div>
</div>
<style type="text/css" style="display:none">
<!--
p
{margin-top:0px;
margin-bottom:0px}
-->
</style>
<div 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="x_Signature">
<div name="x_divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div class="x_BodyFragment">
<div class="x_PlainText">Heeho Daniel Park<br>
<br>
! ------------------------------------ !<br>
Sandia National Laboratories</div>
<div class="x_PlainText" style="">Org: 08844, R&D</div>
<div class="x_PlainText" style="">Work: 505-844-1319<br>
! ------------------------------------ !<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>