Skip to content

Commit

Permalink
Merge branch 'main' into patch-4
Browse files Browse the repository at this point in the history
  • Loading branch information
DWesl authored Apr 19, 2024
2 parents 38faa9e + 561376c commit 3dff785
Show file tree
Hide file tree
Showing 73 changed files with 2,704 additions and 2,762 deletions.
2 changes: 1 addition & 1 deletion benchmarks/benchmarks/sparse_linalg_solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def setup(self, n, solver):
self.P_sparse = _create_sparse_poisson2d(n)

if solver == 'dense':
self.P_dense = self.P_sparse.A
self.P_dense = self.P_sparse.toarray()

def time_solve(self, n, solver):
if solver == 'dense':
Expand Down
9 changes: 5 additions & 4 deletions doc/source/_static/scipy.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ div.admonition-legacy {
border-color: var(--pst-color-warning);
}

.admonition-legacy.admonition > .admonition-title:before {
.admonition>.admonition-title::after,
div.admonition>.admonition-title::after {
color: var(--pst-color-warning);
content: var(--pst-icon-admonition-attention);
}

.admonition-legacy.admonition > .admonition-title:after {
background-color: var(--pst-color-warning);
.admonition>.admonition-title,
div.admonition>.admonition-title {
background-color: var(--pst-color-warning-bg);
}

/* JupyterLite "Try Examples" directive */
Expand Down
12 changes: 6 additions & 6 deletions doc/source/dev/toolchain.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ As explained in more detail below, the current minimal compiler versions are:
Compiler Default Platform (tested) Secondary Platform (untested) Minimal Version
========== =========================== =============================== ============================
GCC Linux AIX, Alpine Linux, OSX GCC 9.x
LLVM OSX Linux, FreeBSD, Windows LLVM 14.x
LLVM OSX Linux, FreeBSD, Windows LLVM 12.x
MSVC Windows - Visual Studio 2019 (vc142)
========== =========================== =============================== ============================

Note that the lower bound for LLVM is not enforced. Older versions should
work - as long as they support core (non-stdlib) C++17 -, but no version
below LLVM 14 is tested regularly during development. Please file an issue
if you encounter a problem during compilation.
Note that there is currently no dedicated CI job to test the minimum supported
LLVM/Clang version. Older versions than used in SciPy CI should work, as long
as they support core (non-stdlib) C++17. Please file an issue if you encounter
a problem during compilation.

Official Builds
~~~~~~~~~~~~~~~
Expand All @@ -143,7 +143,7 @@ Currently, SciPy wheels are being built as follows:
================ ============================== ============================== =============================
Linux x86 ``ubuntu-22.04`` GCC 10.2.1 ``cibuildwheel``
Linux arm ``docker-builder-arm64`` GCC 11.3.0 ``cibuildwheel``
OSX x86_64 ``macos-latest`` clang-14/gfortran 13.0 ``cibuildwheel``
OSX x86_64 ``macos-11`` clang-13/gfortran 11.3 ``cibuildwheel``
OSX arm64 ``macos-14`` clang-14/gfortran 13.0 ``cibuildwheel``
Windows ``windows-2019`` GCC 10.3 (`rtools`_) ``cibuildwheel``
================ ============================== ============================== =============================
Expand Down
6 changes: 3 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ project(
default_options: [
'buildtype=debugoptimized',
'b_ndebug=if-release',
'c_std=c99',
'c_std=c17',
'cpp_std=c++17',
'fortran_std=legacy',
'blas=openblas',
Expand Down Expand Up @@ -43,8 +43,8 @@ if cc.get_id() == 'gcc'
error('SciPy requires GCC >= 9.1')
endif
elif cc.get_id() == 'clang' or cc.get_id() == 'clang-cl'
if not cc.version().version_compare('>=14.0')
error('SciPy requires clang >= 14.0')
if not cc.version().version_compare('>=12.0')
error('SciPy requires clang >= 12.0')
endif
elif cc.get_id() == 'msvc'
if not cc.version().version_compare('>=19.20')
Expand Down
2 changes: 1 addition & 1 deletion scipy/integrate/quadpack/doc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ C then the same strategy as in QAGS is applied.
C
C - QAWO : Is a routine for the integration of COS(OMEGA*X)*F(X)
C or SIN(OMEGA*X)*F(X) over a finite interval (A,B).
C OMEGA is is specified by the user
C OMEGA is specified by the user
C The rule evaluation component is based on the
C modified Clenshaw-Curtis technique.
C An adaptive subdivision scheme is used connected with
Expand Down
2 changes: 1 addition & 1 deletion scipy/integrate/quadpack/readme
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ by the letter D.

- QAWO : Is a routine for the integration of COS(OMEGA*X)*F(X)
or SIN(OMEGA*X)*F(X) over a finite interval (A,B).
OMEGA is is specified by the user
OMEGA is specified by the user
The rule evaluation component is based on the
modified Clenshaw-Curtis technique.
An adaptive subdivision scheme is used connected with
Expand Down
2 changes: 1 addition & 1 deletion scipy/interpolate/interpnd.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ cdef int _estimate_gradients_2d_global(const qhull.DelaunayInfo_t *d,
# W(x) = f(x) + w(x)^T y
#
# where y = [ F_x(V); F_y(V) ], it is clear that the solution to
# the local problem is is given as a solution of the 2x2 matrix
# the local problem is given as a solution of the 2x2 matrix
# equation.
#
# Here, we use the Clough-Tocher interpolant, which restricted to
Expand Down
4 changes: 2 additions & 2 deletions scipy/interpolate/tests/test_rbfinterp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest
import numpy as np
from numpy.linalg import LinAlgError
from numpy.testing import assert_allclose, assert_array_equal
from numpy.testing import assert_allclose
from scipy.stats.qmc import Halton
from scipy.spatial import cKDTree
from scipy.interpolate._rbfinterp import (
Expand Down Expand Up @@ -415,7 +415,7 @@ def test_pickleable(self):
yitp1 = interp(xitp)
yitp2 = pickle.loads(pickle.dumps(interp))(xitp)

assert_array_equal(yitp1, yitp2)
assert_allclose(yitp1, yitp2, atol=1e-16)


class TestRBFInterpolatorNeighborsNone(_TestRBFInterpolator):
Expand Down
8 changes: 6 additions & 2 deletions scipy/interpolate/tests/test_rgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_derivatives(self):

# 2nd derivatives of a linear function are zero
assert_allclose(interp(sample, nu=(0, 1, 1, 0)),
[0, 0, 0], atol=1e-12)
[0, 0, 0], atol=2e-12)

@parametrize_rgi_interp_methods
def test_complex(self, method):
Expand Down Expand Up @@ -983,7 +983,11 @@ def test_matrix_input(self, method):

v1 = interpn((x, y), values, sample, method=method)
v2 = interpn((x, y), np.asarray(values), sample, method=method)
assert_allclose(v1, v2)
if method == "quintic":
# https://github.com/scipy/scipy/issues/20472
assert_allclose(v1, v2, atol=5e-5, rtol=2e-6)
else:
assert_allclose(v1, v2)

def test_length_one_axis(self):
# gh-5890, gh-9524 : length-1 axis is legal for method='linear'.
Expand Down
2 changes: 1 addition & 1 deletion scipy/io/_fast_matrix_market/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def mmread(source):
>>> m
<5x5 sparse matrix of type '<class 'numpy.float64'>'
with 7 stored elements in COOrdinate format>
>>> m.A
>>> m.toarray()
array([[0., 0., 0., 0., 0.],
[0., 0., 1., 0., 0.],
[0., 0., 0., 2., 3.],
Expand Down
5 changes: 2 additions & 3 deletions scipy/linalg/_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,8 @@ def solve_discrete_lyapunov(a, q, method=None):
References
----------
.. [1] Hamilton, James D. Time Series Analysis, Princeton: Princeton
University Press, 1994. 265. Print.
http://doc1.lbfl.li/aca/FLMF037168.pdf
.. [1] "Lyapunov equation", Wikipedia,
https://en.wikipedia.org/wiki/Lyapunov_equation#Discrete_time
.. [2] Gajic, Z., and M.T.J. Qureshi. 2008.
Lyapunov Matrix Equation in System Stability and Control.
Dover Books on Engineering Series. Dover Publications.
Expand Down
4 changes: 2 additions & 2 deletions scipy/linalg/flapack_sym_herm.pyf.src
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ subroutine <prefix2>syevd(compute_v,lower,n,w,a,lda,work,lwork,iwork,liwork,info
<ftype2> dimension(n),intent(out),depend(n) :: w

integer optional,intent(in),depend(n,compute_v) :: lwork=max((compute_v?1+6*n+2*n*n:2*n+1),1)
check(lwork>=(compute_v?1+6*n+2*n*n:2*n+1)) :: lwork
check( (lwork>=((compute_v?1+6*n+2*n*n:2*n+1))) || ((n==1)&&(lwork>=1)) ) :: lwork
<ftype2> dimension(lwork),intent(hide,cache),depend(lwork) :: work

integer optional,intent(in),depend(n,compute_v) :: liwork = (compute_v?3+5*n:1)
Expand Down Expand Up @@ -180,7 +180,7 @@ subroutine <prefix2c>heevd(compute_v,lower,n,w,a,lda,work,lwork,iwork,liwork,rwo
<ftype2> dimension(n),intent(out),depend(n) :: w

integer optional,intent(in),depend(n,compute_v) :: lwork=max((compute_v?2*n+n*n:n+1),1)
check(lwork>=(compute_v?2*n+n*n:n+1)) :: lwork
check( (lwork>=(compute_v?2*n+n*n:n+1)) || ((n==1)&&(lwork>=1)) ) :: lwork
<ftype2c> dimension(lwork),intent(hide,cache),depend(lwork) :: work

integer optional,intent(in),depend(n,compute_v) :: liwork = (compute_v?3+5*n:1)
Expand Down
11 changes: 11 additions & 0 deletions scipy/linalg/tests/test_decomp.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,17 @@ def test_various_drivers_standard(self, driver, dtype_):
atol=1000*np.finfo(dtype_).eps,
rtol=0.)

@pytest.mark.parametrize('driver', ("ev", "evd", "evr", "evx"))
def test_1x1_lwork(self, driver):
w, v = eigh([[1]], driver=driver)
assert_allclose(w, array([1.]), atol=1e-15)
assert_allclose(v, array([[1.]]), atol=1e-15)

# complex case now
w, v = eigh([[1j]], driver=driver)
assert_allclose(w, array([0]), atol=1e-15)
assert_allclose(v, array([[1.]]), atol=1e-15)

@pytest.mark.parametrize('type', (1, 2, 3))
@pytest.mark.parametrize('driver', ("gv", "gvd", "gvx"))
def test_various_drivers_generalized(self, driver, type):
Expand Down
2 changes: 1 addition & 1 deletion scipy/linalg/tests/test_lapack.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ def test_random_matrices(self, dtype, trans, uplo, diag):
elif trans == 'T':
assert_allclose(a.T @ x, b, rtol=5e-5)
elif trans == 'C':
assert_allclose(a.H @ x, b, rtol=5e-5)
assert_allclose(a.T.conjugate() @ x, b, rtol=5e-5)
else:
raise ValueError('Invalid trans argument')

Expand Down
9 changes: 9 additions & 0 deletions scipy/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,15 @@ fortranobject_dep = declare_dependency(
link_with: fortranobject_lib,
include_directories: [inc_np, inc_f2py],
)
# Workaround for numpy#24761 on numpy<1.26.1 (see also gh-20515)
_f2py_c_args = []
if is_mingw
_f2py_c_args = '-DNPY_OS_MINGW'
endif
fortranobject_dep = declare_dependency(
dependencies: fortranobject_dep,
compile_args: _f2py_c_args,
)

# TODO: 64-bit BLAS and LAPACK
#
Expand Down
8 changes: 8 additions & 0 deletions scipy/optimize/tests/test_linprog.py
Original file line number Diff line number Diff line change
Expand Up @@ -1977,6 +1977,10 @@ def test_network_flow_limited_capacity(self):
class TestLinprogIPSparse(LinprogIPTests):
options = {"sparse": True, "cholesky": False, "sym_pos": False}

@pytest.mark.skipif(
sys.platform == 'darwin',
reason="Fails on macOS x86 Accelerate builds (gh-20510)"
)
@pytest.mark.xfail_on_32bit("This test is sensitive to machine epsilon level "
"perturbations in linear system solution in "
"_linprog_ip._sym_solve.")
Expand Down Expand Up @@ -2027,6 +2031,10 @@ def test_sparse_solve_options(self):
class TestLinprogIPSparsePresolve(LinprogIPTests):
options = {"sparse": True, "_sparse_presolve": True}

@pytest.mark.skipif(
sys.platform == 'darwin',
reason="Fails on macOS x86 Accelerate builds (gh-20510)"
)
@pytest.mark.xfail_on_32bit("This test is sensitive to machine epsilon level "
"perturbations in linear system solution in "
"_linprog_ip._sym_solve.")
Expand Down
2 changes: 1 addition & 1 deletion scipy/signal/_peak_finding_utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def _peak_prominences(const np.float64_t[::1] x not None,

if 2 <= wlen:
# Adjust window around the evaluated peak (within bounds);
# if wlen is even the resulting window length is is implicitly
# if wlen is even the resulting window length is implicitly
# rounded to next odd integer
i_min = max(peak - wlen // 2, i_min)
i_max = min(peak + wlen // 2, i_max)
Expand Down
Loading

0 comments on commit 3dff785

Please sign in to comment.