[petsc-users] How to symmetrical the pattern of anunsymmetrical matrix

Matthew Knepley knepley at gmail.com
Sat Jan 29 07:58:48 CST 2011


On Sat, Jan 29, 2011 at 7:27 AM, Gong Ding <gdiso at ustc.edu> wrote:

> OK, I had gather all the pattern of A+A^T by my code.
> Can I call  MatSeqAIJSetPreallocation again for enlarge preallocated
> memory?
> And then I can add 0 to some entry to make the matrix symmetrical.
>

Matrices cannot be resized. You want to move that symmetrization code to
the point where you originally preallocate the matrix (you do not need
values
to do this, so this is fine). Then insert the zeros along with the regular
values.

   Matt


> > 2011/1/26 Gong Ding <gdiso at ustc.edu>
> >
> >> I have unsymmetrical jacobian matrix in MPIAIJ format (it is nearlly
> >> symmetric, I guess). I'd like to pad it to symmetrical pattern by just
> add 0
> >> to corresponding matrix entry, which is required to some matrix
> partition
> >> step.
> >
> >
> > How are you obtaining the matrix?  The best way is to preallocate those
> > extra zeros.
> >
> > A traditional purely algebraic way is to add the transpose (zeroed in
> this
> > case), but transpose is a bad operation to perform in parallel so I would
> > try to avoid it.
> >




-- 
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/20110129/5f45956d/attachment.htm>


More information about the petsc-users mailing list