PetscRandomGetValue(), PetscRandomGetValueReal(), PetscRandomGetValueImaginary()

Matthew Knepley knepley at
Mon Oct 26 15:22:19 CDT 2009

I am fine with that as long as the doc is clear.


On Mon, Oct 26, 2009 at 3:19 PM, Barry Smith <bsmith at> wrote:

>   There is a lack of symmetry in the meaning of PetscRandomGetValueReal()
> and PetscRandomGetValueImaginary(). The real returns a PetscReal with a
> random value in it. The imaginary returns a complex number with zero real
> part and some imaginary part.
>   I have changed PetscRandomSetInterval() to allow the real or imaginary
> part of the interval to be zero.
>   Thus one can get pure real complex numbers by setting the complex part of
> low to high and get pure imaginary complex numbers by setting the real part
> of low to high.
>    Then we can eliminate PetscRandomGetValueImaginary(). I dislike it
> (since it is ugly, has no real equivalent version (for example to get a
> random number that is zero in the imaginary part I need to call
> PetscRandomGetValueReal() and then stick that real value into a complex
> number.))
>    What do you think?
>   Barry

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-dev mailing list