[petsc-users] matrix-matrix addition

Barry Smith bsmith at mcs.anl.gov
Mon Sep 27 11:34:35 CDT 2010


   Boyce,

   Don't mess with this bad advice. It is just making your live complicated.  Use a fast MatAXPY() either write it yourself or wait for use.

   Barry

On Sep 27, 2010, at 11:30 AM, Boyce Griffith wrote:

> 
> 
> On 9/27/10 10:47 AM, Hong Zhang wrote:
>> Boyce,
>> 
>>> 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.
>> 
>> This is what I would suggest as well.
> 
> It looks like MatGetRowIJ will do the trick for SeqAIJ matrices, but it appears that similar functionality does not exist for MPIAIJ matrices. Is there an approach that you would recommend for the parallel case?
> 
> Thanks!
> 
> -- Boyce



More information about the petsc-users mailing list