<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div dir="ltr">
<div dir="ltr"><br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, Mar 4, 2019 at 10:39 AM Matthew Knepley via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br>
</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 dir="ltr">On Mon, Mar 4, 2019 at 11:28 AM Cyrill Vonplanta 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">
Dear Petsc Users,<br>
<br>
I am trying to implement a variant of the $l^1$-Gauss-Seidel smoother from <a href="https://doi.org/10.1137/100798806" rel="noreferrer" target="_blank">
https://doi.org/10.1137/100798806</a> (eq. 6.1 and below). One of the main issues is that I need to compute the sum  $\sum_j |a_{i_j}|$ of the matrix entries that are not part of the local diagonal block. I was looking for something like MatGetRowSumAbs but
 it looks like it hasn't been made yet.<br>
<br>
I guess i have to come up with something myself, but would you know of some workaround for this without going too deep into PETCs?<br>
</blockquote>
<div><br>
</div>
<div>MatGetOwnershipRange(A, &rS, &rE);</div>
<div>for (r = rS; r < rE; ++r) {</div>
<div>  sum = 0.0;</div>
<div>  MatGetRow(A, r, &ncols, &cols, &vals);</div>
<div>  for (c = 0; c < ncols; ++c) if ((cols[c] < rS) || (cols[c] >= rE)) sum += PetscAbsScalar(vals[c]);</div>
<div>}</div>
</div>
</div>
</blockquote>
<div>Perhaps PETSc should have a MatGetRemoteRow (or MatGetRowOffDiagonalBlock) (A, r, &ncols, &cols, &vals).  MatGetRow() internally has to allocate memory and sort indices and values from local diagonal block and off-diagonal block. It is totally a waste
 in this case -- users do not care column indices and the local block.  With MatGetRemoteRow(A, r, &ncols, NULL, &vals), PETSc just needs to set an integer and a pointer. </div>
<div> <br>
</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><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">
Best Cyrill<br>
</blockquote>
</div>
-- <br>
<div dir="ltr" class="gmail-m_-6436966058077462003gmail_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>
</blockquote>
</div>
</div>
</body>
</html>