Skip to content

Commit

Permalink
Updates for numpy 2 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelClerx committed Jun 17, 2024
1 parent 3f2f153 commit 0300eab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pints/_optimisers/_nelder_mead.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,15 @@ def ask(self):
self._xs[1 + i][i] *= x_grow

# Ask for initial points
return np.array(self._xs, copy=True)
return np.copy(self._xs)

# Shrink operation
if self._shrink:
for i in range(self._n_parameters):
self._xs[1 + i] = \
self._xs[0] + self._ys * (self._xs[1 + i] - self._xs[0])

return np.array(self._xs[1:], copy=True)
return np.copy(self._xs[1:])

# Start of normal iteration, ask for reflection point
if self._xr is None:
Expand Down Expand Up @@ -240,7 +240,7 @@ def tell(self, fx):

# Initialise
if self._fs is None:
fx = np.array(fx, copy=True)
fx = np.copy(fx)
if np.prod(fx.shape) != self._n_parameters + 1:
raise ValueError(
'Expecting a vector of length (1 + n_parameters).')
Expand All @@ -251,7 +251,7 @@ def tell(self, fx):

# Shrink
if self._shrink:
fx = np.array(fx, copy=False)
fx = np.asarray(fx)
if np.prod(fx.shape) != self._n_parameters:
raise ValueError(
'Expecting a vector of length n_parameters.')
Expand Down

0 comments on commit 0300eab

Please sign in to comment.