From 4f14791b9e2c9ebd55439ee55ccfd75d73ccd167 Mon Sep 17 00:00:00 2001 From: Pamphile ROY Date: Tue, 23 Nov 2021 09:57:56 +0100 Subject: [PATCH 1/4] BUG: out of bounds indexing in stats.qmc.update_discrepancy. Co-authored-by: 99991 <99991@users.noreply.github.com> --- scipy/stats/_qmc_cy.pyx | 10 +++++----- scipy/stats/tests/test_qmc.py | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/scipy/stats/_qmc_cy.pyx b/scipy/stats/_qmc_cy.pyx index 1607af63ab44..e6f396930cb1 100644 --- a/scipy/stats/_qmc_cy.pyx +++ b/scipy/stats/_qmc_cy.pyx @@ -246,15 +246,15 @@ cdef double c_update_discrepancy(double[::1] x_new_view, double initial_disc): cdef: Py_ssize_t n = sample_view.shape[0] + 1 - Py_ssize_t xnew_nlines = x_new_view.shape[0] + Py_ssize_t d = sample_view.shape[1] Py_ssize_t i = 0, j = 0, k = 0 double prod = 1, tmp_sum= 0 double disc1 = 0, disc2 = 0, disc3 = 0 - double[::1] abs_ = np.zeros(n, dtype=np.float64) + double[::1] abs_ = np.empty(d, dtype=np.float64) # derivation from P.T. Roy (@tupui) - for i in range(xnew_nlines): + for i in range(d): abs_[i] = fabs(x_new_view[i] - 0.5) prod *= ( 1 + 0.5 * abs_[i] @@ -265,7 +265,7 @@ cdef double c_update_discrepancy(double[::1] x_new_view, prod = 1 for i in range(n - 1): - for j in range(xnew_nlines): + for j in range(d): prod *= ( 1 + 0.5 * abs_[j] + 0.5 * fabs(sample_view[i, j] - 0.5) @@ -276,7 +276,7 @@ cdef double c_update_discrepancy(double[::1] x_new_view, disc2 *= 2 / pow(n, 2) - for i in range(xnew_nlines): + for i in range(d): prod *= 1 + abs_[i] disc3 = 1 / pow(n, 2) * prod diff --git a/scipy/stats/tests/test_qmc.py b/scipy/stats/tests/test_qmc.py index b11a50b992db..1972ad03804e 100644 --- a/scipy/stats/tests/test_qmc.py +++ b/scipy/stats/tests/test_qmc.py @@ -178,15 +178,25 @@ def test_discrepancy_parallel(self, monkeypatch): qmc.discrepancy(sample, workers=-2) def test_update_discrepancy(self): + # From Fang et al. Design and modeling for computer experiments, 2006 space_1 = np.array([[1, 3], [2, 6], [3, 2], [4, 5], [5, 1], [6, 4]]) space_1 = (2.0 * space_1 - 1.0) / (2.0 * 6.0) disc_init = qmc.discrepancy(space_1[:-1], iterative=True) - disc_iter = update_discrepancy(space_1[-1], space_1[:-1], - disc_init) + disc_iter = update_discrepancy(space_1[-1], space_1[:-1], disc_init) assert_allclose(disc_iter, 0.0081, atol=1e-4) + # n Date: Tue, 23 Nov 2021 10:44:26 -0700 Subject: [PATCH 2/4] DOC: draft 1.7.3 release notes --- doc/release/1.7.3-notes.rst | 37 ++++++++++++++++++++++++++++++++++++ doc/source/release.1.7.3.rst | 1 + doc/source/release.rst | 1 + pavement.py | 4 ++-- 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 doc/release/1.7.3-notes.rst create mode 100644 doc/source/release.1.7.3.rst diff --git a/doc/release/1.7.3-notes.rst b/doc/release/1.7.3-notes.rst new file mode 100644 index 000000000000..610eeb098f56 --- /dev/null +++ b/doc/release/1.7.3-notes.rst @@ -0,0 +1,37 @@ +========================== +SciPy 1.7.3 Release Notes +========================== + +.. contents:: + +SciPy 1.7.3 is a bug-fix release that provides binary wheels +for MacOS arm64 with Python 3.8, 3.9, and 3.10. Note that a small +number of test failures have been skipped for these new wheels. + +Authors +======= + +* Anirudh Dagar +* Ralf Gommers +* Tyler Reddy +* Pamphile Roy +* Olivier Grisel + +A total of 5 people contributed to this release. +People with a "+" by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +Issues closed for 1.7.3 +----------------------- + +* `#13364 `__: Segmentation fault on import of scipy.integrate on Apple M1 ARM... +* `#14688 `__: BUG: ARPACK's eigsh & OpenBLAS from Apple Silicon M1 (arm64)... +* `#14991 `__: four CI failures on pre-release job +* `#15081 `__: BUG: Segmentation fault caused by scipy.stats.qmc.qmc.update_discrepancy + + +Pull requests for 1.7.3 +----------------------- + +* `#14990 `__: BLD: update pyproject.toml for Python 3.10 changes +* `#15086 `__: BUG: out of bounds indexing in stats.qmc.update_discrepancy diff --git a/doc/source/release.1.7.3.rst b/doc/source/release.1.7.3.rst new file mode 100644 index 000000000000..d9a1edb29c5c --- /dev/null +++ b/doc/source/release.1.7.3.rst @@ -0,0 +1 @@ +.. include:: ../release/1.7.3-notes.rst diff --git a/doc/source/release.rst b/doc/source/release.rst index b8ce55b17fed..08658ab0bd81 100644 --- a/doc/source/release.rst +++ b/doc/source/release.rst @@ -8,6 +8,7 @@ see the `commit logs `_. .. toctree:: :maxdepth: 1 + release.1.7.3 release.1.7.2 release.1.7.1 release.1.7.0 diff --git a/pavement.py b/pavement.py index 9f9d70f5e6d0..3f3f9d982562 100644 --- a/pavement.py +++ b/pavement.py @@ -69,10 +69,10 @@ #----------------------------------- # Source of the release notes -RELEASE = 'doc/release/1.7.2-notes.rst' +RELEASE = 'doc/release/1.7.3-notes.rst' # Start/end of the log (from git) -LOG_START = 'v1.7.1' +LOG_START = 'v1.7.2' LOG_END = 'maintenance/1.7.x' From 20c42c2988829b5d454ea944f5cfb04bd7299b39 Mon Sep 17 00:00:00 2001 From: Tyler Reddy Date: Tue, 23 Nov 2021 15:51:03 -0700 Subject: [PATCH 3/4] MAINT: PR 15088 revisions * add Isuru Fernando to author list, for assistance in providing M1 support * adjust the 1.7.3 release notes summary to remove any mention of test skips and to note that MacOS version 12.0 is required for the arm64 wheels. * skip a `qmc` test when it is executed with a version of NumPy < 1.17, because default_rng not available --- doc/release/1.7.3-notes.rst | 8 +++++--- scipy/stats/tests/test_qmc.py | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/release/1.7.3-notes.rst b/doc/release/1.7.3-notes.rst index 610eeb098f56..ab228bad5440 100644 --- a/doc/release/1.7.3-notes.rst +++ b/doc/release/1.7.3-notes.rst @@ -5,8 +5,9 @@ SciPy 1.7.3 Release Notes .. contents:: SciPy 1.7.3 is a bug-fix release that provides binary wheels -for MacOS arm64 with Python 3.8, 3.9, and 3.10. Note that a small -number of test failures have been skipped for these new wheels. +for MacOS arm64 with Python 3.8, 3.9, and 3.10. The MacOS arm64 wheels +are only available for MacOS version 12.0 and greater, as explained +in Issue 14688, linked below. Authors ======= @@ -16,8 +17,9 @@ Authors * Tyler Reddy * Pamphile Roy * Olivier Grisel +* Isuru Fernando -A total of 5 people contributed to this release. +A total of 6 people contributed to this release. People with a "+" by their names contributed a patch for the first time. This list of names is automatically generated, and may not be fully complete. diff --git a/scipy/stats/tests/test_qmc.py b/scipy/stats/tests/test_qmc.py index 1972ad03804e..68b8ca9625ad 100644 --- a/scipy/stats/tests/test_qmc.py +++ b/scipy/stats/tests/test_qmc.py @@ -12,6 +12,7 @@ from scipy.stats import qmc from scipy.stats._qmc import (van_der_corput, n_primes, primes_from_2_to, update_discrepancy, QMCEngine) +from scipy._lib._pep440 import Version class TestUtils: @@ -177,6 +178,8 @@ def test_discrepancy_parallel(self, monkeypatch): with pytest.raises(ValueError, match="Invalid number of workers..."): qmc.discrepancy(sample, workers=-2) + @pytest.mark.skipif(Version(np.__version__) < Version('1.17'), + reason='default_rng not available for numpy, < 1.17') def test_update_discrepancy(self): # From Fang et al. Design and modeling for computer experiments, 2006 space_1 = np.array([[1, 3], [2, 6], [3, 2], [4, 5], [5, 1], [6, 4]]) From 7275c598cd069f641f8a2777f856c662761f2e73 Mon Sep 17 00:00:00 2001 From: Tyler Reddy Date: Tue, 23 Nov 2021 19:17:10 -0700 Subject: [PATCH 4/4] DOC: update 1.7.3 relnotes. --- doc/release/1.7.3-notes.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/release/1.7.3-notes.rst b/doc/release/1.7.3-notes.rst index ab228bad5440..3ed63f0bf357 100644 --- a/doc/release/1.7.3-notes.rst +++ b/doc/release/1.7.3-notes.rst @@ -29,6 +29,7 @@ Issues closed for 1.7.3 * `#13364 `__: Segmentation fault on import of scipy.integrate on Apple M1 ARM... * `#14688 `__: BUG: ARPACK's eigsh & OpenBLAS from Apple Silicon M1 (arm64)... * `#14991 `__: four CI failures on pre-release job +* `#15077 `__: Remaining test failures for macOS arm64 wheel * `#15081 `__: BUG: Segmentation fault caused by scipy.stats.qmc.qmc.update_discrepancy @@ -37,3 +38,4 @@ Pull requests for 1.7.3 * `#14990 `__: BLD: update pyproject.toml for Python 3.10 changes * `#15086 `__: BUG: out of bounds indexing in stats.qmc.update_discrepancy +* `#15090 `__: MAINT: skip a few failing tests in \`1.7.x\` for macOS arm64