[petsc-users] zero pattern of result of matmatmult

Jed Brown jedbrown at mcs.anl.gov
Thu Sep 5 11:03:51 CDT 2013


Frederik Treue <frtr at fysik.dtu.dk> writes:

> Is it somehow possible to restrict the nonzero pattern of the result of
> matmatmult, ie. can I get petsc to only consider a subset of the
> elements of the result matrix, if I know the rest are going to be zero? 

If I understand correctly, you don't want to allocate for entries that
are *computed* to be 0.0 in the product matrix?  Is this a real
scenario?  Multiplying difference operators together is really brittle
(boundary conditions, geometry, etc) and uses more memory than
necessary.

> Example: I have a backward and forward first order finite difference
> differentiation matrix, ie.
> B_(i,i-1)=-1/dx		B_(i,i)=1/dx
> and
> F_(i,i)=-1/dx		F_(i,i+1)=1/dx
> If I make the product B*F I should get the centered 2nd order
> differentiation matrix, ie.
> P_(i,i-1)=1/dx^2        P_(i,i)=-2/dx^2      P_(i,i+1)1/dx^2
> and I do, but petsc allocates 5 entries points in each row, if I had 3
> in both B and F, since P_(i,i-2) and P_(i,i+2) _might_ have been
> nonzero, but ofcourse they never are. Can I get petsc to stop allocating
> more than 3 entries per row in P?
>
> /Frederik Treue
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130905/8c0397be/attachment.pgp>


More information about the petsc-users mailing list