initial values of matrix and vector

Matthew Knepley knepley at
Tue Feb 24 06:53:58 CST 2009

On Mon, Feb 23, 2009 at 8:26 PM, Barry Smith <bsmith at> wrote:

>   Vectors have all entries equal to zero. Dense matrices have all entries
> equal to zero. Sparse matrices have no entries (logically this is the same
> as entries equal to zero).

We do not automatically zero the entires upon allocation. You have to call
VecZeroEntries() or VecSet()
to initialize the vector.


>   Barry
> On Feb 23, 2009, at 8:24 PM, Yixun Liu wrote:
>  Hi,
>> What's the initial value when I create a matrix or vector?
>> Thanks.
> --
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the petsc-users mailing list