diff --git a/doc/release/upcoming_changes/30411.compatibility.rst b/doc/release/upcoming_changes/30411.compatibility.rst new file mode 100644 index 000000000000..c013160272dd --- /dev/null +++ b/doc/release/upcoming_changes/30411.compatibility.rst @@ -0,0 +1,20 @@ +* `linalg.eig` and `linalg.eigvals` always return complex arrays. Previously, the return + values were depening on whether the eigenvalues happen to lie on the real line (which, for + a general, non-symmetric matrix, is not guaranteed). + + The user change depends on your usage: + + - to retain the previous behavior, do + + ``` + w = eigvals(a) + if w.imag == 0: # this is what NumPy used to do + w = w.real + ``` + + - if your matrix is symmetrix/hermitian, use `eigh` and `eigvalsh` instead of `eig` and `eigvals`: + these are guaranteed to return real values. (A common case is covariance matrices, which are + symmetric and positive definite by construction) + + + diff --git a/doc/release/upcoming_changes/30738.deprecation.rst b/doc/release/upcoming_changes/30738.deprecation.rst new file mode 100644 index 000000000000..381117ec84cc --- /dev/null +++ b/doc/release/upcoming_changes/30738.deprecation.rst @@ -0,0 +1,4 @@ +``numpy.ma.round_`` is deprecated +--------------------------------- +``numpy.ma.round_`` is deprecated. +``numpy.ma.round`` can be used as a replacement. diff --git a/doc/release/upcoming_changes/30802.deprecation.rst b/doc/release/upcoming_changes/30802.deprecation.rst new file mode 100644 index 000000000000..82fe6672b885 --- /dev/null +++ b/doc/release/upcoming_changes/30802.deprecation.rst @@ -0,0 +1 @@ +* The ``numpy.char.[as]array`` functions are deprecated. Use an ``numpy.[as]array`` with a string or bytes dtype instead. diff --git a/numpy/_core/defchararray.py b/numpy/_core/defchararray.py index 61274eb1a4a0..5883bb6be5f5 100644 --- a/numpy/_core/defchararray.py +++ b/numpy/_core/defchararray.py @@ -1219,6 +1219,10 @@ def array(obj, itemsize=None, copy=True, unicode=None, order=None): """ Create a `~numpy.char.chararray`. + .. deprecated:: 2.5 + ``chararray`` is deprecated. Use an ``ndarray`` with a string or + bytes dtype instead. + .. note:: This class is provided for numarray backward-compatibility. New code (not concerned with numarray compatibility) should use @@ -1363,6 +1367,10 @@ def asarray(obj, itemsize=None, unicode=None, order=None): Convert the input to a `~numpy.char.chararray`, copying the data only if necessary. + .. deprecated:: 2.5 + ``chararray`` is deprecated. Use an ``ndarray`` with a string or + bytes dtype instead. + Versus a NumPy array of dtype `bytes_` or `str_`, this class adds the following functionality: diff --git a/numpy/_core/defchararray.pyi b/numpy/_core/defchararray.pyi index b339b50c37aa..1fb086a3d451 100644 --- a/numpy/_core/defchararray.pyi +++ b/numpy/_core/defchararray.pyi @@ -661,6 +661,7 @@ def str_len(A: UST_co) -> NDArray[int_]: ... # overload 5 and 6: arbitrary object with unicode=True (-> str_) # overload 7: arbitrary object with unicode=None (default) (-> str_ | bytes_) @overload +@deprecated("numpy.char.array is deprecated and will be removed in a future release.") def array( obj: U_co, itemsize: int | None = None, @@ -669,6 +670,7 @@ def array( order: _OrderKACF = None, ) -> _CharArray[str_]: ... @overload +@deprecated("numpy.char.array is deprecated and will be removed in a future release.") def array( obj: S_co, itemsize: int | None = None, @@ -677,6 +679,7 @@ def array( order: _OrderKACF = None, ) -> _CharArray[bytes_]: ... @overload +@deprecated("numpy.char.array is deprecated and will be removed in a future release.") def array( obj: object, itemsize: int | None, @@ -685,6 +688,7 @@ def array( order: _OrderKACF = None, ) -> _CharArray[bytes_]: ... @overload +@deprecated("numpy.char.array is deprecated and will be removed in a future release.") def array( obj: object, itemsize: int | None = None, @@ -694,6 +698,7 @@ def array( order: _OrderKACF = None, ) -> _CharArray[bytes_]: ... @overload +@deprecated("numpy.char.array is deprecated and will be removed in a future release.") def array( obj: object, itemsize: int | None, @@ -702,6 +707,7 @@ def array( order: _OrderKACF = None, ) -> _CharArray[str_]: ... @overload +@deprecated("numpy.char.array is deprecated and will be removed in a future release.") def array( obj: object, itemsize: int | None = None, @@ -711,6 +717,7 @@ def array( order: _OrderKACF = None, ) -> _CharArray[str_]: ... @overload +@deprecated("numpy.char.array is deprecated and will be removed in a future release.") def array( obj: object, itemsize: int | None = None, @@ -720,6 +727,7 @@ def array( ) -> _CharArray[str_] | _CharArray[bytes_]: ... @overload +@deprecated("numpy.char.asarray is deprecated and will be removed in a future release.") def asarray( obj: U_co, itemsize: int | None = None, @@ -727,6 +735,7 @@ def asarray( order: _OrderKACF = None, ) -> _CharArray[str_]: ... @overload +@deprecated("numpy.char.asarray is deprecated and will be removed in a future release.") def asarray( obj: S_co, itemsize: int | None = None, @@ -734,6 +743,7 @@ def asarray( order: _OrderKACF = None, ) -> _CharArray[bytes_]: ... @overload +@deprecated("numpy.char.asarray is deprecated and will be removed in a future release.") def asarray( obj: object, itemsize: int | None, @@ -741,6 +751,7 @@ def asarray( order: _OrderKACF = None, ) -> _CharArray[bytes_]: ... @overload +@deprecated("numpy.char.asarray is deprecated and will be removed in a future release.") def asarray( obj: object, itemsize: int | None = None, @@ -749,6 +760,7 @@ def asarray( order: _OrderKACF = None, ) -> _CharArray[bytes_]: ... @overload +@deprecated("numpy.char.asarray is deprecated and will be removed in a future release.") def asarray( obj: object, itemsize: int | None, @@ -756,6 +768,7 @@ def asarray( order: _OrderKACF = None, ) -> _CharArray[str_]: ... @overload +@deprecated("numpy.char.asarray is deprecated and will be removed in a future release.") def asarray( obj: object, itemsize: int | None = None, @@ -764,6 +777,7 @@ def asarray( order: _OrderKACF = None, ) -> _CharArray[str_]: ... @overload +@deprecated("numpy.char.asarray is deprecated and will be removed in a future release.") def asarray( obj: object, itemsize: int | None = None, diff --git a/numpy/_core/tests/test_defchararray.py b/numpy/_core/tests/test_defchararray.py index 643293580708..33db8747e0e6 100644 --- a/numpy/_core/tests/test_defchararray.py +++ b/numpy/_core/tests/test_defchararray.py @@ -14,10 +14,11 @@ kw_unicode_false = {'unicode': False} ignore_charray_deprecation = pytest.mark.filterwarnings( - r"ignore:\w+ chararray \w+:DeprecationWarning" + r"ignore:\w+ (chararray|array|asarray) \w+:DeprecationWarning" ) +@ignore_charray_deprecation class TestBasic: def test_from_object_array(self): A = np.array([['abc', 2], diff --git a/numpy/_core/tests/test_deprecations.py b/numpy/_core/tests/test_deprecations.py index 8507d369fe29..b7a2444fbbc0 100644 --- a/numpy/_core/tests/test_deprecations.py +++ b/numpy/_core/tests/test_deprecations.py @@ -355,3 +355,13 @@ class TestTypenameDeprecation(_DeprecationTestCase): def test_typename_emits_deprecation_warning(self): self.assert_deprecated(lambda: np.typename("S1")) self.assert_deprecated(lambda: np.typename("h")) + +class TestRoundDeprecation(_DeprecationTestCase): + # Deprecation in NumPy 2.5, 2026-02 + + def test_round_emits_deprecation_warning_array(self): + a = np.array([1.5, 2.7, -1.5, -2.7]) + self.assert_deprecated(lambda: np.ma.round_(a)) + + def test_round_emits_deprecation_warning_scalar(self): + self.assert_deprecated(lambda: np.ma.round_(3.14)) diff --git a/numpy/char/__init__.py b/numpy/char/__init__.py index dd6c36c84451..a757fcee58ac 100644 --- a/numpy/char/__init__.py +++ b/numpy/char/__init__.py @@ -1,8 +1,10 @@ from numpy._core.defchararray import __all__, __doc__ +__DEPRECATED = frozenset({"chararray", "array", "asarray"}) + def __getattr__(name: str): - if name == "chararray": + if name in __DEPRECATED: # Deprecated in NumPy 2.5, 2026-01-07 import warnings @@ -15,10 +17,6 @@ def __getattr__(name: str): stacklevel=2, ) - from numpy._core.defchararray import chararray - - return chararray - import numpy._core.defchararray as char if (export := getattr(char, name, None)) is not None: diff --git a/numpy/conftest.py b/numpy/conftest.py index d260225568da..c8f810aeda64 100644 --- a/numpy/conftest.py +++ b/numpy/conftest.py @@ -186,6 +186,7 @@ def warnings_errors_and_rng(test=None): "numpy.fix is deprecated", # fix -> trunc "The chararray class is deprecated", # char.chararray "numpy.typename is deprecated", # typename -> dtype.name + "numpy.ma.round_ is deprecated", # ma.round_ -> ma.round ] msg = "|".join(msgs) diff --git a/numpy/lib/_polynomial_impl.py b/numpy/lib/_polynomial_impl.py index e17d6a49ef66..81f2a0e5d7cd 100644 --- a/numpy/lib/_polynomial_impl.py +++ b/numpy/lib/_polynomial_impl.py @@ -250,6 +250,10 @@ def roots(p): A = diag(NX.ones((N - 2,), p.dtype), -1) A[0, :] = -p[1:] / p[0] roots = eigvals(A) + + # backwards compat: return real values if possible + from numpy.linalg._linalg import _to_real_if_imag_zero + roots = _to_real_if_imag_zero(roots, A) else: roots = NX.array([]) diff --git a/numpy/lib/tests/test_polynomial.py b/numpy/lib/tests/test_polynomial.py index 32547f8e6c18..a388ab7bace5 100644 --- a/numpy/lib/tests/test_polynomial.py +++ b/numpy/lib/tests/test_polynomial.py @@ -143,6 +143,14 @@ def test_roots(self): # to take into account numerical calculation error assert_almost_equal(res, tgt, 14 - int(np.log10(i))) + @pytest.mark.parametrize("dtyp", [int, np.float32, np.float64]) + def test_roots_dtype(self, dtyp): + coef = np.asarray([1, 0, -1], dtype=dtyp) # x**2 - 1 + r = np.roots(coef) + r.sort() + assert_allclose(r, np.asarray([-1, 1])) + assert r.dtype == {int: np.float64}.get(dtyp, dtyp) + def test_str_leading_zeros(self): p = np.poly1d([4, 3, 2, 1]) p[3] = 0 diff --git a/numpy/linalg/_linalg.py b/numpy/linalg/_linalg.py index d11699bd1c5e..c0a42f302055 100644 --- a/numpy/linalg/_linalg.py +++ b/numpy/linalg/_linalg.py @@ -186,6 +186,19 @@ def _realType(t, default=double): def _complexType(t, default=cdouble): return _complex_types_map.get(t, default) + +def _to_real_if_imag_zero(w, t): + """Backwards compat helper: force w to be real if t.dtype is real and w.imag == 0 + """ + result_t = t.dtype.type + if not isComplexType(result_t) and all(w.imag == 0.0): + w = w.real + result_t = _realType(result_t) + else: + result_t = _complexType(result_t) + return w.astype(result_t, copy=False) + + def _commonType(*arrays): # in lite version, use higher precision (always double or cdouble) result_type = single @@ -1229,11 +1242,11 @@ def eigvals(a): >>> D = np.diag((-1,1)) >>> LA.eigvals(D) - array([-1., 1.]) + array([-1. + 0.j, 1. + 0.j]) >>> A = np.dot(Q, D) >>> A = np.dot(A, Q.T) >>> LA.eigvals(A) - array([ 1., -1.]) # random + array([ 1., -1.]) # random """ a, wrap = _makearray(a) @@ -1247,14 +1260,7 @@ def eigvals(a): under='ignore'): w = _umath_linalg.eigvals(a, signature=signature) - if not isComplexType(t): - if all(w.imag == 0): - w = w.real - result_t = _realType(result_t) - else: - result_t = _complexType(result_t) - - return w.astype(result_t, copy=False) + return w.astype(_complexType(result_t), copy=False) def _eigvalsh_dispatcher(a, UPLO=None): @@ -1450,8 +1456,8 @@ def eig(a): >>> eigenvalues, eigenvectors = LA.eig(np.diag((1, 2, 3))) >>> eigenvalues - array([1., 2., 3.]) - >>> eigenvectors + array([1. + 0j, 2. + 0j, 3. + 0j]) + >>> eigenvectors.real array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]) @@ -1483,8 +1489,8 @@ def eig(a): >>> # Theor. eigenvalues are 1 +/- 1e-9 >>> eigenvalues, eigenvectors = LA.eig(a) >>> eigenvalues - array([1., 1.]) - >>> eigenvectors + array([1.+0j, 1.+0j]) + >>> eigenvectors.real array([[1., 0.], [0., 1.]]) @@ -1500,15 +1506,9 @@ def eig(a): under='ignore'): w, vt = _umath_linalg.eig(a, signature=signature) - if not isComplexType(t) and all(w.imag == 0.0): - w = w.real - vt = vt.real - result_t = _realType(result_t) - else: - result_t = _complexType(result_t) - - vt = vt.astype(result_t, copy=False) - return EigResult(w.astype(result_t, copy=False), wrap(vt)) + w = w.astype(_complexType(result_t), copy=False) + vt = vt.astype(_complexType(result_t), copy=False) + return EigResult(w, wrap(vt)) @array_function_dispatch(_eigvalsh_dispatcher) diff --git a/numpy/linalg/_linalg.pyi b/numpy/linalg/_linalg.pyi index 6c78cb10ba2b..c982bf524c50 100644 --- a/numpy/linalg/_linalg.pyi +++ b/numpy/linalg/_linalg.pyi @@ -334,11 +334,11 @@ def eig(a: NDArray[np.inexact[Never]]) -> EigResult: ... @overload # ~complex128 def eig(a: _AsArrayC128) -> EigResult[np.complex128]: ... @overload # +float64 -def eig(a: _ToArrayF64) -> EigResult[np.complex128] | EigResult[np.float64]: ... +def eig(a: _ToArrayF64) -> EigResult[np.complex128]: ... @overload # ~complex64 def eig(a: _ArrayLike[np.complex64]) -> EigResult[np.complex64]: ... @overload # ~float32 -def eig(a: _ArrayLike[np.float32]) -> EigResult[np.complex64] | EigResult[np.float32]: ... +def eig(a: _ArrayLike[np.float32]) -> EigResult[np.complex64]: ... @overload # fallback def eig(a: _ArrayLikeComplex_co) -> EigResult: ... diff --git a/numpy/linalg/tests/test_linalg.py b/numpy/linalg/tests/test_linalg.py index 2c4cc2891ab5..cd93acaf79c0 100644 --- a/numpy/linalg/tests/test_linalg.py +++ b/numpy/linalg/tests/test_linalg.py @@ -604,7 +604,7 @@ class TestEigvals(EigvalsCases): @pytest.mark.parametrize('dtype', [single, double, csingle, cdouble]) def test_types(self, dtype): x = np.array([[1, 0.5], [0.5, 1]], dtype=dtype) - assert_equal(linalg.eigvals(x).dtype, dtype) + assert_equal(linalg.eigvals(x).dtype, get_complex_dtype(dtype)) x = np.array([[1, 0.5], [-1, 1]], dtype=dtype) assert_equal(linalg.eigvals(x).dtype, get_complex_dtype(dtype)) @@ -614,7 +614,7 @@ class ArraySubclass(np.ndarray): pass a = np.zeros((0, 1, 1), dtype=np.int_).view(ArraySubclass) res = linalg.eigvals(a) - assert_(res.dtype.type is np.float64) + assert_(res.dtype.type is np.complex128) assert_equal((0, 1), res.shape) # This is just for documentation, it might make sense to change: assert_(isinstance(res, np.ndarray)) @@ -643,8 +643,8 @@ class TestEig(EigCases): def test_types(self, dtype): x = np.array([[1, 0.5], [0.5, 1]], dtype=dtype) w, v = np.linalg.eig(x) - assert_equal(w.dtype, dtype) - assert_equal(v.dtype, dtype) + assert_equal(w.dtype, get_complex_dtype(dtype)) + assert_equal(v.dtype, get_complex_dtype(dtype)) x = np.array([[1, 0.5], [-1, 1]], dtype=dtype) w, v = np.linalg.eig(x) @@ -657,8 +657,8 @@ class ArraySubclass(np.ndarray): pass a = np.zeros((0, 1, 1), dtype=np.int_).view(ArraySubclass) res, res_v = linalg.eig(a) - assert_(res_v.dtype.type is np.float64) - assert_(res.dtype.type is np.float64) + assert_(res_v.dtype.type is np.complex128) + assert_(res.dtype.type is np.complex128) assert_equal(a.shape, res_v.shape) assert_equal((0, 1), res.shape) # This is just for documentation, it might make sense to change: diff --git a/numpy/ma/core.py b/numpy/ma/core.py index 196462720cd8..4ab7a18fabfb 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -8089,7 +8089,7 @@ def nmask(x): return d -def round_(a, decimals=0, out=None): +def round(a, decimals=0, out=None): """ Return a copy of a, rounded to 'decimals' places. @@ -8123,7 +8123,7 @@ def round_(a, decimals=0, out=None): masked_array(data=[11.2, -3.973, 0.801, --], mask=[False, False, False, True], fill_value=1e+20) - >>> ma.round_(masked_x) + >>> ma.round(masked_x) masked_array(data=[11.0, -4.0, 1.0, --], mask=[False, False, False, True], fill_value=1e+20) @@ -8131,7 +8131,7 @@ def round_(a, decimals=0, out=None): masked_array(data=[11.2, -4.0, 0.8, --], mask=[False, False, False, True], fill_value=1e+20) - >>> ma.round_(masked_x, decimals=-1) + >>> ma.round(masked_x, decimals=-1) masked_array(data=[10.0, -0.0, 0.0, --], mask=[False, False, False, True], fill_value=1e+20) @@ -8145,8 +8145,62 @@ def round_(a, decimals=0, out=None): return out -round = round_ +def round_(a, decimals=0, out=None): + """ + Return a copy of a, rounded to 'decimals' places. + + .. deprecated:: 2.5 + `numpy.ma.round_` is deprecated. Use `numpy.ma.round` instead. + + When 'decimals' is negative, it specifies the number of positions + to the left of the decimal point. The real and imaginary parts of + complex numbers are rounded separately. Nothing is done if the + array is not of float type and 'decimals' is greater than or equal + to 0. + + Parameters + ---------- + decimals : int + Number of decimals to round to. May be negative. + out : array_like + Existing array to use for output. + If not given, returns a default copy of a. + + Notes + ----- + If out is given and does not have a mask attribute, the mask of a + is lost! + Examples + -------- + >>> import numpy as np + >>> import numpy.ma as ma + >>> x = [11.2, -3.973, 0.801, -1.41] + >>> mask = [0, 0, 0, 1] + >>> masked_x = ma.masked_array(x, mask) + >>> masked_x + masked_array(data=[11.2, -3.973, 0.801, --], + mask=[False, False, False, True], + fill_value=1e+20) + >>> ma.round_(masked_x) + masked_array(data=[11.0, -4.0, 1.0, --], + mask=[False, False, False, True], + fill_value=1e+20) + >>> ma.round(masked_x, decimals=1) + masked_array(data=[11.2, -4.0, 0.8, --], + mask=[False, False, False, True], + fill_value=1e+20) + >>> ma.round_(masked_x, decimals=-1) + masked_array(data=[10.0, -0.0, 0.0, --], + mask=[False, False, False, True], + fill_value=1e+20) + """ + warnings.warn( + "numpy.ma.round_ is deprecated. Use numpy.ma.round instead.", + DeprecationWarning, + stacklevel=2, + ) + return round(a, decimals, out) def _mask_propagate(a, axis): """ diff --git a/numpy/ma/core.pyi b/numpy/ma/core.pyi index 2173e0e76f04..26f1dc591d51 100644 --- a/numpy/ma/core.pyi +++ b/numpy/ma/core.pyi @@ -3774,18 +3774,33 @@ def choose[ArrayT: np.ndarray]( # @overload # a: masked_array, out: None (default) +def round[MArray: MaskedArray](a: MArray, decimals: int = 0, out: None = None) -> MArray: ... +@overload # a: known array-like, out: None (default) +def round[ScalarT: np.number](a: _ArrayLike[ScalarT], decimals: int = 0, out: None = None) -> _MaskedArray[ScalarT]: ... +@overload # a: unknown array-like, out: None (default) +def round(a: _ArrayLikeNumber_co, decimals: int = 0, out: None = None) -> _MaskedArray[Incomplete]: ... +@overload # out: ndarray (positional) +def round[ArrayT: np.ndarray](a: ArrayLike, decimals: int, out: ArrayT) -> ArrayT: ... +@overload # out: ndarray (keyword) +def round[ArrayT: np.ndarray](a: ArrayLike, decimals: int = 0, *, out: ArrayT) -> ArrayT: ... + +# +@overload # a: masked_array, out: None (default) +@deprecated("numpy.ma.round_ is deprecated. Use numpy.ma.round instead.") def round_[MArray: MaskedArray](a: MArray, decimals: int = 0, out: None = None) -> MArray: ... @overload # a: known array-like, out: None (default) +@deprecated("numpy.ma.round_ is deprecated. Use numpy.ma.round instead.") def round_[ScalarT: np.number](a: _ArrayLike[ScalarT], decimals: int = 0, out: None = None) -> _MaskedArray[ScalarT]: ... @overload # a: unknown array-like, out: None (default) +@deprecated("numpy.ma.round_ is deprecated. Use numpy.ma.round instead.") def round_(a: _ArrayLikeNumber_co, decimals: int = 0, out: None = None) -> _MaskedArray[Incomplete]: ... @overload # out: ndarray (positional) +@deprecated("numpy.ma.round_ is deprecated. Use numpy.ma.round instead.") def round_[ArrayT: np.ndarray](a: ArrayLike, decimals: int, out: ArrayT) -> ArrayT: ... @overload # out: ndarray (keyword) +@deprecated("numpy.ma.round_ is deprecated. Use numpy.ma.round instead.") def round_[ArrayT: np.ndarray](a: ArrayLike, decimals: int = 0, *, out: ArrayT) -> ArrayT: ... -round = round_ - # keep in sync with `_core.multiarray.inner` def inner(a: ArrayLike, b: ArrayLike) -> Incomplete: ... diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py index 1bf99461b8e8..b2970c914957 100644 --- a/numpy/polynomial/hermite.py +++ b/numpy/polynomial/hermite.py @@ -1543,6 +1543,10 @@ def hermroots(c): m = hermcompanion(c)[::-1, ::-1] r = np.linalg.eigvals(m) r.sort() + + # backwards compat: return real values if possible + from numpy.linalg._linalg import _to_real_if_imag_zero + r = _to_real_if_imag_zero(r, m) return r diff --git a/numpy/polynomial/laguerre.py b/numpy/polynomial/laguerre.py index b1d87bf6d035..eb34cbef17ca 100644 --- a/numpy/polynomial/laguerre.py +++ b/numpy/polynomial/laguerre.py @@ -1525,6 +1525,10 @@ def lagroots(c): m = lagcompanion(c)[::-1, ::-1] r = np.linalg.eigvals(m) r.sort() + + # backwards compat: return real values if possible + from numpy.linalg._linalg import _to_real_if_imag_zero + r = _to_real_if_imag_zero(r, m) return r diff --git a/numpy/polynomial/polynomial.py b/numpy/polynomial/polynomial.py index a2ea62c9e666..45abd5009c70 100644 --- a/numpy/polynomial/polynomial.py +++ b/numpy/polynomial/polynomial.py @@ -1547,6 +1547,10 @@ def polyroots(c): m = polycompanion(c) r = np.linalg.eigvals(m) r.sort() + + # backwards compat: return real values if possible + from numpy.linalg._linalg import _to_real_if_imag_zero + r = _to_real_if_imag_zero(r, m) return r diff --git a/numpy/typing/tests/data/reveal/linalg.pyi b/numpy/typing/tests/data/reveal/linalg.pyi index f6de644bd7da..a1155e2bb5ed 100644 --- a/numpy/typing/tests/data/reveal/linalg.pyi +++ b/numpy/typing/tests/data/reveal/linalg.pyi @@ -137,9 +137,9 @@ assert_type(np.linalg.eigvalsh(AR_i8), npt.NDArray[np.float64]) assert_type(np.linalg.eigvalsh(AR_f8), npt.NDArray[np.float64]) assert_type(np.linalg.eigvalsh(AR_c16), npt.NDArray[np.float64]) -assert_type(np.linalg.eig(AR_i8), EigResult[np.float64] | EigResult[np.complex128]) -assert_type(np.linalg.eig(AR_f4), EigResult[np.float32] | EigResult[np.complex64]) -assert_type(np.linalg.eig(AR_f8), EigResult[np.float64] | EigResult[np.complex128]) +assert_type(np.linalg.eig(AR_i8), EigResult[np.complex128]) +assert_type(np.linalg.eig(AR_f4), EigResult[np.complex64]) +assert_type(np.linalg.eig(AR_f8), EigResult[np.complex128]) assert_type(np.linalg.eig(AR_c8), EigResult[np.complex64]) assert_type(np.linalg.eig(AR_c16), EigResult[np.complex128]) # Mypy bug: `Expression is of type "EigResult[Any]", not "EigResult[Any]"` diff --git a/requirements/emscripten_test_requirements.txt b/requirements/emscripten_test_requirements.txt index e8ab96996cf8..3c5e86e39a84 100644 --- a/requirements/emscripten_test_requirements.txt +++ b/requirements/emscripten_test_requirements.txt @@ -1,4 +1,4 @@ -hypothesis==6.151.5 +hypothesis==6.151.6 pytest==9.0.2 tzdata pytest-xdist diff --git a/requirements/test_requirements.txt b/requirements/test_requirements.txt index 8693bb4d58d9..8a14ddf0478d 100644 --- a/requirements/test_requirements.txt +++ b/requirements/test_requirements.txt @@ -1,5 +1,5 @@ Cython -hypothesis==6.151.5 +hypothesis==6.151.6 pytest==9.0.2 pytest-cov==7.0.0 meson