[petsc-users] VecGetValues not working.
Dave May
dave.mayhem23 at gmail.com
Sun Feb 7 06:58:38 CST 2016
On Sunday, 7 February 2016, Kaushik Kulkarni <kaushikggg at gmail.com> wrote:
> Hello,
> 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.
>
Your call to printf is treating Y[i] as an integer (%d) when it should be
be using a specifier for a floating point number , eg %1.4e
> Source Code:- http://pastebin.com/Swku7A3X
> Output:- http://pastebin.com/paSWnFwz
>
>
> Thanks,
>
> *Kaushik*
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160207/800b7b45/attachment.html>
More information about the petsc-users
mailing list