scipy 1.16.0rc2__cp313-cp313-macosx_14_0_arm64.whl → 1.16.2__cp313-cp313-macosx_14_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. scipy/.dylibs/libgcc_s.1.1.dylib +0 -0
  2. scipy/.dylibs/libgfortran.5.dylib +0 -0
  3. scipy/.dylibs/libquadmath.0.dylib +0 -0
  4. scipy/__config__.py +5 -5
  5. scipy/_cyutility.cpython-313-darwin.so +0 -0
  6. scipy/_lib/_ccallback_c.cpython-313-darwin.so +0 -0
  7. scipy/_lib/_test_deprecation_call.cpython-313-darwin.so +0 -0
  8. scipy/_lib/_util.py +7 -0
  9. scipy/_lib/messagestream.cpython-313-darwin.so +0 -0
  10. scipy/cluster/_hierarchy.cpython-313-darwin.so +0 -0
  11. scipy/cluster/_optimal_leaf_ordering.cpython-313-darwin.so +0 -0
  12. scipy/cluster/_vq.cpython-313-darwin.so +0 -0
  13. scipy/conftest.py +25 -0
  14. scipy/fft/_pocketfft/pypocketfft.cpython-313-darwin.so +0 -0
  15. scipy/fftpack/convolve.cpython-313-darwin.so +0 -0
  16. scipy/integrate/_dop.cpython-313-darwin.so +0 -0
  17. scipy/integrate/_lsoda.cpython-313-darwin.so +0 -0
  18. scipy/integrate/_odepack.cpython-313-darwin.so +0 -0
  19. scipy/integrate/_test_odeint_banded.cpython-313-darwin.so +0 -0
  20. scipy/integrate/_vode.cpython-313-darwin.so +0 -0
  21. scipy/interpolate/_dfitpack.cpython-313-darwin.so +0 -0
  22. scipy/interpolate/_fitpack.cpython-313-darwin.so +0 -0
  23. scipy/interpolate/_interpnd.cpython-313-darwin.so +0 -0
  24. scipy/interpolate/_ppoly.cpython-313-darwin.so +0 -0
  25. scipy/interpolate/_rgi_cython.cpython-313-darwin.so +0 -0
  26. scipy/io/_fast_matrix_market/_fmm_core.cpython-313-darwin.so +0 -0
  27. scipy/io/_test_fortran.cpython-313-darwin.so +0 -0
  28. scipy/io/matlab/_mio5_utils.cpython-313-darwin.so +0 -0
  29. scipy/io/matlab/_mio_utils.cpython-313-darwin.so +0 -0
  30. scipy/io/matlab/_streams.cpython-313-darwin.so +0 -0
  31. scipy/io/matlab/tests/test_streams.py +9 -0
  32. scipy/linalg/_cythonized_array_utils.cpython-313-darwin.so +0 -0
  33. scipy/linalg/_decomp_interpolative.cpython-313-darwin.so +0 -0
  34. scipy/linalg/_decomp_lu_cython.cpython-313-darwin.so +0 -0
  35. scipy/linalg/_decomp_update.cpython-313-darwin.so +0 -0
  36. scipy/linalg/_fblas.cpython-313-darwin.so +0 -0
  37. scipy/linalg/_flapack.cpython-313-darwin.so +0 -0
  38. scipy/linalg/_matfuncs_schur_sqrtm.cpython-313-darwin.so +0 -0
  39. scipy/linalg/_matfuncs_sqrtm_triu.cpython-313-darwin.so +0 -0
  40. scipy/linalg/_solve_toeplitz.cpython-313-darwin.so +0 -0
  41. scipy/linalg/blas.py +35 -24
  42. scipy/linalg/cython_blas.cpython-313-darwin.so +0 -0
  43. scipy/linalg/cython_lapack.cpython-313-darwin.so +0 -0
  44. scipy/linalg/tests/test_lapack.py +5 -1
  45. scipy/linalg/tests/test_matfuncs.py +7 -0
  46. scipy/ndimage/_cytest.cpython-313-darwin.so +0 -0
  47. scipy/ndimage/_filters.py +11 -2
  48. scipy/ndimage/_ni_label.cpython-313-darwin.so +0 -0
  49. scipy/ndimage/_rank_filter_1d.cpython-313-darwin.so +0 -0
  50. scipy/ndimage/tests/test_filters.py +52 -0
  51. scipy/odr/__odrpack.cpython-313-darwin.so +0 -0
  52. scipy/optimize/_bglu_dense.cpython-313-darwin.so +0 -0
  53. scipy/optimize/_highspy/_core.cpython-313-darwin.so +0 -0
  54. scipy/optimize/_highspy/_highs_options.cpython-313-darwin.so +0 -0
  55. scipy/optimize/_lbfgsb_py.py +25 -10
  56. scipy/optimize/_lsq/givens_elimination.cpython-313-darwin.so +0 -0
  57. scipy/optimize/_lsq/least_squares.py +2 -2
  58. scipy/optimize/_minimize.py +0 -1
  59. scipy/optimize/_moduleTNC.cpython-313-darwin.so +0 -0
  60. scipy/optimize/_pava_pybind.cpython-313-darwin.so +0 -0
  61. scipy/optimize/_shgo_lib/_complex.py +2 -2
  62. scipy/optimize/_slsqp_py.py +5 -5
  63. scipy/optimize/_slsqplib.cpython-313-darwin.so +0 -0
  64. scipy/optimize/_trlib/_trlib.cpython-313-darwin.so +0 -0
  65. scipy/optimize/cython_optimize/_zeros.cpython-313-darwin.so +0 -0
  66. scipy/optimize/tests/test_optimize.py +12 -3
  67. scipy/signal/_filter_design.py +13 -1
  68. scipy/signal/_fir_filter_design.py +1 -1
  69. scipy/signal/_peak_finding_utils.cpython-313-darwin.so +0 -0
  70. scipy/signal/_polyutils.py +1 -1
  71. scipy/signal/_short_time_fft.py +74 -33
  72. scipy/signal/_sosfilt.cpython-313-darwin.so +0 -0
  73. scipy/signal/_spectral_py.py +2 -2
  74. scipy/signal/_upfirdn_apply.cpython-313-darwin.so +0 -0
  75. scipy/signal/tests/test_filter_design.py +19 -0
  76. scipy/signal/tests/test_fir_filter_design.py +5 -0
  77. scipy/signal/tests/test_short_time_fft.py +9 -0
  78. scipy/signal/tests/test_signaltools.py +9 -3
  79. scipy/signal/tests/test_spectral.py +39 -1
  80. scipy/sparse/_base.py +4 -1
  81. scipy/sparse/_csparsetools.cpython-313-darwin.so +0 -0
  82. scipy/sparse/csgraph/_flow.cpython-313-darwin.so +0 -0
  83. scipy/sparse/csgraph/_matching.cpython-313-darwin.so +0 -0
  84. scipy/sparse/csgraph/_min_spanning_tree.cpython-313-darwin.so +0 -0
  85. scipy/sparse/csgraph/_reordering.cpython-313-darwin.so +0 -0
  86. scipy/sparse/csgraph/_shortest_path.cpython-313-darwin.so +0 -0
  87. scipy/sparse/csgraph/_tools.cpython-313-darwin.so +0 -0
  88. scipy/sparse/csgraph/_traversal.cpython-313-darwin.so +0 -0
  89. scipy/sparse/linalg/_eigen/arpack/_arpack.cpython-313-darwin.so +0 -0
  90. scipy/sparse/linalg/_propack/_cpropack.cpython-313-darwin.so +0 -0
  91. scipy/sparse/linalg/_propack/_dpropack.cpython-313-darwin.so +0 -0
  92. scipy/sparse/linalg/_propack/_spropack.cpython-313-darwin.so +0 -0
  93. scipy/sparse/linalg/_propack/_zpropack.cpython-313-darwin.so +0 -0
  94. scipy/sparse/tests/test_base.py +3 -0
  95. scipy/spatial/_ckdtree.cpython-313-darwin.so +0 -0
  96. scipy/spatial/_distance_pybind.cpython-313-darwin.so +0 -0
  97. scipy/spatial/_hausdorff.cpython-313-darwin.so +0 -0
  98. scipy/spatial/_qhull.cpython-313-darwin.so +0 -0
  99. scipy/spatial/_voronoi.cpython-313-darwin.so +0 -0
  100. scipy/spatial/qhull_src/COPYING_QHULL.txt +39 -0
  101. scipy/spatial/tests/test_distance.py +5 -4
  102. scipy/spatial/transform/_rigid_transform.cpython-313-darwin.so +0 -0
  103. scipy/spatial/transform/_rotation.cpython-313-darwin.so +0 -0
  104. scipy/special/_comb.cpython-313-darwin.so +0 -0
  105. scipy/special/_ellip_harm_2.cpython-313-darwin.so +0 -0
  106. scipy/special/_specfun.cpython-313-darwin.so +0 -0
  107. scipy/special/_test_internal.cpython-313-darwin.so +0 -0
  108. scipy/special/_ufuncs.cpython-313-darwin.so +0 -0
  109. scipy/special/_ufuncs_cxx.cpython-313-darwin.so +0 -0
  110. scipy/special/cython_special.cpython-313-darwin.so +0 -0
  111. scipy/stats/_ansari_swilk_statistics.cpython-313-darwin.so +0 -0
  112. scipy/stats/_biasedurn.cpython-313-darwin.so +0 -0
  113. scipy/stats/_continuous_distns.py +19 -16
  114. scipy/stats/_distribution_infrastructure.py +20 -0
  115. scipy/stats/_levy_stable/levyst.cpython-313-darwin.so +0 -0
  116. scipy/stats/_qmc_cy.cpython-313-darwin.so +0 -0
  117. scipy/stats/_qmvnt_cy.cpython-313-darwin.so +0 -0
  118. scipy/stats/_rcont/rcont.cpython-313-darwin.so +0 -0
  119. scipy/stats/_resampling.py +1 -1
  120. scipy/stats/_sobol.cpython-313-darwin.so +0 -0
  121. scipy/stats/_stats.cpython-313-darwin.so +0 -0
  122. scipy/stats/_stats_py.py +1 -1
  123. scipy/stats/_unuran/unuran_wrapper.cpython-313-darwin.so +0 -0
  124. scipy/stats/tests/test_distributions.py +13 -0
  125. scipy/stats/tests/test_fast_gen_inversion.py +2 -0
  126. scipy/stats/tests/test_morestats.py +4 -4
  127. scipy/version.py +2 -2
  128. {scipy-1.16.0rc2.dist-info → scipy-1.16.2.dist-info}/METADATA +3 -2
  129. {scipy-1.16.0rc2.dist-info → scipy-1.16.2.dist-info}/RECORD +131 -130
  130. {scipy-1.16.0rc2.dist-info → scipy-1.16.2.dist-info}/LICENSE.txt +0 -0
  131. {scipy-1.16.0rc2.dist-info → scipy-1.16.2.dist-info}/WHEEL +0 -0
