scipy 1.16.0rc1__cp311-cp311-win_amd64.whl → 1.16.1__cp311-cp311-win_amd64.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.
- scipy/__config__.py +9 -9
- scipy/__init__.py +3 -3
- scipy/_cyutility.cp311-win_amd64.dll.a +0 -0
- scipy/_cyutility.cp311-win_amd64.pyd +0 -0
- scipy/_lib/_ccallback_c.cp311-win_amd64.dll.a +0 -0
- scipy/_lib/_ccallback_c.cp311-win_amd64.pyd +0 -0
- scipy/_lib/_fpumode.cp311-win_amd64.dll.a +0 -0
- scipy/_lib/_fpumode.cp311-win_amd64.pyd +0 -0
- scipy/_lib/_test_ccallback.cp311-win_amd64.dll.a +0 -0
- scipy/_lib/_test_ccallback.cp311-win_amd64.pyd +0 -0
- scipy/_lib/_test_deprecation_call.cp311-win_amd64.dll.a +0 -0
- scipy/_lib/_test_deprecation_call.cp311-win_amd64.pyd +0 -0
- scipy/_lib/_test_deprecation_def.cp311-win_amd64.dll.a +0 -0
- scipy/_lib/_test_deprecation_def.cp311-win_amd64.pyd +0 -0
- scipy/_lib/_uarray/_uarray.cp311-win_amd64.dll.a +0 -0
- scipy/_lib/_uarray/_uarray.cp311-win_amd64.pyd +0 -0
- scipy/_lib/_util.py +7 -0
- scipy/_lib/messagestream.cp311-win_amd64.dll.a +0 -0
- scipy/_lib/messagestream.cp311-win_amd64.pyd +0 -0
- scipy/cluster/_hierarchy.cp311-win_amd64.dll.a +0 -0
- scipy/cluster/_hierarchy.cp311-win_amd64.pyd +0 -0
- scipy/cluster/_optimal_leaf_ordering.cp311-win_amd64.dll.a +0 -0
- scipy/cluster/_optimal_leaf_ordering.cp311-win_amd64.pyd +0 -0
- scipy/cluster/_vq.cp311-win_amd64.dll.a +0 -0
- scipy/cluster/_vq.cp311-win_amd64.pyd +0 -0
- scipy/conftest.py +25 -0
- scipy/fft/_pocketfft/pypocketfft.cp311-win_amd64.dll.a +0 -0
- scipy/fft/_pocketfft/pypocketfft.cp311-win_amd64.pyd +0 -0
- scipy/fftpack/convolve.cp311-win_amd64.dll.a +0 -0
- scipy/fftpack/convolve.cp311-win_amd64.pyd +0 -0
- scipy/integrate/_dop.cp311-win_amd64.dll.a +0 -0
- scipy/integrate/_dop.cp311-win_amd64.pyd +0 -0
- scipy/integrate/_lsoda.cp311-win_amd64.dll.a +0 -0
- scipy/integrate/_lsoda.cp311-win_amd64.pyd +0 -0
- scipy/integrate/_odepack.cp311-win_amd64.dll.a +0 -0
- scipy/integrate/_odepack.cp311-win_amd64.pyd +0 -0
- scipy/integrate/_quadpack.cp311-win_amd64.dll.a +0 -0
- scipy/integrate/_quadpack.cp311-win_amd64.pyd +0 -0
- scipy/integrate/_test_multivariate.cp311-win_amd64.dll.a +0 -0
- scipy/integrate/_test_multivariate.cp311-win_amd64.pyd +0 -0
- scipy/integrate/_test_odeint_banded.cp311-win_amd64.dll.a +0 -0
- scipy/integrate/_test_odeint_banded.cp311-win_amd64.pyd +0 -0
- scipy/integrate/_vode.cp311-win_amd64.dll.a +0 -0
- scipy/integrate/_vode.cp311-win_amd64.pyd +0 -0
- scipy/interpolate/_dfitpack.cp311-win_amd64.dll.a +0 -0
- scipy/interpolate/_dfitpack.cp311-win_amd64.pyd +0 -0
- scipy/interpolate/_dierckx.cp311-win_amd64.dll.a +0 -0
- scipy/interpolate/_dierckx.cp311-win_amd64.pyd +0 -0
- scipy/interpolate/_fitpack.cp311-win_amd64.dll.a +0 -0
- scipy/interpolate/_fitpack.cp311-win_amd64.pyd +0 -0
- scipy/interpolate/_interpnd.cp311-win_amd64.dll.a +0 -0
- scipy/interpolate/_interpnd.cp311-win_amd64.pyd +0 -0
- scipy/interpolate/_ppoly.cp311-win_amd64.dll.a +0 -0
- scipy/interpolate/_ppoly.cp311-win_amd64.pyd +0 -0
- scipy/interpolate/_rbfinterp_pythran.cp311-win_amd64.dll.a +0 -0
- scipy/interpolate/_rbfinterp_pythran.cp311-win_amd64.pyd +0 -0
- scipy/interpolate/_rgi_cython.cp311-win_amd64.dll.a +0 -0
- scipy/interpolate/_rgi_cython.cp311-win_amd64.pyd +0 -0
- scipy/io/_fast_matrix_market/_fmm_core.cp311-win_amd64.dll.a +0 -0
- scipy/io/_fast_matrix_market/_fmm_core.cp311-win_amd64.pyd +0 -0
- scipy/io/_test_fortran.cp311-win_amd64.dll.a +0 -0
- scipy/io/_test_fortran.cp311-win_amd64.pyd +0 -0
- scipy/io/matlab/_mio5_utils.cp311-win_amd64.dll.a +0 -0
- scipy/io/matlab/_mio5_utils.cp311-win_amd64.pyd +0 -0
- scipy/io/matlab/_mio_utils.cp311-win_amd64.dll.a +0 -0
- scipy/io/matlab/_mio_utils.cp311-win_amd64.pyd +0 -0
- scipy/io/matlab/_streams.cp311-win_amd64.dll.a +0 -0
- scipy/io/matlab/_streams.cp311-win_amd64.pyd +0 -0
- scipy/io/matlab/tests/test_streams.py +9 -0
- scipy/linalg/_cythonized_array_utils.cp311-win_amd64.dll.a +0 -0
- scipy/linalg/_cythonized_array_utils.cp311-win_amd64.pyd +0 -0
- scipy/linalg/_decomp_interpolative.cp311-win_amd64.dll.a +0 -0
- scipy/linalg/_decomp_interpolative.cp311-win_amd64.pyd +0 -0
- scipy/linalg/_decomp_lu_cython.cp311-win_amd64.dll.a +0 -0
- scipy/linalg/_decomp_lu_cython.cp311-win_amd64.pyd +0 -0
- scipy/linalg/_decomp_update.cp311-win_amd64.dll.a +0 -0
- scipy/linalg/_decomp_update.cp311-win_amd64.pyd +0 -0
- scipy/linalg/_fblas.cp311-win_amd64.dll.a +0 -0
- scipy/linalg/_fblas.cp311-win_amd64.pyd +0 -0
- scipy/linalg/_flapack.cp311-win_amd64.dll.a +0 -0
- scipy/linalg/_flapack.cp311-win_amd64.pyd +0 -0
- scipy/linalg/_linalg_pythran.cp311-win_amd64.dll.a +0 -0
- scipy/linalg/_linalg_pythran.cp311-win_amd64.pyd +0 -0
- scipy/linalg/_matfuncs_expm.cp311-win_amd64.dll.a +0 -0
- scipy/linalg/_matfuncs_expm.cp311-win_amd64.pyd +0 -0
- scipy/linalg/_matfuncs_schur_sqrtm.cp311-win_amd64.dll.a +0 -0
- scipy/linalg/_matfuncs_schur_sqrtm.cp311-win_amd64.pyd +0 -0
- scipy/linalg/_matfuncs_sqrtm_triu.cp311-win_amd64.dll.a +0 -0
- scipy/linalg/_matfuncs_sqrtm_triu.cp311-win_amd64.pyd +0 -0
- scipy/linalg/_solve_toeplitz.cp311-win_amd64.dll.a +0 -0
- scipy/linalg/_solve_toeplitz.cp311-win_amd64.pyd +0 -0
- scipy/linalg/blas.py +35 -24
- scipy/linalg/cython_blas.cp311-win_amd64.dll.a +0 -0
- scipy/linalg/cython_blas.cp311-win_amd64.pyd +0 -0
- scipy/linalg/cython_lapack.cp311-win_amd64.dll.a +0 -0
- scipy/linalg/cython_lapack.cp311-win_amd64.pyd +0 -0
- scipy/linalg/tests/test_matfuncs.py +7 -0
- scipy/ndimage/_ctest.cp311-win_amd64.dll.a +0 -0
- scipy/ndimage/_ctest.cp311-win_amd64.pyd +0 -0
- scipy/ndimage/_cytest.cp311-win_amd64.dll.a +0 -0
- scipy/ndimage/_cytest.cp311-win_amd64.pyd +0 -0
- scipy/ndimage/_filters.py +52 -23
- scipy/ndimage/_nd_image.cp311-win_amd64.dll.a +0 -0
- scipy/ndimage/_nd_image.cp311-win_amd64.pyd +0 -0
- scipy/ndimage/_ni_label.cp311-win_amd64.dll.a +0 -0
- scipy/ndimage/_ni_label.cp311-win_amd64.pyd +0 -0
- scipy/ndimage/_rank_filter_1d.cp311-win_amd64.dll.a +0 -0
- scipy/ndimage/_rank_filter_1d.cp311-win_amd64.pyd +0 -0
- scipy/ndimage/tests/test_filters.py +94 -9
- scipy/odr/__odrpack.cp311-win_amd64.dll.a +0 -0
- scipy/odr/__odrpack.cp311-win_amd64.pyd +0 -0
- scipy/optimize/_bglu_dense.cp311-win_amd64.dll.a +0 -0
- scipy/optimize/_bglu_dense.cp311-win_amd64.pyd +0 -0
- scipy/optimize/_direct.cp311-win_amd64.dll.a +0 -0
- scipy/optimize/_direct.cp311-win_amd64.pyd +0 -0
- scipy/optimize/_group_columns.cp311-win_amd64.dll.a +0 -0
- scipy/optimize/_group_columns.cp311-win_amd64.pyd +0 -0
- scipy/optimize/_highspy/_core.cp311-win_amd64.dll.a +0 -0
- scipy/optimize/_highspy/_core.cp311-win_amd64.pyd +0 -0
- scipy/optimize/_highspy/_highs_options.cp311-win_amd64.dll.a +0 -0
- scipy/optimize/_highspy/_highs_options.cp311-win_amd64.pyd +0 -0
- scipy/optimize/_lbfgsb.cp311-win_amd64.dll.a +0 -0
- scipy/optimize/_lbfgsb.cp311-win_amd64.pyd +0 -0
- scipy/optimize/_lbfgsb_py.py +23 -8
- scipy/optimize/_lsap.cp311-win_amd64.dll.a +0 -0
- scipy/optimize/_lsap.cp311-win_amd64.pyd +0 -0
- scipy/optimize/_lsq/givens_elimination.cp311-win_amd64.dll.a +0 -0
- scipy/optimize/_lsq/givens_elimination.cp311-win_amd64.pyd +0 -0
- scipy/optimize/_lsq/least_squares.py +2 -2
- scipy/optimize/_minimize.py +0 -1
- scipy/optimize/_minpack.cp311-win_amd64.dll.a +0 -0
- scipy/optimize/_minpack.cp311-win_amd64.pyd +0 -0
- scipy/optimize/_moduleTNC.cp311-win_amd64.dll.a +0 -0
- scipy/optimize/_moduleTNC.cp311-win_amd64.pyd +0 -0
- scipy/optimize/_pava_pybind.cp311-win_amd64.dll.a +0 -0
- scipy/optimize/_pava_pybind.cp311-win_amd64.pyd +0 -0
- scipy/optimize/_shgo_lib/_complex.py +2 -2
- scipy/optimize/_slsqplib.cp311-win_amd64.dll.a +0 -0
- scipy/optimize/_slsqplib.cp311-win_amd64.pyd +0 -0
- scipy/optimize/_trlib/_trlib.cp311-win_amd64.dll.a +0 -0
- scipy/optimize/_trlib/_trlib.cp311-win_amd64.pyd +0 -0
- scipy/optimize/_zeros.cp311-win_amd64.dll.a +0 -0
- scipy/optimize/_zeros.cp311-win_amd64.pyd +0 -0
- scipy/optimize/cython_optimize/_zeros.cp311-win_amd64.dll.a +0 -0
- scipy/optimize/cython_optimize/_zeros.cp311-win_amd64.pyd +0 -0
- scipy/optimize/tests/test_lsq_linear.py +1 -1
- scipy/optimize/tests/test_optimize.py +3 -3
- scipy/signal/_filter_design.py +13 -1
- scipy/signal/_fir_filter_design.py +1 -1
- scipy/signal/_max_len_seq_inner.cp311-win_amd64.dll.a +0 -0
- scipy/signal/_max_len_seq_inner.cp311-win_amd64.pyd +0 -0
- scipy/signal/_peak_finding_utils.cp311-win_amd64.dll.a +0 -0
- scipy/signal/_peak_finding_utils.cp311-win_amd64.pyd +0 -0
- scipy/signal/_polyutils.py +1 -1
- scipy/signal/_sigtools.cp311-win_amd64.dll.a +0 -0
- scipy/signal/_sigtools.cp311-win_amd64.pyd +0 -0
- scipy/signal/_sosfilt.cp311-win_amd64.dll.a +0 -0
- scipy/signal/_sosfilt.cp311-win_amd64.pyd +0 -0
- scipy/signal/_spectral_py.py +9 -0
- scipy/signal/_spline.cp311-win_amd64.dll.a +0 -0
- scipy/signal/_spline.cp311-win_amd64.pyd +0 -0
- scipy/signal/_upfirdn_apply.cp311-win_amd64.dll.a +0 -0
- scipy/signal/_upfirdn_apply.cp311-win_amd64.pyd +0 -0
- scipy/signal/tests/test_filter_design.py +19 -0
- scipy/signal/tests/test_fir_filter_design.py +5 -0
- scipy/signal/tests/test_signaltools.py +1 -1
- scipy/signal/tests/test_spectral.py +31 -0
- scipy/sparse/_base.py +5 -2
- scipy/sparse/_csparsetools.cp311-win_amd64.dll.a +0 -0
- scipy/sparse/_csparsetools.cp311-win_amd64.pyd +0 -0
- scipy/sparse/_sparsetools.cp311-win_amd64.dll.a +0 -0
- scipy/sparse/_sparsetools.cp311-win_amd64.pyd +0 -0
- scipy/sparse/csgraph/_flow.cp311-win_amd64.dll.a +0 -0
- scipy/sparse/csgraph/_flow.cp311-win_amd64.pyd +0 -0
- scipy/sparse/csgraph/_matching.cp311-win_amd64.dll.a +0 -0
- scipy/sparse/csgraph/_matching.cp311-win_amd64.pyd +0 -0
- scipy/sparse/csgraph/_min_spanning_tree.cp311-win_amd64.dll.a +0 -0
- scipy/sparse/csgraph/_min_spanning_tree.cp311-win_amd64.pyd +0 -0
- scipy/sparse/csgraph/_reordering.cp311-win_amd64.dll.a +0 -0
- scipy/sparse/csgraph/_reordering.cp311-win_amd64.pyd +0 -0
- scipy/sparse/csgraph/_shortest_path.cp311-win_amd64.dll.a +0 -0
- scipy/sparse/csgraph/_shortest_path.cp311-win_amd64.pyd +0 -0
- scipy/sparse/csgraph/_tools.cp311-win_amd64.dll.a +0 -0
- scipy/sparse/csgraph/_tools.cp311-win_amd64.pyd +0 -0
- scipy/sparse/csgraph/_traversal.cp311-win_amd64.dll.a +0 -0
- scipy/sparse/csgraph/_traversal.cp311-win_amd64.pyd +0 -0
- scipy/sparse/linalg/_dsolve/_superlu.cp311-win_amd64.dll.a +0 -0
- scipy/sparse/linalg/_dsolve/_superlu.cp311-win_amd64.pyd +0 -0
- scipy/sparse/linalg/_eigen/arpack/_arpack.cp311-win_amd64.dll.a +0 -0
- scipy/sparse/linalg/_eigen/arpack/_arpack.cp311-win_amd64.pyd +0 -0
- scipy/sparse/linalg/_propack/_cpropack.cp311-win_amd64.dll.a +0 -0
- scipy/sparse/linalg/_propack/_cpropack.cp311-win_amd64.pyd +0 -0
- scipy/sparse/linalg/_propack/_dpropack.cp311-win_amd64.dll.a +0 -0
- scipy/sparse/linalg/_propack/_dpropack.cp311-win_amd64.pyd +0 -0
- scipy/sparse/linalg/_propack/_spropack.cp311-win_amd64.dll.a +0 -0
- scipy/sparse/linalg/_propack/_spropack.cp311-win_amd64.pyd +0 -0
- scipy/sparse/linalg/_propack/_zpropack.cp311-win_amd64.dll.a +0 -0
- scipy/sparse/linalg/_propack/_zpropack.cp311-win_amd64.pyd +0 -0
- scipy/sparse/tests/test_base.py +10 -0
- scipy/spatial/_ckdtree.cp311-win_amd64.dll.a +0 -0
- scipy/spatial/_ckdtree.cp311-win_amd64.pyd +0 -0
- scipy/spatial/_distance_pybind.cp311-win_amd64.dll.a +0 -0
- scipy/spatial/_distance_pybind.cp311-win_amd64.pyd +0 -0
- scipy/spatial/_distance_wrap.cp311-win_amd64.dll.a +0 -0
- scipy/spatial/_distance_wrap.cp311-win_amd64.pyd +0 -0
- scipy/spatial/_hausdorff.cp311-win_amd64.dll.a +0 -0
- scipy/spatial/_hausdorff.cp311-win_amd64.pyd +0 -0
- scipy/spatial/_qhull.cp311-win_amd64.dll.a +0 -0
- scipy/spatial/_qhull.cp311-win_amd64.pyd +0 -0
- scipy/spatial/_voronoi.cp311-win_amd64.dll.a +0 -0
- scipy/spatial/_voronoi.cp311-win_amd64.pyd +0 -0
- scipy/spatial/tests/test_distance.py +12 -0
- scipy/spatial/transform/_rigid_transform.cp311-win_amd64.dll.a +0 -0
- scipy/spatial/transform/_rigid_transform.cp311-win_amd64.pyd +0 -0
- scipy/spatial/transform/_rotation.cp311-win_amd64.dll.a +0 -0
- scipy/spatial/transform/_rotation.cp311-win_amd64.pyd +0 -0
- scipy/special/_comb.cp311-win_amd64.dll.a +0 -0
- scipy/special/_comb.cp311-win_amd64.pyd +0 -0
- scipy/special/_ellip_harm_2.cp311-win_amd64.dll.a +0 -0
- scipy/special/_ellip_harm_2.cp311-win_amd64.pyd +0 -0
- scipy/special/_gufuncs.cp311-win_amd64.dll.a +0 -0
- scipy/special/_gufuncs.cp311-win_amd64.pyd +0 -0
- scipy/special/_specfun.cp311-win_amd64.dll.a +0 -0
- scipy/special/_specfun.cp311-win_amd64.pyd +0 -0
- scipy/special/_special_ufuncs.cp311-win_amd64.dll.a +0 -0
- scipy/special/_special_ufuncs.cp311-win_amd64.pyd +0 -0
- scipy/special/_test_internal.cp311-win_amd64.dll.a +0 -0
- scipy/special/_test_internal.cp311-win_amd64.pyd +0 -0
- scipy/special/_ufuncs.cp311-win_amd64.dll.a +0 -0
- scipy/special/_ufuncs.cp311-win_amd64.pyd +0 -0
- scipy/special/_ufuncs_cxx.cp311-win_amd64.dll.a +0 -0
- scipy/special/_ufuncs_cxx.cp311-win_amd64.pyd +0 -0
- scipy/special/cython_special.cp311-win_amd64.dll.a +0 -0
- scipy/special/cython_special.cp311-win_amd64.pyd +0 -0
- scipy/stats/_ansari_swilk_statistics.cp311-win_amd64.dll.a +0 -0
- scipy/stats/_ansari_swilk_statistics.cp311-win_amd64.pyd +0 -0
- scipy/stats/_axis_nan_policy.py +1 -9
- scipy/stats/_biasedurn.cp311-win_amd64.dll.a +0 -0
- scipy/stats/_biasedurn.cp311-win_amd64.pyd +0 -0
- scipy/stats/_continuous_distns.py +19 -16
- scipy/stats/_correlation.py +1 -1
- scipy/stats/_distribution_infrastructure.py +20 -0
- scipy/stats/_entropy.py +2 -2
- scipy/stats/_hypotests.py +1 -1
- scipy/stats/_levy_stable/levyst.cp311-win_amd64.dll.a +0 -0
- scipy/stats/_levy_stable/levyst.cp311-win_amd64.pyd +0 -0
- scipy/stats/_morestats.py +7 -7
- scipy/stats/_qmc_cy.cp311-win_amd64.dll.a +0 -0
- scipy/stats/_qmc_cy.cp311-win_amd64.pyd +0 -0
- scipy/stats/_qmvnt_cy.cp311-win_amd64.dll.a +0 -0
- scipy/stats/_qmvnt_cy.cp311-win_amd64.pyd +0 -0
- scipy/stats/_rcont/rcont.cp311-win_amd64.dll.a +0 -0
- scipy/stats/_rcont/rcont.cp311-win_amd64.pyd +0 -0
- scipy/stats/_resampling.py +1 -1
- scipy/stats/_sobol.cp311-win_amd64.dll.a +0 -0
- scipy/stats/_sobol.cp311-win_amd64.pyd +0 -0
- scipy/stats/_stats.cp311-win_amd64.dll.a +0 -0
- scipy/stats/_stats.cp311-win_amd64.pyd +0 -0
- scipy/stats/_stats_mstats_common.py +4 -2
- scipy/stats/_stats_py.py +19 -19
- scipy/stats/_stats_pythran.cp311-win_amd64.dll.a +0 -0
- scipy/stats/_stats_pythran.cp311-win_amd64.pyd +0 -0
- scipy/stats/_unuran/unuran_wrapper.cp311-win_amd64.dll.a +0 -0
- scipy/stats/_unuran/unuran_wrapper.cp311-win_amd64.pyd +0 -0
- scipy/stats/_variation.py +1 -1
- scipy/stats/tests/test_distributions.py +13 -0
- scipy/stats/tests/test_fast_gen_inversion.py +2 -0
- scipy/stats/tests/test_morestats.py +4 -4
- scipy/version.py +2 -2
- scipy-1.16.1.dist-info/DELVEWHEEL +2 -0
- {scipy-1.16.0rc1.dist-info → scipy-1.16.1.dist-info}/LICENSE.txt +3 -3
- {scipy-1.16.0rc1.dist-info → scipy-1.16.1.dist-info}/METADATA +5 -4
- {scipy-1.16.0rc1.dist-info → scipy-1.16.1.dist-info}/RECORD +276 -276
- scipy-1.16.0rc1.dist-info/DELVEWHEEL +0 -2
- /scipy-1.16.0rc1-cp311-cp311-win_amd64.whl → /scipy-1.16.1-cp311-cp311-win_amd64.whl +0 -0
- {scipy-1.16.0rc1.dist-info → scipy-1.16.1.dist-info}/WHEEL +0 -0
- /scipy.libs/{libscipy_openblas-f07f5a5d207a3a47104dca54d6d0c86a.dll → libscipy_openblas-6b2103f2ae4d8547998b5d188e9801fb.dll} +0 -0
scipy/ndimage/_filters.py
CHANGED
@@ -68,12 +68,23 @@ def _vectorized_filter_iv(input, function, size, footprint, output, mode, cval,
|
|
68
68
|
if size is not None and footprint is not None:
|
69
69
|
raise ValueError("Either `size` or `footprint` may be provided, not both.")
|
70
70
|
|
71
|
-
|
72
|
-
|
71
|
+
if axes is None:
|
72
|
+
axes = tuple(range(-input.ndim, 0))
|
73
|
+
elif np.isscalar(axes):
|
74
|
+
axes = (axes,)
|
75
|
+
n_axes = len(axes)
|
76
|
+
n_batch = input.ndim - n_axes
|
77
|
+
|
78
|
+
if n_axes > input.ndim:
|
79
|
+
message = ("The length of `axes` may not exceed the dimensionality of `input`"
|
80
|
+
"(`input.ndim`).")
|
81
|
+
raise ValueError(message)
|
82
|
+
|
83
|
+
# Either footprint or size must be provided
|
73
84
|
footprinted_function = function
|
74
85
|
if size is not None:
|
75
86
|
# If provided, size must be an integer or tuple of integers.
|
76
|
-
size = (size,)*
|
87
|
+
size = (size,)*n_axes if np.isscalar(size) else tuple(size)
|
77
88
|
valid = [xp.isdtype(xp.asarray(i).dtype, 'integral') and i > 0 for i in size]
|
78
89
|
if not all(valid):
|
79
90
|
raise ValueError("All elements of `size` must be positive integers.")
|
@@ -84,13 +95,10 @@ def _vectorized_filter_iv(input, function, size, footprint, output, mode, cval,
|
|
84
95
|
def footprinted_function(input, *args, axis=-1, **kwargs):
|
85
96
|
return function(input[..., footprint], *args, axis=-1, **kwargs)
|
86
97
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
if n_axes > input.ndim:
|
92
|
-
message = ("The dimensionality of the window (`len(size)` or `footprint.ndim`) "
|
93
|
-
"may not exceed the number of axes of `input` (`input.ndim`).")
|
98
|
+
# And by now, the dimensionality of the footprint must equal the number of axes
|
99
|
+
if n_axes != len(size):
|
100
|
+
message = ("`axes` must be compatible with the dimensionality "
|
101
|
+
"of the window specified by `size` or `footprint`.")
|
94
102
|
raise ValueError(message)
|
95
103
|
|
96
104
|
# If this is not *equal* to the dimensionality of `input`, then `axes`
|
@@ -101,9 +109,10 @@ def _vectorized_filter_iv(input, function, size, footprint, output, mode, cval,
|
|
101
109
|
"(`len(size)` or `footprint.ndim`) does not equal the number "
|
102
110
|
"of axes of `input` (`input.ndim`).")
|
103
111
|
raise ValueError(message)
|
104
|
-
axes = (axes,) if np.isscalar(axes) else axes
|
105
112
|
else:
|
106
|
-
axes = tuple(range(-n_axes, 0))
|
113
|
+
axes = tuple(range(-n_axes, 0)) if axes is None else axes
|
114
|
+
|
115
|
+
axes = (axes,) if np.isscalar(axes) else axes
|
107
116
|
|
108
117
|
# If `origin` is provided, then it must be "broadcastable" to a tuple with length
|
109
118
|
# equal to the core dimensionality.
|
@@ -150,10 +159,9 @@ def _vectorized_filter_iv(input, function, size, footprint, output, mode, cval,
|
|
150
159
|
|
151
160
|
# For simplicity, work with `axes` at the end.
|
152
161
|
working_axes = tuple(range(-n_axes, 0))
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
if output is not None else output)
|
162
|
+
input = xp.moveaxis(input, axes, working_axes)
|
163
|
+
output = (xp.moveaxis(output, axes, working_axes)
|
164
|
+
if output is not None else output)
|
157
165
|
|
158
166
|
# Wrap the function to limit maximum memory usage, deal with `footprint`,
|
159
167
|
# and populate `output`. The latter requires some verbosity because we
|
@@ -190,8 +198,8 @@ def _vectorized_filter_iv(input, function, size, footprint, output, mode, cval,
|
|
190
198
|
**kwargs)
|
191
199
|
return output
|
192
200
|
|
193
|
-
return (input, wrapped_function, size, mode, cval,
|
194
|
-
|
201
|
+
return (input, wrapped_function, size, mode, cval, origin,
|
202
|
+
working_axes, axes, n_axes, n_batch, xp)
|
195
203
|
|
196
204
|
|
197
205
|
@_ni_docstrings.docfiller
|
@@ -211,8 +219,22 @@ def vectorized_filter(input, function, *, size=None, footprint=None, output=None
|
|
211
219
|
|
212
220
|
where ``axis`` specifies the axis (or axes) of ``window`` along which
|
213
221
|
the filter function is evaluated.
|
214
|
-
|
215
|
-
|
222
|
+
size : scalar or tuple, optional
|
223
|
+
See `footprint` below. Ignored if `footprint` is given.
|
224
|
+
footprint : array, optional
|
225
|
+
Either `size` or `footprint` must be defined. `size` gives
|
226
|
+
the shape that is taken from the input array, at every element
|
227
|
+
position, to define the input to the filter function.
|
228
|
+
`footprint` is a boolean array that specifies (implicitly) a
|
229
|
+
shape, but also which of the elements within this shape will get
|
230
|
+
passed to the filter function. Thus ``size=(n, m)`` is equivalent
|
231
|
+
to ``footprint=np.ones((n, m))``.
|
232
|
+
We adjust `size` to the number of dimensions indicated by `axes`.
|
233
|
+
For instance, if `axes` is ``(0, 2, 1)`` and ``n`` is passed for ``size``,
|
234
|
+
then the effective `size` is ``(n, n, n)``.
|
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.
|
216
238
|
mode : {'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional
|
217
239
|
The `mode` parameter determines how the input array is extended
|
218
240
|
beyond its boundaries. Default is 'reflect'. Behavior for each valid
|
@@ -409,7 +431,7 @@ def vectorized_filter(input, function, *, size=None, footprint=None, output=None
|
|
409
431
|
|
410
432
|
""" # noqa: E501
|
411
433
|
|
412
|
-
(input, function, size, mode, cval, origin, working_axes, n_axes, n_batch, xp
|
434
|
+
(input, function, size, mode, cval, origin, working_axes, axes, n_axes, n_batch, xp
|
413
435
|
) = _vectorized_filter_iv(input, function, size, footprint, output, mode, cval,
|
414
436
|
origin, axes, batch_memory)
|
415
437
|
|
@@ -455,7 +477,7 @@ def vectorized_filter(input, function, *, size=None, footprint=None, output=None
|
|
455
477
|
res = function(view)
|
456
478
|
|
457
479
|
# move working_axes back to original positions
|
458
|
-
return xp.moveaxis(res, working_axes, axes)
|
480
|
+
return xp.moveaxis(res, working_axes, axes)
|
459
481
|
|
460
482
|
|
461
483
|
def _invalid_origin(origin, lenw):
|
@@ -1967,7 +1989,14 @@ def _rank_filter(input, rank, size=None, footprint=None, output=None,
|
|
1967
1989
|
"A sequence of modes is not supported by non-separable rank "
|
1968
1990
|
"filters")
|
1969
1991
|
mode = _ni_support._extend_mode_to_code(mode, is_filter=True)
|
1970
|
-
|
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)):
|
1971
2000
|
if input.dtype in (np.int64, np.float64, np.float32):
|
1972
2001
|
x = input
|
1973
2002
|
x_out = output
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -2571,7 +2571,7 @@ class TestThreading:
|
|
2571
2571
|
for i in range(n):
|
2572
2572
|
fun(*args, output=out[i, ...])
|
2573
2573
|
|
2574
|
-
@xfail_xp_backends("cupy",
|
2574
|
+
@xfail_xp_backends("cupy",
|
2575
2575
|
reason="XXX thread exception; cannot repro outside of pytest")
|
2576
2576
|
def test_correlate1d(self, xp):
|
2577
2577
|
d = np.random.randn(5000)
|
@@ -2585,7 +2585,7 @@ class TestThreading:
|
|
2585
2585
|
self.check_func_thread(4, ndimage.correlate1d, (d, k), ot)
|
2586
2586
|
xp_assert_equal(os, ot)
|
2587
2587
|
|
2588
|
-
@xfail_xp_backends("cupy",
|
2588
|
+
@xfail_xp_backends("cupy",
|
2589
2589
|
reason="XXX thread exception; cannot repro outside of pytest")
|
2590
2590
|
def test_correlate(self, xp):
|
2591
2591
|
d = xp.asarray(np.random.randn(500, 500))
|
@@ -2596,7 +2596,7 @@ class TestThreading:
|
|
2596
2596
|
self.check_func_thread(4, ndimage.correlate, (d, k), ot)
|
2597
2597
|
xp_assert_equal(os, ot)
|
2598
2598
|
|
2599
|
-
@xfail_xp_backends("cupy",
|
2599
|
+
@xfail_xp_backends("cupy",
|
2600
2600
|
reason="XXX thread exception; cannot repro outside of pytest")
|
2601
2601
|
def test_median_filter(self, xp):
|
2602
2602
|
d = xp.asarray(np.random.randn(500, 500))
|
@@ -2606,7 +2606,7 @@ class TestThreading:
|
|
2606
2606
|
self.check_func_thread(4, ndimage.median_filter, (d, 3), ot)
|
2607
2607
|
xp_assert_equal(os, ot)
|
2608
2608
|
|
2609
|
-
@xfail_xp_backends("cupy",
|
2609
|
+
@xfail_xp_backends("cupy",
|
2610
2610
|
reason="XXX thread exception; cannot repro outside of pytest")
|
2611
2611
|
def test_uniform_filter1d(self, xp):
|
2612
2612
|
d = np.random.randn(5000)
|
@@ -2619,7 +2619,7 @@ class TestThreading:
|
|
2619
2619
|
self.check_func_thread(4, ndimage.uniform_filter1d, (d, 5), ot)
|
2620
2620
|
xp_assert_equal(os, ot)
|
2621
2621
|
|
2622
|
-
@xfail_xp_backends("cupy",
|
2622
|
+
@xfail_xp_backends("cupy",
|
2623
2623
|
reason="XXX thread exception; cannot repro outside of pytest")
|
2624
2624
|
def test_minmax_filter(self, xp):
|
2625
2625
|
d = xp.asarray(np.random.randn(500, 500))
|
@@ -2908,15 +2908,19 @@ class TestVectorizedFilter:
|
|
2908
2908
|
with pytest.raises(ValueError, match=message):
|
2909
2909
|
ndimage.vectorized_filter(input, function, size=0)
|
2910
2910
|
|
2911
|
-
message = "The
|
2911
|
+
message = "The length of `axes` may not exceed "
|
2912
|
+
axes = (0, 1, 2)
|
2912
2913
|
with pytest.raises(ValueError, match=message):
|
2913
|
-
ndimage.vectorized_filter(input, function, size=(1, 2,
|
2914
|
+
ndimage.vectorized_filter(input, function, size=(1, 2), axes=axes)
|
2914
2915
|
with pytest.raises(ValueError, match=message):
|
2915
|
-
ndimage.vectorized_filter(input, function, footprint=xp.ones((2, 2
|
2916
|
+
ndimage.vectorized_filter(input, function, footprint=xp.ones((2, 2)),
|
2917
|
+
axes=axes)
|
2916
2918
|
|
2917
|
-
message = "`axes` must be
|
2919
|
+
message = "`axes` must be compatible with the dimensionality..."
|
2918
2920
|
with pytest.raises(ValueError, match=message):
|
2919
2921
|
ndimage.vectorized_filter(input, function, size=(1,))
|
2922
|
+
with pytest.raises(ValueError, match=message):
|
2923
|
+
ndimage.vectorized_filter(input, function, size=(2,), axes=(0,1))
|
2920
2924
|
|
2921
2925
|
message = "All elements of `origin` must be integers"
|
2922
2926
|
with pytest.raises(ValueError, match=message):
|
@@ -2986,6 +2990,35 @@ class TestVectorizedFilter:
|
|
2986
2990
|
ref = ndimage.vectorized_filter(input, function, size=21)
|
2987
2991
|
xp_assert_close(res, ref)
|
2988
2992
|
|
2993
|
+
def test_gh23046_feature(self, xp):
|
2994
|
+
# The intent of gh-23046 was to always allow `size` to be a scalar.
|
2995
|
+
rng = np.random.default_rng(45982734597824)
|
2996
|
+
img = xp.asarray(rng.random((5, 5)))
|
2997
|
+
|
2998
|
+
ref = ndimage.vectorized_filter(img, xp.mean, size=2)
|
2999
|
+
res = ndimage.vectorized_filter(img, xp.mean, size=2, axes=(0, 1))
|
3000
|
+
xp_assert_close(res, ref)
|
3001
|
+
|
3002
|
+
ref = ndimage.vectorized_filter(img, xp.mean, size=(2,), axes=(0,))
|
3003
|
+
res = ndimage.vectorized_filter(img, xp.mean, size=2, axes=0)
|
3004
|
+
xp_assert_close(res, ref)
|
3005
|
+
|
3006
|
+
def test_gh23046_fix(self, xp):
|
3007
|
+
# While investigating the feasibility of gh-23046, I noticed a bug when the
|
3008
|
+
# length of an `axes` tuple equals the dimensionality of the image.
|
3009
|
+
rng = np.random.default_rng(45982734597824)
|
3010
|
+
img = xp.asarray(rng.random((5, 5)))
|
3011
|
+
size = (2, 3)
|
3012
|
+
ref = ndimage.vectorized_filter(img.T, xp.mean, size=size).T
|
3013
|
+
res = ndimage.vectorized_filter(img, xp.mean, size=size, axes=(1, 0))
|
3014
|
+
xp_assert_close(res, ref)
|
3015
|
+
|
3016
|
+
ref = ndimage.vectorized_filter(img, xp.mean, size=size, mode='constant')
|
3017
|
+
res = ndimage.vectorized_filter(img, xp.mean, size=size[::-1], axes=(1, 0),
|
3018
|
+
mode='constant')
|
3019
|
+
xp_assert_close(res, ref)
|
3020
|
+
|
3021
|
+
|
2989
3022
|
|
2990
3023
|
@given(x=npst.arrays(dtype=np.float64,
|
2991
3024
|
shape=st.integers(min_value=1, max_value=1000)),
|
@@ -2996,3 +3029,55 @@ class TestVectorizedFilter:
|
|
2996
3029
|
def test_gh_22586_crash_property(x, size, mode):
|
2997
3030
|
# property-based test for median_filter resilience to hard crashing
|
2998
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
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
scipy/optimize/_lbfgsb_py.py
CHANGED
@@ -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
|
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.
|
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.
|
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 = {'
|
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=
|
295
|
+
disp=_NoValue, maxcor=10, ftol=2.2204460492503131e-09,
|
292
296
|
gtol=1e-5, eps=1e-8, maxfun=15000, maxiter=15000,
|
293
|
-
iprint
|
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.
|
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.
|
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,
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -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 '
|
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
|
scipy/optimize/_minimize.py
CHANGED
@@ -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
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -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
|
-
|
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:
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -239,7 +239,7 @@ class SparseMixin:
|
|
239
239
|
|
240
240
|
# Default lsmr arguments should not fully converge the solution
|
241
241
|
default_lsmr_sol = lsq_linear(A, b, lsq_solver='lsmr')
|
242
|
-
with pytest.raises(AssertionError
|
242
|
+
with pytest.raises(AssertionError):
|
243
243
|
assert_allclose(exact_sol.x, default_lsmr_sol.x)
|
244
244
|
|
245
245
|
# By increasing the maximum lsmr iters, it will converge
|
@@ -1126,7 +1126,7 @@ class TestOptimizeSimple(CheckOptimize):
|
|
1126
1126
|
|
1127
1127
|
def test_minimize_l_bfgs_b(self):
|
1128
1128
|
# Minimize with L-BFGS-B method
|
1129
|
-
opts = {'
|
1129
|
+
opts = {'maxiter': self.maxiter}
|
1130
1130
|
r = optimize.minimize(self.func, self.startparams,
|
1131
1131
|
method='L-BFGS-B', jac=self.grad,
|
1132
1132
|
options=opts)
|
@@ -1156,7 +1156,7 @@ class TestOptimizeSimple(CheckOptimize):
|
|
1156
1156
|
# Check that the `ftol` parameter in l_bfgs_b works as expected
|
1157
1157
|
v0 = None
|
1158
1158
|
for tol in [1e-1, 1e-4, 1e-7, 1e-10]:
|
1159
|
-
opts = {'
|
1159
|
+
opts = {'maxiter': self.maxiter, 'ftol': tol}
|
1160
1160
|
sol = optimize.minimize(self.func, self.startparams,
|
1161
1161
|
method='L-BFGS-B', jac=self.grad,
|
1162
1162
|
options=opts)
|
@@ -1173,7 +1173,7 @@ class TestOptimizeSimple(CheckOptimize):
|
|
1173
1173
|
# check that the maxls is passed down to the Fortran routine
|
1174
1174
|
sol = optimize.minimize(optimize.rosen, np.array([-1.2, 1.0]),
|
1175
1175
|
method='L-BFGS-B', jac=optimize.rosen_der,
|
1176
|
-
options={'
|
1176
|
+
options={'maxls': 1})
|
1177
1177
|
assert not sol.success
|
1178
1178
|
|
1179
1179
|
def test_minimize_l_bfgs_b_maxfun_interruption(self):
|
scipy/signal/_filter_design.py
CHANGED
@@ -60,6 +60,17 @@ def _is_int_type(x):
|
|
60
60
|
return True
|
61
61
|
|
62
62
|
|
63
|
+
def _real_dtype_for_complex(dtyp, *, xp):
|
64
|
+
if xp.isdtype(dtyp, 'real floating'):
|
65
|
+
return dtyp
|
66
|
+
if dtyp == xp.complex64:
|
67
|
+
return xp.float32
|
68
|
+
elif dtyp == xp.complex128:
|
69
|
+
return xp.float64
|
70
|
+
else:
|
71
|
+
raise ValueError(f"Unknown dtype {dtyp}.")
|
72
|
+
|
73
|
+
|
63
74
|
# https://github.com/numpy/numpy/blob/v2.2.0/numpy/_core/function_base.py#L195-L302
|
64
75
|
def _logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None, *, xp):
|
65
76
|
if not isinstance(base, float | int) and xp.asarray(base).ndim > 0:
|
@@ -488,6 +499,7 @@ def freqz(b, a=1, worN=512, whole=False, plot=None, fs=2*pi,
|
|
488
499
|
if xp.isdtype(a.dtype, 'integral'):
|
489
500
|
a = xp.astype(a, xp_default_dtype(xp))
|
490
501
|
res_dtype = xp.result_type(b, a)
|
502
|
+
real_dtype = _real_dtype_for_complex(res_dtype, xp=xp)
|
491
503
|
|
492
504
|
b = xpx.atleast_nd(b, ndim=1, xp=xp)
|
493
505
|
a = xpx.atleast_nd(a, ndim=1, xp=xp)
|
@@ -509,7 +521,7 @@ def freqz(b, a=1, worN=512, whole=False, plot=None, fs=2*pi,
|
|
509
521
|
# if include_nyquist is true and whole is false, w should
|
510
522
|
# include end point
|
511
523
|
w = xp.linspace(0, lastpoint, N,
|
512
|
-
endpoint=include_nyquist and not whole, dtype=
|
524
|
+
endpoint=include_nyquist and not whole, dtype=real_dtype)
|
513
525
|
n_fft = N if whole else 2 * (N - 1) if include_nyquist else 2 * N
|
514
526
|
if (xp_size(a) == 1 and (b.ndim == 1 or (b.shape[-1] == 1))
|
515
527
|
and n_fft >= b.shape[0]
|
@@ -834,7 +834,7 @@ def remez(numtaps, bands, desired, *, weight=None, type='bandpass',
|
|
834
834
|
xp = array_namespace(bands, desired, weight)
|
835
835
|
bands = np.asarray(bands)
|
836
836
|
desired = np.asarray(desired)
|
837
|
-
if weight:
|
837
|
+
if weight is not None:
|
838
838
|
weight = np.asarray(weight)
|
839
839
|
|
840
840
|
fs = _validate_fs(fs, allow_none=True)
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
scipy/signal/_polyutils.py
CHANGED
@@ -117,7 +117,7 @@ def poly(seq_of_zeros, *, xp):
|
|
117
117
|
if xp.isdtype(a.dtype, 'complex floating'):
|
118
118
|
# if complex roots are all complex conjugates, the roots are real.
|
119
119
|
roots = xp.asarray(seq_of_zeros, dtype=xp.complex128)
|
120
|
-
if xp.all(
|
120
|
+
if xp.all(xp.sort(xp.imag(roots)) == xp.sort(xp.imag(xp.conj(roots)))):
|
121
121
|
a = xp.asarray(xp.real(a), copy=True)
|
122
122
|
|
123
123
|
return a
|
Binary file
|
Binary file
|
Binary file
|