[petsc-dev] strangness in Chebyshev estimate of eigenvalues

Mark Adams mfadams at lbl.gov
Tue May 17 14:53:55 CDT 2016


Why not just set each index with hash(i) = (i >> 32)^i and forget
VecSetRandom in here? This does not have to be perfectly decorrelated. Just
not perfectly correlated.

{
  PetscErrorCode ierr;
  PetscInt       n = xin->map->n,i;
  PetscScalar    *xx;

  PetscFunctionBegin;
  ierr = VecGetArray(xin,&xx);CHKERRQ(ierr);
  for (i=0; i<n; i++) xx[i] = hash(i+start);
  ierr = VecRestoreArray(xin,&xx);CHKERRQ(ierr);
  PetscFunctionReturn(0);
}

On Tue, May 17, 2016 at 3:41 PM, Matthew Knepley <knepley at gmail.com> wrote:

> On Tue, May 17, 2016 at 2:34 PM, Jed Brown <jed at jedbrown.org> wrote:
>
>> Matthew Knepley <knepley at gmail.com> writes:
>> > Should we just make this another Random implementation which is only for
>> > testing?
>>
>> The problem is that we want to produce the same numbers on one process
>> and on many processes.  The interface doesn't really afford that because
>> it provides a stream of numbers.  If we know the number of entries we're
>> about to ask for on each process, we could do a Scan to find the
>> starting index and "seed" with that, where drawing a number hashes and
>> increments the counter.  But this is pretty contorted.
>>
>
> It seems like we should do double dispatch for VecSetRandom().
>
>    Matt
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20160517/2dbe9e5e/attachment.html>


More information about the petsc-dev mailing list