[petsc-users] Doubt in MPIPreallocation

John Albequerque johncfdcfd at gmail.com
Fri Feb 19 08:25:07 CST 2016


So Jed, what you are suggesting is that I should set only the non-zero
elements while using
*  MatSetValues(A,(high-low),**idxm,nc,idxn,values,INSERT_*

*VALUES);*
And not mention the zero elements and for that I should loop over all local
rows and then set each of the value.

Thanks

----
John Albequerque.

On Fri, Feb 19, 2016 at 7:43 PM, Jed Brown <jed at jedbrown.org> wrote:

> John Albequerque <johncfdcfd at gmail.com> writes:
>
> > I am really sorry Matthew but I am not able to get your point. It would
> be
> > very kind of you if you could show me the changes in the code.
>
> MatSetValues sets a logically dense block.  It's not a list of values in
> COO format.  So this is setting a (high-low)*nc dense block (which
> includes explicit zeros):
>
>   MatSetValues(A,(high-low),idxm,nc,idxn,values,INSERT_VALUES);
>
> You can see those stored zeros here:
>
> >>> *Mat Object: 1 MPI processes  type: mpiaijrow 0: (0, 1)  (1, 1)  (2, 1)
> >>> (3, 1)  (4, 0)  (5, 0)  (6, 0)  (7, 0) row 1: (0, 0)  (1, 1)  (2, 1)
> (3,
> >>> 1)  (4, 1)  (5, 0)  (6, 0)  (7, 0) row 2: (0, 0)  (1, 0)  (2, 1)  (3,
> 1)
> >>> (4, 1)  (5, 1)  (6, 0)  (7, 0) row 3: (0, 0)  (1, 0)  (2, 0)  (3, 1)
> (4,
> >>> 1)  (5, 1)  (6, 1)  (7, 0) row 4: (0, 0)  (1, 0)  (2, 0)  (3, 0)  (4,
> 1)
> >>> (5, 1)  (6, 1)  (7, 1)*
>
> You need to allocate for all entries that you set explicitly.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160219/271420c6/attachment.html>


More information about the petsc-users mailing list