Skip to content

Commit adbfd94

Browse files
committed
Force input arrays to np.float dtype
1 parent 4150f84 commit adbfd94

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pybobyqa/solver.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,8 @@ def solve(objfun, x0, args=(), bounds=None, npt=None, rhobeg=None, rhoend=1e-8,
642642
n = len(x0)
643643
if type(x0) == list:
644644
x0 = np.array(x0, dtype=np.float)
645+
else:
646+
x0 = x0.astype(np.float)
645647

646648
# Set missing inputs (if not specified) to some sensible defaults
647649
if bounds is None:
@@ -653,9 +655,13 @@ def solve(objfun, x0, args=(), bounds=None, npt=None, rhobeg=None, rhoend=1e-8,
653655
xl = bounds[0]
654656
if type(xl) == list:
655657
xl = np.array(xl, dtype=np.float)
658+
else:
659+
xl = xl.astype(np.float)
656660
xu = bounds[1]
657661
if type(xu) == list:
658662
xu = np.array(xu, dtype=np.float)
663+
else:
664+
xu = xu.astype(np.float)
659665

660666
exit_info = None
661667
if seek_global_minimum and (xl is None or xu is None):

0 commit comments

Comments
 (0)