<div dir="ltr"><div><div>So Jed, what you are suggesting is that I should set only the non-zero elements while using <br>
<b> MatSetValues(A,(high-low),</b><b>idxm,nc,idxn,values,INSERT_</b><b>VALUES);<br><br></b></div>And not mention the zero elements and for that I should loop over all local rows and then set each of the value.<br><br></div>Thanks<br><br>----<br>John Albequerque.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 19, 2016 at 7:43 PM, Jed Brown <span dir="ltr"><<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">John Albequerque <<a href="mailto:johncfdcfd@gmail.com">johncfdcfd@gmail.com</a>> writes:<br>
<br>
> I am really sorry Matthew but I am not able to get your point. It would be<br>
> very kind of you if you could show me the changes in the code.<br>
<br>
</span>MatSetValues sets a logically dense block. It's not a list of values in<br>
COO format. So this is setting a (high-low)*nc dense block (which<br>
includes explicit zeros):<br>
<br>
MatSetValues(A,(high-low),idxm,nc,idxn,values,INSERT_VALUES);<br>
<br>
You can see those stored zeros here:<br>
<br>
>>> *Mat Object: 1 MPI processes type: mpiaijrow 0: (0, 1) (1, 1) (2, 1)<br>
<span class="">>>> (3, 1) (4, 0) (5, 0) (6, 0) (7, 0) row 1: (0, 0) (1, 1) (2, 1) (3,<br>
>>> 1) (4, 1) (5, 0) (6, 0) (7, 0) row 2: (0, 0) (1, 0) (2, 1) (3, 1)<br>
>>> (4, 1) (5, 1) (6, 0) (7, 0) row 3: (0, 0) (1, 0) (2, 0) (3, 1) (4,<br>
>>> 1) (5, 1) (6, 1) (7, 0) row 4: (0, 0) (1, 0) (2, 0) (3, 0) (4, 1)<br>
</span>>>> (5, 1) (6, 1) (7, 1)*<br>
<br>
You need to allocate for all entries that you set explicitly.<br>
</blockquote></div><br></div>