Skip to content

Commit

Permalink
bug fix for 32bit Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
andim committed Nov 20, 2019
1 parent 91a748f commit 625b874
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion noisyopt/main.py
Expand Up @@ -332,7 +332,9 @@ def funcf(x, **kwargs):
Deltak = np.random.choice([-1, 1], size=N)
fkwargs = dict()
if paired:
fkwargs['seed'] = np.random.randint(0, np.iinfo(np.uint32).max)
# upper bound needs to be set to signed 32-bit integer
# see https://github.com/numpy/numpy/issues/4085#issuecomment-29570567
fkwargs['seed'] = np.random.randint(0, np.iinfo(np.int32).max)
if bounds is None:
grad = (funcf(x + ck*Deltak, **fkwargs) - funcf(x - ck*Deltak, **fkwargs)) / (2*ck*Deltak)
x -= ak*grad
Expand Down

0 comments on commit 625b874

Please sign in to comment.