[petsc-users] zero pattern of result of matmatmult

Frederik Treue frtr at fysik.dtu.dk
Fri Sep 6 04:51:27 CDT 2013


Resending to mail-list, sorry about the double post, Jed.

PS. is there a reason why the listserver doesn't set the Reply-To header field?

/Frederik Treue

On Thu, 2013-09-05 at 09:03 -0700, Jed Brown wrote:
> 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?

Yes, exactly - It's a mathematical identity that most of the entries in
the product matrix is zero. I can't specify my operators beforehand, as
they depend on the fields that I'm solving for. 

>   Multiplying difference operators together is really brittle
> (boundary conditions, geometry, etc) and uses more memory than
> necessary.

Why? Ofcourse, it could go wrong if you get the non-zero pattern of the
product matrix wrong, but that's the same as with all other instances of
SAME_NONZERO_PATTERN throughout petsc. Why is this one special?

Anyway, is there, as an alternative, a mat copy that doesn't reallocate
the matrix? If I use the standard MatCopy, the stencil size of the
resulting matrix seems to be the same as the original, regardless of how
I've allocated the target matrix.

/Frederik Treue




More information about the petsc-users mailing list