[petsc-users] Off-diagonal matrix-vector product y=(A-diag(A))x

Ingo Gaertner ingogaertner.tus at gmail.com
Fri Apr 14 15:38:48 CDT 2017

I have 2*ndim+1 entries per row (including the diagonal).
In 2 dimensions, the suggested solution is 6 multiplications + 5 additions
= 11 flops per row.
The optimized solution is 4 multiplications + 3 additions = 7 flops per row.
I call this significant.



2017-04-14 16:50 GMT+02:00 Jed Brown <jed at jedbrown.org>:

> Ingo Gaertner <ingogaertner.tus at gmail.com> writes:
> > Does PETSc include an efficient implementation for the operation
> > y=(A-diag(A))x or y_i=\sum_{j!=i}A_{ij}x_j on a sparse matrix A?
> >
> > In words, I need a matrix-vector product after the matrix diagonal has
> been
> > set to zero. For efficiency reasons I can't copy and modify the matrix or
> > first calculate the full product and then subtract the diagonal
> > contribution.
> How many entries per row in your matrix?  There isn't a special function
> for this, but I'm skeptical that the performance gains of a custom
> implementation would be significant.  Do you have a profile showing that
> it is?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170414/e06d6db8/attachment.html>

More information about the petsc-users mailing list