Binary file
Binary file
Binary file
scipy/__config__.py CHANGED
@@ -36,7 +36,7 @@ CONFIG = _cleanup(
36
36
  "cython": {
37
37
  "name": r"cython",
38
38
  "linker": r"cython",
39
- "version": r"3.1.1",
39
+ "version": r"3.1.3",
40
40
  "commands": r"cython",
41
41
  "args": r"",
42
42
  "linker args": r"",
@@ -52,14 +52,14 @@ CONFIG = _cleanup(
52
52
  "fortran": {
53
53
  "name": "gcc",
54
54
  "linker": r"ld64",
55
- "version": "13.3.0",
55
+ "version": "13.4.0",
56
56
  "commands": r"gfortran",
57
57
  "args": r"",
58
58
  "linker args": r"",
59
59
  },
60
60
  "pythran": {
61
61
  "version": r"0.18.0",
62
- "include directory": r"../../../../../../private/var/folders/y6/nj790rtn62lfktb1sh__79hc0000gn/T/pip-build-env-ll1mab9y/overlay/lib/python3.13/site-packages/pythran"
62
+ "include directory": r"../../../../../../private/var/folders/y6/nj790rtn62lfktb1sh__79hc0000gn/T/build-env-5vut3gta/lib/python3.13/site-packages/pythran"
63
63
  },
64
64
  },
65
65
  "Machine Information": {
@@ -100,13 +100,13 @@ CONFIG = _cleanup(
100
100
  },
101
101
  "pybind11": {
102
102
  "name": "pybind11",
103
- "version": "2.13.6",
103
+ "version": "3.0.1",
104
104
  "detection method": "config-tool",
105
105
  "include directory": r"unknown",
106
106
  },
107
107
  },
108
108
  "Python Information": {
109
- "path": r"/private/var/folders/y6/nj790rtn62lfktb1sh__79hc0000gn/T/cibw-run-py4859z1/cp313-macosx_arm64/build/venv/bin/python",
109
+ "path": r"/private/var/folders/y6/nj790rtn62lfktb1sh__79hc0000gn/T/build-env-5vut3gta/bin/python",
110
110
  "version": "3.13",
111
111
  },
112
112
  }
Binary file
scipy/_lib/_util.py CHANGED
@@ -351,6 +351,13 @@ def _transition_to_rng(old_name, *, position_num=None, end_version=None,
351
351
 
352
352
  return fun(*args, **kwargs)
353
353
 
354
+ # Add the old parameter name to the function signature
355
+ wrapped_signature = inspect.signature(fun)
356
+ wrapper.__signature__ = wrapped_signature.replace(parameters=[
357
+ *wrapped_signature.parameters.values(),
358
+ inspect.Parameter(old_name, inspect.Parameter.KEYWORD_ONLY, default=None),
359
+ ])
360
+
354
361
  if replace_doc:
355
362
  doc = FunctionDoc(wrapper)
356
363
  parameter_names = [param.name for param in doc['Parameters']]
Binary file
scipy/conftest.py CHANGED
@@ -34,6 +34,31 @@ except Exception:
34
34
 
35
35
 
36
36
  def pytest_configure(config):
37
+ """
38
+ Add pytest markers to avoid PytestUnknownMarkWarning
39
+
40
+ This needs to contain all markers that are SciPy-specific, as well as
41
+ dummy fallbacks for markers defined in optional test packages.
42
+
43
+ Note that we need both the registration here *and* in `pytest.ini`.
44
+ """
45
+ config.addinivalue_line("markers",
46
+ "slow: Tests that are very slow.")
47
+ config.addinivalue_line("markers",
48
+ "xslow: mark test as extremely slow (not run unless explicitly requested)")
49
+ config.addinivalue_line("markers",
50
+ "xfail_on_32bit: mark test as failing on 32-bit platforms")
51
+ config.addinivalue_line("markers",
52
+ "array_api_backends: test iterates on all array API backends")
53
+ config.addinivalue_line("markers",
54
+ ("skip_xp_backends(backends, reason=None, np_only=False, cpu_only=False, " +
55
+ "eager_only=False, exceptions=None): mark the desired skip configuration " +
56
+ "for the `skip_xp_backends` fixture"))
57
+ config.addinivalue_line("markers",
58
+ ("xfail_xp_backends(backends, reason=None, np_only=False, cpu_only=False, " +
59
+ "eager_only=False, exceptions=None): mark the desired xfail configuration " +
60
+ "for the `xfail_xp_backends` fixture"))
61
+
37
62
  try:
38
63
  import pytest_timeout # noqa:F401
39
64
  except Exception:
Binary file
Binary file
@@ -2,7 +2,9 @@
2
2
 
3
3
  """
4
4
 
5
+ import platform
5
6
  import os
7
+ import sys
6
8
  import zlib
7
9
 
8
10
  from io import BytesIO
@@ -15,6 +17,7 @@ import numpy as np
15
17
 
16
18
  from numpy.testing import assert_, assert_equal
17
19
  from pytest import raises as assert_raises
20
+ import pytest
18
21
 
19
22
  from scipy.io.matlab._streams import (make_stream,
20
23
  GenericStream, ZlibInputStream,
@@ -194,6 +197,9 @@ class TestZlibInputStream:
194
197
  stream.seek(1024)
195
198
  assert_(stream.all_data_read())
196
199
 
200
+ @pytest.mark.skipif(
201
+ (platform.system() == 'Windows' and sys.version_info >= (3, 14)),
202
+ reason='gh-23185')
197
203
  def test_all_data_read_overlap(self):
198
204
  COMPRESSION_LEVEL = 6
199
205
 
@@ -210,6 +216,9 @@ class TestZlibInputStream:
210
216
  stream.seek(len(data))
211
217
  assert_(stream.all_data_read())
212
218
 
219
+ @pytest.mark.skipif(
220
+ (platform.system() == 'Windows' and sys.version_info >= (3, 14)),
221
+ reason='gh-23185')
213
222
  def test_all_data_read_bad_checksum(self):
214
223
  COMPRESSION_LEVEL = 6
215
224
 
Binary file
Binary file
scipy/linalg/blas.py CHANGED
@@ -45,15 +45,19 @@ BLAS Level 1 functions
45
45
  .. autosummary::
46
46
  :toctree: generated/
47
47
 
48
- caxpy
49
- ccopy
50
- cdotc
51
- cdotu
52
- crotg
53
- cscal
54
- csrot
55
- csscal
56
- cswap
48
+ sasum
49
+ saxpy
50
+ scasum
51
+ scnrm2
52
+ scopy
53
+ sdot
54
+ snrm2
55
+ srot
56
+ srotg
57
+ srotm
58
+ srotmg
59
+ sscal
60
+ sswap
57
61
  dasum
58
62
  daxpy
59
63
  dcopy
@@ -71,19 +75,15 @@ BLAS Level 1 functions
71
75
  idamax
72
76
  isamax
73
77
  izamax
74
- sasum
75
- saxpy
76
- scasum
77
- scnrm2
78
- scopy
79
- sdot
80
- snrm2
81
- srot
82
- srotg
83
- srotm
84
- srotmg
85
- sscal
86
- sswap
78
+ caxpy
79
+ ccopy
80
+ cdotc
81
+ cdotu
82
+ crotg
83
+ cscal
84
+ csrot
85
+ csscal
86
+ cswap
87
87
  zaxpy
88
88
  zcopy
89
89
  zdotc
@@ -104,12 +104,15 @@ BLAS Level 2 functions
104
104
  sgemv
105
105
  sger
106
106
  ssbmv
107
+ sspmv
107
108
  sspr
108
109
  sspr2
109
110
  ssymv
110
111
  ssyr
111
112
  ssyr2
112
113
  stbmv
114
+ stbsv
115
+ stpmv
113
116
  stpsv
114
117
  strmv
115
118
  strsv
@@ -117,12 +120,15 @@ BLAS Level 2 functions
117
120
  dgemv
118
121
  dger
119
122
  dsbmv
123
+ dspmv
120
124
  dspr
121
125
  dspr2
122
126
  dsymv
123
127
  dsyr
124
128
  dsyr2
125
129
  dtbmv
130
+ dtbsv
131
+ dtpmv
126
132
  dtpsv
127
133
  dtrmv
128
134
  dtrsv
@@ -137,13 +143,15 @@ BLAS Level 2 functions
137
143
  chpmv
138
144
  chpr
139
145
  chpr2
146
+ cspmv
147
+ cspr
148
+ csyr
140
149
  ctbmv
141
150
  ctbsv
142
151
  ctpmv
143
152
  ctpsv
144
153
  ctrmv
145
154
  ctrsv
146
- csyr
147
155
  zgbmv
148
156
  zgemv
149
157
  zgerc
@@ -155,12 +163,15 @@ BLAS Level 2 functions
155
163
  zhpmv
156
164
  zhpr
157
165
  zhpr2
166
+ zspmv
167
+ zspr
168
+ zsyr
158
169
  ztbmv
159
170
  ztbsv
160
171
  ztpmv
172
+ ztpsv
161
173
  ztrmv
162
174
  ztrsv
163
- zsyr
164
175
 
165
176
  BLAS Level 3 functions
166
177
  ----------------------
@@ -4,6 +4,7 @@
4
4
 
5
5
  from functools import reduce
6
6
  import random
7
+ import sysconfig
7
8
 
8
9
  from numpy.testing import (assert_equal, assert_array_almost_equal, assert_,
9
10
  assert_allclose, assert_almost_equal,
@@ -503,7 +504,7 @@ class TestDlasd4:
503
504
  roots.append(res[1])
504
505
 
505
506
  assert_(
506
- (res[3] <= 0),
507
+ (res[3] <= 0),
507
508
  f"LAPACK root finding dlasd4 failed to find the singular value {i}"
508
509
  )
509
510
  roots = np.array(roots)[::-1]
@@ -3495,6 +3496,9 @@ def test_sy_hetrs(mtype, dtype, lower):
3495
3496
  def test_sy_he_tri(dtype, lower, mtype):
3496
3497
  if mtype == 'he' and dtype in REAL_DTYPES:
3497
3498
  pytest.skip("hetri not for real dtypes.")
3499
+ if sysconfig.get_platform() == 'win-arm64' and dtype in COMPLEX_DTYPES:
3500
+ pytest.skip("Test segfaulting on win-arm64 in CI, see gh-23133")
3501
+
3498
3502
  rng = np.random.default_rng(1723059677121834)
3499
3503
  n = 20
3500
3504
  A = rng.random((n, n)) + rng.random((n, n))*1j
@@ -460,6 +460,13 @@ class TestSqrtM:
460
460
  np.fill_diagonal(M, 1)
461
461
  assert np.isrealobj(sqrtm(M))
462
462
 
463
+ def test_gh23278(self):
464
+ M = np.array([[1., 0., 0.], [0, 1, -1j], [0, 1j, 2]])
465
+ sq = sqrtm(M)
466
+ assert_allclose(sq @ sq, M, atol=1e-14)
467
+ sq = sqrtm(M.astype(np.complex64))
468
+ assert_allclose(sq @ sq, M, atol=1e-6)
469
+
463
470
  def test_data_size_preservation_uint_in_float_out(self):
464
471
  M = np.eye(10, dtype=np.uint8)
465
472
  assert sqrtm(M).dtype == np.float64
Binary file
scipy/ndimage/_filters.py CHANGED
@@ -232,7 +232,9 @@ def vectorized_filter(input, function, *, size=None, footprint=None, output=None
232
232
  We adjust `size` to the number of dimensions indicated by `axes`.
233
233
  For instance, if `axes` is ``(0, 2, 1)`` and ``n`` is passed for ``size``,
234
234
  then the effective `size` is ``(n, n, n)``.
235
- %(output)s
235
+ output : array, optional
236
+ The array in which to place the output. By default, an array of the dtype
237
+ returned by `function` will be created.
236
238
  mode : {'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional
237
239
  The `mode` parameter determines how the input array is extended
238
240
  beyond its boundaries. Default is 'reflect'. Behavior for each valid
@@ -1987,7 +1989,14 @@ def _rank_filter(input, rank, size=None, footprint=None, output=None,
1987
1989
  "A sequence of modes is not supported by non-separable rank "
1988
1990
  "filters")
1989
1991
  mode = _ni_support._extend_mode_to_code(mode, is_filter=True)
1990
- if input.ndim == 1:
1992
+ # Some corner cases are currently not allowed to use the
1993
+ # "new"/fast 1D rank filter code, including when the
1994
+ # footprint is large compared to the array size.
1995
+ # See discussion in gh-23293; longer-term it may be possible
1996
+ # to allow the fast path for these corner cases as well,
1997
+ # if algorithmic fixes are found.
1998
+ lim2 = input.size - ((footprint.size - 1) // 2 - origin)
1999
+ if input.ndim == 1 and ((lim2 >= 0) or (input.size == 1)):
1991
2000
  if input.dtype in (np.int64, np.float64, np.float32):
1992
2001
  x = input
1993
2002
  x_out = output
@@ -3029,3 +3029,55 @@ class TestVectorizedFilter:
3029
3029
  def test_gh_22586_crash_property(x, size, mode):
3030
3030
  # property-based test for median_filter resilience to hard crashing
3031
3031
  ndimage.median_filter(x, size=size, mode=mode)
3032
+
3033
+
3034
+ @pytest.mark.parametrize('samples, mode, size, expected', [
3035
+ ([1, 2], "reflect", 5, [2, 1]),
3036
+ ([2], "reflect", 5, [2]), # original failure from gh-23075
3037
+ ([2], "nearest", 5, [2]),
3038
+ ([2], "wrap", 5, [2]),
3039
+ ([2], "mirror", 5, [2]),
3040
+ ([2], "constant", 5, [0]),
3041
+ ([2], "reflect", 1, [2]),
3042
+ ([2], "nearest", 1, [2]),
3043
+ ([2], "wrap", 1, [2]),
3044
+ ([2], "mirror", 1, [2]),
3045
+ ([2], "constant", 1, [2]),
3046
+ ([2], "reflect", 100, [2]),
3047
+ ([2], "nearest", 100, [2]),
3048
+ ([2], "wrap", 100, [2]),
3049
+ ([2], "mirror", 100, [2]),
3050
+ ([2], "constant", 100, [0]),
3051
+ ])
3052
+ def test_gh_23075(samples, mode, size, expected):
3053
+ # results verified against SciPy 1.14.1, before the median_filter
3054
+ # overhaul
3055
+ sample_array = np.asarray(samples, dtype=np.float32)
3056
+ expected = np.asarray(expected, dtype=np.float32)
3057
+ filtered_samples = ndimage.median_filter(sample_array, size=size, mode=mode)
3058
+ xp_assert_close(filtered_samples, expected, check_shape=True, check_dtype=True)
3059
+
3060
+
3061
+ @pytest.mark.parametrize('samples, size, cval, expected', [
3062
+ ([2], 5, 17.7, [17.7]),
3063
+ ([2], 1, 0, [2]),
3064
+ ([2], 100, 1.4, [1.4]),
3065
+ ([9], 137, -7807.7, [-7807.7]),
3066
+ ])
3067
+ def test_gh_23075_constant(samples, size, cval, expected):
3068
+ # results verified against SciPy 1.14.1, before the median_filter
3069
+ # overhaul
3070
+ sample_array = np.asarray(samples, dtype=np.single)
3071
+ expected = np.asarray(expected, dtype=np.single)
3072
+ filtered_samples = ndimage.median_filter(sample_array,
3073
+ size=size,
3074
+ mode="constant",
3075
+ cval=cval)
3076
+ xp_assert_close(filtered_samples, expected, check_shape=True, check_dtype=True)
3077
+
3078
+
3079
+ def test_median_filter_lim2():
3080
+ sample_array = np.ones(8)
3081
+ expected = np.ones(8)
3082
+ filtered_samples = ndimage.median_filter(sample_array, size=19, mode="reflect")
3083
+ xp_assert_close(filtered_samples, expected, check_shape=True, check_dtype=True)
Binary file
@@ -42,6 +42,8 @@ from ._optimize import (MemoizeJac, OptimizeResult, _call_callback_maybe_halt,
42
42
  from ._constraints import old_bound_to_new
43
43
 
44
44
  from scipy.sparse.linalg import LinearOperator
45
+ from scipy._lib.deprecation import _NoValue
46
+ import warnings
45
47
 
46
48
  __all__ = ['fmin_l_bfgs_b', 'LbfgsInvHessProduct']
47
49
 
@@ -93,7 +95,7 @@ def fmin_l_bfgs_b(func, x0, fprime=None, args=(),
93
95
  approx_grad=0,
94
96
  bounds=None, m=10, factr=1e7, pgtol=1e-5,
95
97
  epsilon=1e-8,
96
- iprint=-1, maxfun=15000, maxiter=15000, disp=None,
98
+ iprint=_NoValue, maxfun=15000, maxiter=15000, disp=_NoValue,
97
99
  callback=None, maxls=20):
98
100
  """
99
101
  Minimize a function func using the L-BFGS-B algorithm.
@@ -144,7 +146,7 @@ def fmin_l_bfgs_b(func, x0, fprime=None, args=(),
144
146
  output and this keyword has no function.
145
147
 
146
148
  .. deprecated:: 1.15.0
147
- This keyword is deprecated and will be removed from SciPy 1.17.0.
149
+ This keyword is deprecated and will be removed from SciPy 1.18.0.
148
150
 
149
151
  disp : int, optional
150
152
  Deprecated option that previously controlled the text printed on the
@@ -152,7 +154,7 @@ def fmin_l_bfgs_b(func, x0, fprime=None, args=(),
152
154
  output and this keyword has no function.
153
155
 
154
156
  .. deprecated:: 1.15.0
155
- This keyword is deprecated and will be removed from SciPy 1.17.0.
157
+ This keyword is deprecated and will be removed from SciPy 1.18.0.
156
158
 
157
159
  maxfun : int, optional
158
160
  Maximum number of function evaluations. Note that this function
@@ -265,7 +267,9 @@ def fmin_l_bfgs_b(func, x0, fprime=None, args=(),
265
267
 
266
268
  # build options
267
269
  callback = _wrap_callback(callback)
268
- opts = {'maxcor': m,
270
+ opts = {'disp': disp,
271
+ 'iprint': iprint,
272
+ 'maxcor': m,
269
273
  'ftol': factr * np.finfo(float).eps,
270
274
  'gtol': pgtol,
271
275
  'eps': epsilon,
@@ -288,9 +292,9 @@ def fmin_l_bfgs_b(func, x0, fprime=None, args=(),
288
292
 
289
293
 
290
294
  def _minimize_lbfgsb(fun, x0, args=(), jac=None, bounds=None,
291
- disp=None, maxcor=10, ftol=2.2204460492503131e-09,
295
+ disp=_NoValue, maxcor=10, ftol=2.2204460492503131e-09,
292
296
  gtol=1e-5, eps=1e-8, maxfun=15000, maxiter=15000,
293
- iprint=-1, callback=None, maxls=20,
297
+ iprint=_NoValue, callback=None, maxls=20,
294
298
  finite_diff_rel_step=None, workers=None,
295
299
  **unknown_options):
296
300
  """
@@ -305,7 +309,7 @@ def _minimize_lbfgsb(fun, x0, args=(), jac=None, bounds=None,
305
309
  output and this keyword has no function.
306
310
 
307
311
  .. deprecated:: 1.15.0
308
- This keyword is deprecated and will be removed from SciPy 1.17.0.
312
+ This keyword is deprecated and will be removed from SciPy 1.18.0.
309
313
 
310
314
  maxcor : int
311
315
  The maximum number of variable metric corrections used to
@@ -334,7 +338,7 @@ def _minimize_lbfgsb(fun, x0, args=(), jac=None, bounds=None,
334
338
  output and this keyword has no function.
335
339
 
336
340
  .. deprecated:: 1.15.0
337
- This keyword is deprecated and will be removed from SciPy 1.17.0.
341
+ This keyword is deprecated and will be removed from SciPy 1.18.0.
338
342
 
339
343
  maxls : int, optional
340
344
  Maximum number of line search steps (per iteration). Default is 20.
@@ -373,6 +377,17 @@ def _minimize_lbfgsb(fun, x0, args=(), jac=None, bounds=None,
373
377
 
374
378
  x0 = asarray(x0).ravel()
375
379
  n, = x0.shape
380
+ if disp is not _NoValue:
381
+ warnings.warn("scipy.optimize: The `disp` and `iprint` options of the "
382
+ "L-BFGS-B solver are deprecated and will be removed in "
383
+ "SciPy 1.18.0.",
384
+ DeprecationWarning, stacklevel=3)
385
+
386
+ if iprint is not _NoValue:
387
+ warnings.warn("scipy.optimize: The `disp` and `iprint` options of the "
388
+ "L-BFGS-B solver are deprecated and will be removed in "
389
+ "SciPy 1.18.0.",
390
+ DeprecationWarning, stacklevel=3)
376
391
 
377
392
  # historically old-style bounds were/are expected by lbfgsb.
378
393
  # That's still the case but we'll deal with new-style from here on,
@@ -425,8 +440,8 @@ def _minimize_lbfgsb(fun, x0, args=(), jac=None, bounds=None,
425
440
  raise ValueError('maxls must be positive.')
426
441
 
427
442
  x = array(x0, dtype=np.float64)
428
- f = array(0.0, dtype=np.int32)
429
- g = zeros((n,), dtype=np.int32)
443
+ f = array(0.0, dtype=np.float64)
444
+ g = zeros((n,), dtype=np.float64)
430
445
  wa = zeros(2*m*n + 5*n + 11*m*m + 8*m, float64)
431
446
  iwa = zeros(3*n, dtype=np.int32)
432
447
  task = zeros(2, dtype=np.int32)
@@ -17,7 +17,7 @@ from .trf import trf
17
17
  from .dogbox import dogbox
18
18
  from .common import EPS, in_bounds, make_strictly_feasible
19
19
 
20
-
20
+
21
21
  from scipy.optimize._optimize import _wrap_callback
22
22
 
23
23
  TERMINATION_MESSAGES = {
@@ -392,7 +392,7 @@ def least_squares(
392
392
 
393
393
  * For 'trf' : ``x_scale == 1``
394
394
  * For 'dogbox' : ``x_scale == 1``
395
- * For 'jac' : ``x_scale == 'jac'``
395
+ * For 'lm' : ``x_scale == 'jac'``
396
396
 
397
397
  .. versionchanged:: 1.16.0
398
398
  The default keyword value is changed from 1 to None to indicate that
@@ -188,7 +188,6 @@ def minimize(fun, x0, args=(), method=None, jac=None, hess=None,
188
188
 
189
189
  Equality constraint means that the constraint function result is to
190
190
  be zero whereas inequality means that it is to be non-negative.
191
- Note that COBYLA only supports inequality constraints.
192
191
 
193
192
  tol : float, optional
194
193
  Tolerance for termination. When `tol` is specified, the selected
@@ -183,6 +183,7 @@ class Complex:
183
183
  self.V = VertexCacheIndex()
184
184
 
185
185
  self.V_non_symm = [] # List of non-symmetric vertices
186
+ self.split_edge = cache(self._split_edge)
186
187
 
187
188
  def __call__(self):
188
189
  return self.H
@@ -995,8 +996,7 @@ class Complex:
995
996
  d_v0v1.connect(d_v1v2)
996
997
  return
997
998
 
998
- @cache
999
- def split_edge(self, v1, v2):
999
+ def _split_edge(self, v1, v2):
1000
1000
  v1 = self.V[v1]
1001
1001
  v2 = self.V[v2]
1002
1002
  # Destroy original edge, if it exists: