From def41961d9c7965e8a5ad4ca62115633b7c025cb Mon Sep 17 00:00:00 2001 From: tommoral Date: Sun, 30 Jun 2024 12:07:16 +0200 Subject: [PATCH 1/3] FIX np.NaN is not available anymore in numpy2.0 --- copt/proximal_gradient.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copt/proximal_gradient.py b/copt/proximal_gradient.py index 3e1fab0c..b7acfc33 100644 --- a/copt/proximal_gradient.py +++ b/copt/proximal_gradient.py @@ -121,7 +121,7 @@ def _prox(x, _): prox = _prox success = False - certificate = np.NaN + certificate = np.nan func_and_grad = utils.build_func_grad(jac, fun, args, eps) From 567a0d5b5ad565d2d47af64ed4b2037a91b42dd2 Mon Sep 17 00:00:00 2001 From: tommoral Date: Sun, 30 Jun 2024 12:16:05 +0200 Subject: [PATCH 2/3] FIX np.infty->np.inf --- copt/constraint.py | 2 +- copt/splitting.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/copt/constraint.py b/copt/constraint.py index 989e1306..c6990ac8 100644 --- a/copt/constraint.py +++ b/copt/constraint.py @@ -76,7 +76,7 @@ def __call__(self, x): if np.abs(x).sum() <= self.alpha: return 0 else: - return np.infty + return np.inf def prox(self, x, step_size=None): """Projection onto the L-infinity ball. diff --git a/copt/splitting.py b/copt/splitting.py index 8b26026a..c8ca10a9 100644 --- a/copt/splitting.py +++ b/copt/splitting.py @@ -288,7 +288,7 @@ def prox_2_conj(x, ss): ss_ratio = tau / sigma fk, grad_fk = f_grad(x) - norm_incr = np.infty + norm_incr = np.inf x_next = x.copy() for it in range(max_iter): From cfb16a741567fbd4ccfe7ee43ac9c5607c804993 Mon Sep 17 00:00:00 2001 From: Thomas Moreau Date: Sun, 30 Jun 2024 19:12:55 +0200 Subject: [PATCH 3/3] Update utils.py --- copt/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copt/utils.py b/copt/utils.py index 70284aaf..7f6be720 100644 --- a/copt/utils.py +++ b/copt/utils.py @@ -35,7 +35,7 @@ def wrapper(*args, **kwargs): def build_func_grad(jac, fun, args, eps): if not callable(jac): if bool(jac): - fun = optimize.optimize.MemoizeJac(fun) + fun = optimize._optimize.MemoizeJac(fun) jac = fun.derivative elif jac == "2-point": jac = None