Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-scipy for openSUSE:Factory checked in at 2023-08-06 16:29:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-scipy (Old) and /work/SRC/openSUSE:Factory/.python-scipy.new.22712 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-scipy" Sun Aug 6 16:29:16 2023 rev:65 rq:1101324 version:1.11.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-scipy/python-scipy.changes 2023-07-05 15:30:34.850573704 +0200 +++ /work/SRC/openSUSE:Factory/.python-scipy.new.22712/python-scipy.changes 2023-08-06 16:29:20.283611737 +0200 @@ -1,0 +2,20 @@ +Thu Jul 27 13:31:24 UTC 2023 - Markéta Machová <mmach...@suse.com> + +- Add upstream intc.patch to fix gh#scipy/scipy#18603 + +------------------------------------------------------------------- +Tue Jul 25 10:04:04 UTC 2023 - Markéta Machová <mmach...@suse.com> + +- Update to 1.11.1 + * Several scipy.sparse array API improvements, including sparse.sparray, + a new public base class distinct from the older sparse.spmatrix class, + proper 64-bit index support, and numerous deprecations paving the way + to a modern sparse array experience. + * scipy.stats added tools for survival analysis, multiple hypothesis + testing, sensitivity analysis, and working with censored data. + * A new function was added for quasi-Monte Carlo integration, and linear + algebra functions det and lu now accept nD-arrays. + * An axes argument was added broadly to ndimage functions, facilitating + analysis of stacked image data. + +------------------------------------------------------------------- Old: ---- scipy-1.10.1.tar.gz New: ---- intc.patch scipy-1.11.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-scipy.spec ++++++ --- /var/tmp/diff_new_pack.07KTdX/_old 2023-08-06 16:29:22.127623548 +0200 +++ /var/tmp/diff_new_pack.07KTdX/_new 2023-08-06 16:29:22.135623599 +0200 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} %global flavor @BUILD_FLAVOR@%{nil} -%define _ver 1_10_1 +%define _ver 1_11_1 %define shortname scipy %define pname python-%{shortname} %define hpc_upcase_trans_hyph() %(echo %{**} | tr [a-z] [A-Z] | tr '-' '_') @@ -93,7 +93,7 @@ # TODO explore debundling Boost for standard and hpc Name: %{package_name} -Version: 1.10.1 +Version: 1.11.1 Release: 0 Summary: Scientific Tools for Python License: BSD-3-Clause AND LGPL-2.0-or-later AND BSL-1.0 @@ -102,6 +102,8 @@ Source0: https://files.pythonhosted.org/packages/source/s/scipy/scipy-%{version}.tar.gz # Create with pooch: `python3 scipy-%{version}/scipy/datasets/_download_all.py scipy-datasets/scipy-data; tar czf scipy-datasets.tar.gz scipy-datasets` Source1: scipy-datasets.tar.gz +#PATCH-FIX-UPSTREAM https://github.com/scipy/scipy/commit/8501b7c2fb8a7121aeef94489ece988043c463d0 BUG: sparse.linalg: Cast index arrays to intc before calling SuperLU functions +Patch: intc.patch BuildRequires: %{python_module Cython >= 0.29.32} BuildRequires: %{python_module devel >= 3.8} BuildRequires: %{python_module meson-python >= 0.9.0} @@ -262,6 +264,7 @@ donttest+=" or (test_rotation and test_align_vectors_single_vector)" donttest+=" or (test_lobpcg and test_tolerance_float32)" donttest+=" or (test_iterative and test_maxiter_worsening)" +donttest+=" or (test_resampling and test_bootstrap_alternative)" %ifarch %ix86 donttest+=" or (test_solvers and test_solve_generalized_discrete_are)" # Skip the following tests that fail with GCC 13 due to the excess precision change: ++++++ intc.patch ++++++ >From 8501b7c2fb8a7121aeef94489ece988043c463d0 Mon Sep 17 00:00:00 2001 From: CJ Carey <perimosocord...@gmail.com> Date: Sun, 2 Jul 2023 16:29:22 -0400 Subject: [PATCH] BUG: sparse.linalg: Cast index arrays to intc before calling SuperLU functions (#18644) * BUG: sparse.linalg: Cast to intc before SuperLU --------- Co-authored-by: Stefan van der Walt <stef...@berkeley.edu> Co-authored-by: Dan Schult <dsch...@colgate.edu> --- scipy/sparse/linalg/_dsolve/linsolve.py | 27 +++++++++++-- .../linalg/_dsolve/tests/test_linsolve.py | 38 ++++++++++--------- 2 files changed, 44 insertions(+), 21 deletions(-) diff --git a/scipy/sparse/linalg/_dsolve/linsolve.py b/scipy/sparse/linalg/_dsolve/linsolve.py index 0c408f737266..78ba447bcd44 100644 --- a/scipy/sparse/linalg/_dsolve/linsolve.py +++ b/scipy/sparse/linalg/_dsolve/linsolve.py @@ -123,6 +123,21 @@ def _get_umf_family(A): return family, A_new +def _safe_downcast_indices(A): + # check for safe downcasting + max_value = np.iinfo(np.intc).max + + if A.indptr[-1] > max_value: # indptr[-1] is max b/c indptr always sorted + raise ValueError("indptr values too large for SuperLU") + + if max(*A.shape) > max_value: # only check large enough arrays + if np.any(A.indices > max_value): + raise ValueError("indices values too large for SuperLU") + + indices = A.indices.astype(np.intc, copy=False) + indptr = A.indptr.astype(np.intc, copy=False) + return indices, indptr + def spsolve(A, b, permc_spec=None, use_umfpack=True): """Solve the sparse linear system Ax=b, where b may be a vector or a matrix. @@ -269,8 +284,10 @@ def spsolve(A, b, permc_spec=None, use_umfpack=True): else: flag = 0 # CSR format + indices = A.indices.astype(np.intc, copy=False) + indptr = A.indptr.astype(np.intc, copy=False) options = dict(ColPerm=permc_spec) - x, info = _superlu.gssv(N, A.nnz, A.data, A.indices, A.indptr, + x, info = _superlu.gssv(N, A.nnz, A.data, indices, indptr, b, flag, options=options) if info != 0: warn("Matrix is exactly singular", MatrixRankWarning) @@ -402,6 +419,8 @@ def csc_construct_func(*a, cls=type(A)): if (M != N): raise ValueError("can only factor square matrices") # is this true? + indices, indptr = _safe_downcast_indices(A) + _options = dict(DiagPivotThresh=diag_pivot_thresh, ColPerm=permc_spec, PanelSize=panel_size, Relax=relax) if options is not None: @@ -411,7 +430,7 @@ def csc_construct_func(*a, cls=type(A)): if (_options["ColPerm"] == "NATURAL"): _options["SymmetricMode"] = True - return _superlu.gstrf(N, A.nnz, A.data, A.indices, A.indptr, + return _superlu.gstrf(N, A.nnz, A.data, indices, indptr, csc_construct_func=csc_construct_func, ilu=False, options=_options) @@ -495,6 +514,8 @@ def csc_construct_func(*a, cls=type(A)): if (M != N): raise ValueError("can only factor square matrices") # is this true? + indices, indptr = _safe_downcast_indices(A) + _options = dict(ILU_DropRule=drop_rule, ILU_DropTol=drop_tol, ILU_FillFactor=fill_factor, DiagPivotThresh=diag_pivot_thresh, ColPerm=permc_spec, @@ -506,7 +527,7 @@ def csc_construct_func(*a, cls=type(A)): if (_options["ColPerm"] == "NATURAL"): _options["SymmetricMode"] = True - return _superlu.gstrf(N, A.nnz, A.data, A.indices, A.indptr, + return _superlu.gstrf(N, A.nnz, A.data, indices, indptr, csc_construct_func=csc_construct_func, ilu=True, options=_options) diff --git a/scipy/sparse/linalg/_dsolve/tests/test_linsolve.py b/scipy/sparse/linalg/_dsolve/tests/test_linsolve.py index 4740685a3dd7..00e0d1886dcc 100644 --- a/scipy/sparse/linalg/_dsolve/tests/test_linsolve.py +++ b/scipy/sparse/linalg/_dsolve/tests/test_linsolve.py @@ -220,8 +220,11 @@ def test_singular_gh_3312(self): except RuntimeError: pass - def test_twodiags(self): - A = spdiags([[1, 2, 3, 4, 5], [6, 5, 8, 9, 10]], [0, 1], 5, 5) + @pytest.mark.parametrize('format', ['csc', 'csr']) + @pytest.mark.parametrize('idx_dtype', [np.int32, np.int64]) + def test_twodiags(self, format: str, idx_dtype: np.dtype): + A = spdiags([[1, 2, 3, 4, 5], [6, 5, 8, 9, 10]], [0, 1], 5, 5, + format=format) b = array([1, 2, 3, 4, 5]) # condition number of A @@ -230,13 +233,12 @@ def test_twodiags(self): for t in ['f','d','F','D']: eps = finfo(t).eps # floating point epsilon b = b.astype(t) + Asp = A.astype(t) + Asp.indices = Asp.indices.astype(idx_dtype, copy=False) + Asp.indptr = Asp.indptr.astype(idx_dtype, copy=False) - for format in ['csc','csr']: - Asp = A.astype(t).asformat(format) - - x = spsolve(Asp,b) - - assert_(norm(b - Asp@x) < 10 * cond_A * eps) + x = spsolve(Asp, b) + assert_(norm(b - Asp@x) < 10 * cond_A * eps) def test_bvector_smoketest(self): Adense = array([[0., 1., 1.], @@ -442,16 +444,18 @@ def setup_method(self): n = 40 d = arange(n) + 1 self.n = n - self.A = spdiags((d, 2*d, d[::-1]), (-3, 0, 5), n, n) + self.A = spdiags((d, 2*d, d[::-1]), (-3, 0, 5), n, n, format='csc') random.seed(1234) - def _smoketest(self, spxlu, check, dtype): + def _smoketest(self, spxlu, check, dtype, idx_dtype): if np.issubdtype(dtype, np.complexfloating): A = self.A + 1j*self.A.T else: A = self.A A = A.astype(dtype) + A.indices = A.indices.astype(idx_dtype, copy=False) + A.indptr = A.indptr.astype(idx_dtype, copy=False) lu = spxlu(A) rng = random.RandomState(1234) @@ -489,10 +493,9 @@ def check(A, b, x, msg=""): r = A @ x assert_(abs(r - b).max() < 1e3*eps, msg) - self._smoketest(splu, check, np.float32) - self._smoketest(splu, check, np.float64) - self._smoketest(splu, check, np.complex64) - self._smoketest(splu, check, np.complex128) + for dtype in [np.float32, np.float64, np.complex64, np.complex128]: + for idx_dtype in [np.int32, np.int64]: + self._smoketest(splu, check, dtype, idx_dtype) @sup_sparse_efficiency def test_spilu_smoketest(self): @@ -508,10 +511,9 @@ def check(A, b, x, msg=""): if b.dtype in (np.float64, np.complex128): errors.append(err) - self._smoketest(spilu, check, np.float32) - self._smoketest(spilu, check, np.float64) - self._smoketest(spilu, check, np.complex64) - self._smoketest(spilu, check, np.complex128) + for dtype in [np.float32, np.float64, np.complex64, np.complex128]: + for idx_dtype in [np.int32, np.int64]: + self._smoketest(spilu, check, dtype, idx_dtype) assert_(max(errors) > 1e-5) ++++++ scipy-1.10.1.tar.gz -> scipy-1.11.1.tar.gz ++++++ /work/SRC/openSUSE:Factory/python-scipy/scipy-1.10.1.tar.gz /work/SRC/openSUSE:Factory/.python-scipy.new.22712/scipy-1.11.1.tar.gz differ: char 5, line 1