On Thu, Aug 9, 2012 at 9:53 PM, Yifei Li <span dir="ltr"><<a href="mailto:yifli82@gmail.com" target="_blank">yifli82@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Matt,</div><div><br></div>Thanks.  I have another two related questions:<div>1) So just because I did not get the correct value doesn't mean the symmetric matrix is not setup correctly?</div></blockquote><div><br>
</div><div>Right.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>2) Which function should I use to retrieve the value then? I can't get the correct value even though I disabled MPI when  building PETSC?</div>
</blockquote><div><br></div><div>Since it would require communication, there is no easy way to do this. Why would you need this?</div><div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Yifei<br><div><br></div><div><br><br><div class="gmail_quote">On Thu, Aug 9, 2012 at 8:45 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>On Thu, Aug 9, 2012 at 5:20 PM, Yifei Li <span dir="ltr"><<a href="mailto:yifli82@gmail.com" target="_blank">yifli82@gmail.com</a>></span> wrote:<br>

</div></div><div class="gmail_quote"><div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Hi all,</div>
<div> </div>
<div>I only filled the entries in the upper triangular part of the matrix, however, I got  0 when I tried to get the value of some entry in the lower triangular part.</div>
<div> </div>
<div>Here's how I do it:</div>
<div> </div>
<div><font>
<p>MatCreate(PETSC_COMM_WORLD, &A); </p>
<p>MatSetSizes(A, PETSC_DECIDE, PETSC_DECIDE, n, n); </p>
<p>MatSetType(A, MATSEQSBAIJ); </p>
<p>MatSetUp(A); </p>
<p>// I set the value for the entry at (0, 2)</p><font>
<p>int i = 2, j = 0;</p>
<p>MatGetValues(A,1,&i,1,&j,values);</p></font></font></div></blockquote></div></div><div>MatGetValues() is not synchronous, so it would not be able to communicate to the</div><div>correct process to retrieve the values. Thus, you cannot retrieve the lower triangle.</div>


<div>This is analogous to only having access to local values with VecGetArray().</div><div><br></div><div>   Matt</div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><font><font>
<p>Any help is highly appreicated.</p><span><font color="#888888">
<p> </p>
<p>Yifei</p></font></span></font></font></div>
</blockquote></div></div><span><font color="#888888"><br><br clear="all"><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>


-- Norbert Wiener<br>
</font></span></font></span></blockquote></div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener<br>