<div dir="ltr"><div><div><div><div><div>I have 2*ndim+1 entries per row (including the diagonal).<br></div>In 2 dimensions, the suggested solution is 6 multiplications + 5 additions = 11 flops per row.<br></div>The optimized solution is 4 multiplications + 3 additions = 7 flops per row.<br></div>I call this significant.<br><br></div>Thanks<br></div>Ingo<br><br></div><div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br> <table style="border-top:1px solid #d3d4de">
<tr>
<td style="width:55px;padding-top:18px"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" width="46" height="29" style="width: 46px; height: 29px;"></a></td>
<td style="width:470px;padding-top:17px;color:#41424e;font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px">Virenfrei. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" target="_blank" style="color:#4453ea">www.avast.com</a> </td>
</tr>
</table>
<a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"></a></div><div class="gmail_extra"><br><div class="gmail_quote">2017-04-14 16:50 GMT+02:00 Jed Brown <span dir="ltr"><<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Ingo Gaertner <<a href="mailto:ingogaertner.tus@gmail.com">ingogaertner.tus@gmail.com</a>> writes:<br>
<br>
> Does PETSc include an efficient implementation for the operation<br>
> y=(A-diag(A))x or y_i=\sum_{j!=i}A_{ij}x_j on a sparse matrix A?<br>
><br>
> In words, I need a matrix-vector product after the matrix diagonal has been<br>
> set to zero. For efficiency reasons I can't copy and modify the matrix or<br>
> first calculate the full product and then subtract the diagonal<br>
> contribution.<br>
<br>
</span>How many entries per row in your matrix? There isn't a special function<br>
for this, but I'm skeptical that the performance gains of a custom<br>
implementation would be significant. Do you have a profile showing that<br>
it is?<br>
</blockquote></div><br></div>