Skip to content

Commit a2ab3cf

Browse files
committed
Removing np.float and np.int usage
1 parent 1267e69 commit a2ab3cf

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

dfols/hessian.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Hessian(object):
3939
def __init__(self, n, vals=None):
4040
self.n = n
4141
if vals is None:
42-
self.hq = np.zeros((n * (n + 1) // 2,), dtype=np.float)
42+
self.hq = np.zeros((n * (n + 1) // 2,), dtype=float)
4343
else:
4444
assert isinstance(vals, np.ndarray), "Can only set Hessian from NumPy array"
4545
assert len(vals.shape) in [1, 2], "Can only set Hessian from vector or matrix"

dfols/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __init__(self, npt, x0, r0, xl, xu, r0_nsamples, n=None, m=None, abs_tol=1e-
7171
self.fval = np.inf * np.ones((npt, )) # overall objective value for each xpt
7272
self.fval[0] = sumsq(r0)
7373
self.kopt = 0 # index of current iterate (should be best value so far)
74-
self.nsamples = np.zeros((npt,), dtype=np.int) # number of samples used to evaluate objective at each point
74+
self.nsamples = np.zeros((npt,), dtype=int) # number of samples used to evaluate objective at each point
7575
self.nsamples[0] = r0_nsamples
7676
self.fbeg = self.fval[0] # f(x0), saved to check for sufficient reduction
7777

dfols/solver.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ def solve_main(objfun, x0, args, xl, xu, npt, rhobeg, rhoend, maxfun, nruns_so_f
852852

853853
def solve(objfun, x0, args=(), bounds=None, npt=None, rhobeg=None, rhoend=1e-8, maxfun=None, nsamples=None, user_params=None,
854854
objfun_has_noise=False, scaling_within_bounds=False, do_logging=True, print_progress=False):
855-
x0 = x0.astype(np.float)
855+
x0 = x0.astype(np.float64)
856856
n = len(x0)
857857

858858
# Set missing inputs (if not specified) to some sensible defaults
@@ -861,8 +861,8 @@ def solve(objfun, x0, args=(), bounds=None, npt=None, rhobeg=None, rhoend=1e-8,
861861
xu = None
862862
else:
863863
assert len(bounds) == 2, "bounds must be a 2-tuple of (lower, upper), where both are arrays of size(x0)"
864-
xl = bounds[0].astype(np.float) if bounds[0] is not None else None
865-
xu = bounds[1].astype(np.float) if bounds[1] is not None else None
864+
xl = bounds[0].astype(np.float64) if bounds[0] is not None else None
865+
xu = bounds[1].astype(np.float64) if bounds[1] is not None else None
866866

867867
if (xl is None or xu is None) and scaling_within_bounds:
868868
scaling_within_bounds = False

dfols/trust_region.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def trsbox(xopt, g, H, sl, su, delta, use_fortran=USE_FORTRAN):
103103
iterc = 0
104104
nact = 0 # number of fixed variables
105105

106-
xbdi = np.zeros((n,), dtype=np.int) # fix x_i at bounds? [values -1, 0, 1]
106+
xbdi = np.zeros((n,), dtype=int) # fix x_i at bounds? [values -1, 0, 1]
107107
xbdi[(xopt <= sl) & (g >= 0.0)] = -1
108108
xbdi[(xopt >= su) & (g <= 0.0)] = 1
109109

0 commit comments

Comments
 (0)