<div dir="ltr"><div class="gmail_extra">Ah, you're right.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Would you consider this a decent hash?</div><div class="gmail_extra"><br></div><div class="gmail_extra"><span style="color:rgb(80,0,80);font-size:12.8000001907349px">PetscScalar v = ((PetscScalar)((</span><span style="font-size:12.8000001907349px">79943</span><span style="color:rgb(80,0,80);font-size:12.8000001907349px">*idx)%</span>6871<span style="color:rgb(80,0,80);font-size:12.8000001907349px">) - </span>3435.<span style="color:rgb(80,0,80);font-size:12.8000001907349px">)/</span>3435. + <span style="color:rgb(80,0,80);font-size:12.8000001907349px"> ((PetscScalar)((</span>7919<span style="color:rgb(80,0,80);font-size:12.8000001907349px">*idx)%</span>829<span style="color:rgb(80,0,80);font-size:12.8000001907349px">) - </span>415.<span style="color:rgb(80,0,80);font-size:12.8000001907349px">)/</span>415.<span style="color:rgb(80,0,80);font-size:12.8000001907349px">;</span></div><div class="gmail_extra"><br></div><div class="gmail_extra">I thought drand48 has been taken off the table because of Windows. If it's not I can use that.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Mark</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 27, 2015 at 12:48 PM, Jed Brown <span dir="ltr"><<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">Mark Adams <<a href="mailto:mfadams@lbl.gov">mfadams@lbl.gov</a>> writes:<br>
<br>
> My hash function is:<br>
><br>
> PetscScalar v = ((PetscScalar)((PETSC_HASH_FACT*idx)%100) -<br>
> 49.5)/50.0;<br>
> ierr = VecSetValues(bb, 1, &idx, &v,<br>
> INSERT_VALUES);CHKERRQ(ierr);<br>
><br>
><br>
> include/petscctable.h:#define PETSC_HASH_FACT 79943<br>
<br>
</span>Still grid-aligned stripes on a 100xN grid. Please stop it with these<br>
bullshit ad-hoc hash functions. Either use a decent hash function or<br>
drand48.<br>
</blockquote></div><br></div></div>