<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Hello,<br></div><div class="gmail_default" style="font-family:verdana,sans-serif">I am a beginner at PETSc, so please excuse for such a trivial doubt. I am writing a program to learn about PETSc vectors. So in the process I thought to write a small program to learn about initializing and accessing vectors, which creates vectors with size `rank+1' where rank is initialized using `MPI_Comm_rank (PETSC_COMM_WORLD, &rank);`. And, then simply I looped thorugh all the elements to get the sum. But as can seen in the output(attached), it is returning "junk" values.<br><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Source Code:- <a href="http://pastebin.com/Swku7A3X">http://pastebin.com/Swku7A3X</a><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Output:- <a href="http://pastebin.com/paSWnFwz">http://pastebin.com/paSWnFwz</a><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br><br>Thanks,<br clear="all"></div><div><div class="gmail_signature"><div dir="ltr"><font color="#888888"><div dir="ltr"><font color="#000000" face="georgia, serif"><i>Kaushik<br></i></font></div></font></div></div></div>
</div>