PetscRandomGetValue(), PetscRandomGetValueReal(), PetscRandomGetValueImaginary()

Barry Smith bsmith at
Mon Oct 26 15:19:57 CDT 2009

    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?


More information about the petsc-dev mailing list