Ah, you're right.

Would you consider this a decent hash?

PetscScalar v = ((PetscScalar)((79943*idx)%6871) - 3435.)/3435. +
 ((PetscScalar)((7919*idx)%829) - 415.)/415.;

I thought drand48 has been taken off the table because of Windows.  If it's
not I can use that.

Mark


On Thu, Aug 27, 2015 at 12:48 PM, Jed Brown <j...@jedbrown.org> wrote:

> Mark Adams <mfad...@lbl.gov> writes:
>
> > My hash function is:
> >
> >             PetscScalar v = ((PetscScalar)((PETSC_HASH_FACT*idx)%100) -
> > 49.5)/50.0;
> >             ierr = VecSetValues(bb, 1, &idx, &v,
> > INSERT_VALUES);CHKERRQ(ierr);
> >
> >
> > include/petscctable.h:#define PETSC_HASH_FACT 79943
>
> Still grid-aligned stripes on a 100xN grid.  Please stop it with these
> bullshit ad-hoc hash functions.  Either use a decent hash function or
> drand48.
>

Reply via email to