Skip to content

Commit

Permalink
TST: Adapt to __array__(copy=True)
Browse files Browse the repository at this point in the history
[skip circle]
  • Loading branch information
thalassemia committed Apr 19, 2024
1 parent 561376c commit b4be3c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions scipy/linalg/_testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def __init__(self, data):
self._data = data

def __array__(self, dtype=None, copy=None):
if copy:
return self._data.copy()
return self._data


Expand Down
3 changes: 2 additions & 1 deletion scipy/optimize/_nonlin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import scipy.sparse.linalg
import scipy.sparse
from scipy.linalg import get_blas_funcs
from scipy._lib._util import copy_if_needed
from scipy._lib._util import getfullargspec_no_self as _getfullargspec
from ._linesearch import scalar_search_wolfe1, scalar_search_armijo

Expand Down Expand Up @@ -701,7 +702,7 @@ def __array__(self, dtype=None, copy=None):

def collapse(self):
"""Collapse the low-rank matrix to a full-rank one."""
self.collapsed = np.array(self)
self.collapsed = np.array(self, copy=copy_if_needed)
self.cs = None
self.ds = None
self.alpha = None
Expand Down

0 comments on commit b4be3c9

Please sign in to comment.