[petsc-users] matrix-matrix addition

Boyce Griffith griffith at cims.nyu.edu
Mon Sep 27 00:56:03 CDT 2010


I am trying to compute a matrix A that is of the form:

    A = B + P^t C P

using MatPtAP and MatAXPY.  The call to MatAXPY is very slow --- 
presumably because I haven't allocated the correct nonzero structure.  I 
can easily determine the nonzero structures of B, C, and P, but I do not 
think that I can easily compute the nonzero structure of P^t C P 
(although I can compute its nonzero structure with some difficulty).

Is it possible to add extra non-zero locations to an existing matrix? 
Or should I try to extract the nonzero structures of B and P^t C P to 
pre-allocate A correctly?  (Or am I overlooking some functionality in 
PETSc that will do most of this for me?)

A tangentially related question is: is there any way to find out the 
actual fill (or fill ratio) following a call to MatPtAP?

Thanks in advance for any suggestions!

-- Boyce


More information about the petsc-users mailing list