<div dir="ltr"><div dir="ltr">On Mon, May 24, 2021 at 9:19 PM Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</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"><div dir="ltr">On Mon, May 24, 2021 at 9:08 PM Salazar De Troya, Miguel via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">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 lang="EN-US">
<div>
<p class="MsoNormal"><span style="font-size:11pt;color:black">Hello,</span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;color:black"> </span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;color:black">I am simply interested in obtaining a vector with x_i = \sum_j | A_{i, j} | for each row “i” in the matrix A. I found MatGetColumnNorms(), but no row version. I am wondering if it is more efficient
to calculate the transpose A^T and then MatGetColumnNorms() or maybe iterate through each row with MatGetRow() and calculate \sum_j | A_{i, j} | by hand by myself.</span></p></div></div></blockquote><div><br></div><div>Vec ones, sums;</div><div><br></div><div>MatCreateVecs(A, &ones, &sums);</div><div>VecSet(ones, 1.0);</div><div>MatMult(A, ones, sums);</div><div>VecDestroy(&ones);</div><div>VecDestroy(&sums);</div></div></div></blockquote><div><br></div><div>This does the row sum, not the absolute value. If you want the absolute value, you can just call MatGetRow() and sum the values.</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"><div class="gmail_quote"><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 lang="EN-US"><div><p class="MsoNormal"><span style="color:black;font-size:11pt"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;color:black">Thanks</span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;color:black">Miguel</span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Consolas;color:black">Miguel A. Salazar de Troya</span><span style="font-size:10.5pt;color:black"><u></u><u></u></span></p>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Consolas;color:black">Postdoctoral Researcher, Lawrence Livermore National Laboratory</span><span style="font-size:10.5pt;color:black"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Consolas;color:black">B141</span><span style="font-size:10.5pt;color:black"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Consolas;color:black">Rm: 1085-5</span><span style="font-size:10.5pt;color:black"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Consolas;color:black">Ph: 1(925) 422-6411</span><u></u><u></u></p>
</div>
</div>
</div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><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>
</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>