[petsc-dev] strangness in Chebyshev estimate of eigenvalues
Jed Brown
jed at jedbrown.org
Tue May 17 14:49:07 CDT 2016
Matthew Knepley <knepley at gmail.com> writes:
> On Tue, May 17, 2016 at 2:27 PM, Mark Adams <mfadams at lbl.gov> 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).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20160517/c2230ee4/attachment.sig>
More information about the petsc-dev
mailing list