Matthew Knepley <[email protected]> writes: > On Tue, May 17, 2016 at 2:27 PM, Mark Adams <[email protected]> wrote: > >> Other than set userandom = PETSC_TRUE, should I do anything else? >> >> I see: >> >> ierr = VecSetRandom(B,cheb->random);CHKERRQ(ierr); >> >> Should I use a special one or change this default to the special one? >> > > I think Jed means this: > > Make a special implementation of PetscRandom. The VecSetRandom() function > will > assign to each row > > v(r) = hash(r)
That's what I want, but it won't work with VecSetRandom as currently
implemented. This function is called by both Seq and MPI Vecs:
PetscErrorCode VecSetRandom_Seq(Vec xin,PetscRandom r)
{
PetscErrorCode ierr;
PetscInt n = xin->map->n,i;
PetscScalar *xx;
PetscFunctionBegin;
ierr = VecGetArray(xin,&xx);CHKERRQ(ierr);
for (i=0; i<n; i++) {ierr = PetscRandomGetValue(r,&xx[i]);CHKERRQ(ierr);}
ierr = VecRestoreArray(xin,&xx);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
The global index is not available to the PetscRandom so we can't
implement v(r) = hash(r).
signature.asc
Description: PGP signature
