[petsc-users] PETSc random number generator

Barry Smith bsmith at mcs.anl.gov
Thu Sep 3 10:48:28 CDT 2015


> On Sep 3, 2015, at 10:11 AM, Xujun Zhao <xzhao99 at gmail.com> wrote:
> 
> Hi all,
> 
> I need random Vectors with both Gaussian distribution and uniform distribution. I notice that PETSc has VecSetRandom() function. I am curious what types of distribution this function can generate. Thank you for your answer.

  Currently we have only uniform.

  I recommend using another library for the Gaussian and using VecGetArray() plus VecGetLocalSize() to loop over local entries putting in your random numbers.

   Barry

> 
> Xujun



More information about the petsc-users mailing list