[petsc-users] matrix-matrix addition

Matthew Knepley knepley at gmail.com
Mon Sep 27 07:57:22 CDT 2010


The easiest way I can think of to handle this is to make P^T C P, then
extract the nonzero
structure with Mat with GetIJ() and create B. You would have to explicitly
put zeros in B
too or else AssemblyEnd() will shrink it. Maybe someone else can think of an
easier way.

     Matt

On Mon, Sep 27, 2010 at 1:56 AM, Boyce Griffith <griffith at cims.nyu.edu>wrote:

> 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
>



-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20100927/1866a877/attachment.htm>


More information about the petsc-users mailing list