[petsc-users] zero pattern of result of matmatmult

Frederik Treue frtr at fysik.dtu.dk
Thu Sep 5 10:47:14 CDT 2013


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? 

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



More information about the petsc-users mailing list