#include "petscmat.h" PetscErrorCode MatSetRandom(Mat x,PetscRandom rctx)Logically Collective on Mat
x | - the matrix | |
rctx | - the random number context, formed by PetscRandomCreate(), or NULL and it will create one internally. |
PetscRandomCreate(PETSC_COMM_WORLD,&rctx); MatSetRandom(x,rctx); PetscRandomDestroy(rctx);