scipy 1.15.3__cp312-cp312-macosx_14_0_arm64.whl → 1.16.0__cp312-cp312-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 (632) 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/__init__.py +3 -6
  6. scipy/_cyutility.cpython-312-darwin.so +0 -0
  7. scipy/_lib/_array_api.py +486 -161
  8. scipy/_lib/_array_api_compat_vendor.py +9 -0
  9. scipy/_lib/_bunch.py +4 -0
  10. scipy/_lib/_ccallback_c.cpython-312-darwin.so +0 -0
  11. scipy/_lib/_docscrape.py +1 -1
  12. scipy/_lib/_elementwise_iterative_method.py +15 -26
  13. scipy/_lib/_sparse.py +41 -0
  14. scipy/_lib/_test_deprecation_call.cpython-312-darwin.so +0 -0
  15. scipy/_lib/_test_deprecation_def.cpython-312-darwin.so +0 -0
  16. scipy/_lib/_testutils.py +6 -2
  17. scipy/_lib/_util.py +222 -125
  18. scipy/_lib/array_api_compat/__init__.py +4 -4
  19. scipy/_lib/array_api_compat/_internal.py +19 -6
  20. scipy/_lib/array_api_compat/common/__init__.py +1 -1
  21. scipy/_lib/array_api_compat/common/_aliases.py +365 -193
  22. scipy/_lib/array_api_compat/common/_fft.py +94 -64
  23. scipy/_lib/array_api_compat/common/_helpers.py +413 -180
  24. scipy/_lib/array_api_compat/common/_linalg.py +116 -40
  25. scipy/_lib/array_api_compat/common/_typing.py +179 -10
  26. scipy/_lib/array_api_compat/cupy/__init__.py +1 -4
  27. scipy/_lib/array_api_compat/cupy/_aliases.py +61 -41
  28. scipy/_lib/array_api_compat/cupy/_info.py +16 -6
  29. scipy/_lib/array_api_compat/cupy/_typing.py +24 -39
  30. scipy/_lib/array_api_compat/dask/array/__init__.py +6 -3
  31. scipy/_lib/array_api_compat/dask/array/_aliases.py +267 -108
  32. scipy/_lib/array_api_compat/dask/array/_info.py +105 -34
  33. scipy/_lib/array_api_compat/dask/array/fft.py +5 -8
  34. scipy/_lib/array_api_compat/dask/array/linalg.py +21 -22
  35. scipy/_lib/array_api_compat/numpy/__init__.py +13 -15
  36. scipy/_lib/array_api_compat/numpy/_aliases.py +98 -49
  37. scipy/_lib/array_api_compat/numpy/_info.py +36 -16
  38. scipy/_lib/array_api_compat/numpy/_typing.py +27 -43
  39. scipy/_lib/array_api_compat/numpy/fft.py +11 -5
  40. scipy/_lib/array_api_compat/numpy/linalg.py +75 -22
  41. scipy/_lib/array_api_compat/torch/__init__.py +3 -5
  42. scipy/_lib/array_api_compat/torch/_aliases.py +262 -159
  43. scipy/_lib/array_api_compat/torch/_info.py +27 -16
  44. scipy/_lib/array_api_compat/torch/_typing.py +3 -0
  45. scipy/_lib/array_api_compat/torch/fft.py +17 -18
  46. scipy/_lib/array_api_compat/torch/linalg.py +16 -16
  47. scipy/_lib/array_api_extra/__init__.py +26 -3
  48. scipy/_lib/array_api_extra/_delegation.py +171 -0
  49. scipy/_lib/array_api_extra/_lib/__init__.py +1 -0
  50. scipy/_lib/array_api_extra/_lib/_at.py +463 -0
  51. scipy/_lib/array_api_extra/_lib/_backends.py +46 -0
  52. scipy/_lib/array_api_extra/_lib/_funcs.py +937 -0
  53. scipy/_lib/array_api_extra/_lib/_lazy.py +357 -0
  54. scipy/_lib/array_api_extra/_lib/_testing.py +278 -0
  55. scipy/_lib/array_api_extra/_lib/_utils/__init__.py +1 -0
  56. scipy/_lib/array_api_extra/_lib/_utils/_compat.py +74 -0
  57. scipy/_lib/array_api_extra/_lib/_utils/_compat.pyi +45 -0
  58. scipy/_lib/array_api_extra/_lib/_utils/_helpers.py +559 -0
  59. scipy/_lib/array_api_extra/_lib/_utils/_typing.py +10 -0
  60. scipy/_lib/array_api_extra/_lib/_utils/_typing.pyi +105 -0
  61. scipy/_lib/array_api_extra/testing.py +359 -0
  62. scipy/_lib/decorator.py +2 -2
  63. scipy/_lib/doccer.py +1 -7
  64. scipy/_lib/messagestream.cpython-312-darwin.so +0 -0
  65. scipy/_lib/pyprima/__init__.py +212 -0
  66. scipy/_lib/pyprima/cobyla/__init__.py +0 -0
  67. scipy/_lib/pyprima/cobyla/cobyla.py +559 -0
  68. scipy/_lib/pyprima/cobyla/cobylb.py +714 -0
  69. scipy/_lib/pyprima/cobyla/geometry.py +226 -0
  70. scipy/_lib/pyprima/cobyla/initialize.py +215 -0
  71. scipy/_lib/pyprima/cobyla/trustregion.py +492 -0
  72. scipy/_lib/pyprima/cobyla/update.py +289 -0
  73. scipy/_lib/pyprima/common/__init__.py +0 -0
  74. scipy/_lib/pyprima/common/_bounds.py +34 -0
  75. scipy/_lib/pyprima/common/_linear_constraints.py +46 -0
  76. scipy/_lib/pyprima/common/_nonlinear_constraints.py +54 -0
  77. scipy/_lib/pyprima/common/_project.py +173 -0
  78. scipy/_lib/pyprima/common/checkbreak.py +93 -0
  79. scipy/_lib/pyprima/common/consts.py +47 -0
  80. scipy/_lib/pyprima/common/evaluate.py +99 -0
  81. scipy/_lib/pyprima/common/history.py +38 -0
  82. scipy/_lib/pyprima/common/infos.py +30 -0
  83. scipy/_lib/pyprima/common/linalg.py +435 -0
  84. scipy/_lib/pyprima/common/message.py +290 -0
  85. scipy/_lib/pyprima/common/powalg.py +131 -0
  86. scipy/_lib/pyprima/common/preproc.py +277 -0
  87. scipy/_lib/pyprima/common/present.py +5 -0
  88. scipy/_lib/pyprima/common/ratio.py +54 -0
  89. scipy/_lib/pyprima/common/redrho.py +47 -0
  90. scipy/_lib/pyprima/common/selectx.py +296 -0
  91. scipy/_lib/tests/test__util.py +105 -121
  92. scipy/_lib/tests/test_array_api.py +166 -35
  93. scipy/_lib/tests/test_bunch.py +7 -0
  94. scipy/_lib/tests/test_ccallback.py +2 -10
  95. scipy/_lib/tests/test_public_api.py +13 -0
  96. scipy/cluster/_hierarchy.cpython-312-darwin.so +0 -0
  97. scipy/cluster/_optimal_leaf_ordering.cpython-312-darwin.so +0 -0
  98. scipy/cluster/_vq.cpython-312-darwin.so +0 -0
  99. scipy/cluster/hierarchy.py +393 -223
  100. scipy/cluster/tests/test_hierarchy.py +273 -335
  101. scipy/cluster/tests/test_vq.py +45 -61
  102. scipy/cluster/vq.py +39 -35
  103. scipy/conftest.py +282 -151
  104. scipy/constants/_constants.py +4 -1
  105. scipy/constants/tests/test_codata.py +2 -2
  106. scipy/constants/tests/test_constants.py +11 -18
  107. scipy/datasets/_download_all.py +15 -1
  108. scipy/datasets/_fetchers.py +7 -1
  109. scipy/datasets/_utils.py +1 -1
  110. scipy/differentiate/_differentiate.py +25 -25
  111. scipy/differentiate/tests/test_differentiate.py +24 -25
  112. scipy/fft/_basic.py +20 -0
  113. scipy/fft/_helper.py +3 -34
  114. scipy/fft/_pocketfft/helper.py +29 -1
  115. scipy/fft/_pocketfft/tests/test_basic.py +2 -4
  116. scipy/fft/_pocketfft/tests/test_real_transforms.py +4 -4
  117. scipy/fft/_realtransforms.py +13 -0
  118. scipy/fft/tests/test_basic.py +27 -25
  119. scipy/fft/tests/test_fftlog.py +16 -7
  120. scipy/fft/tests/test_helper.py +18 -34
  121. scipy/fft/tests/test_real_transforms.py +8 -10
  122. scipy/fftpack/convolve.cpython-312-darwin.so +0 -0
  123. scipy/fftpack/tests/test_basic.py +2 -4
  124. scipy/fftpack/tests/test_real_transforms.py +8 -9
  125. scipy/integrate/_bvp.py +9 -3
  126. scipy/integrate/_cubature.py +3 -2
  127. scipy/integrate/_dop.cpython-312-darwin.so +0 -0
  128. scipy/integrate/_lsoda.cpython-312-darwin.so +0 -0
  129. scipy/integrate/_ode.py +9 -2
  130. scipy/integrate/_odepack.cpython-312-darwin.so +0 -0
  131. scipy/integrate/_quad_vec.py +21 -29
  132. scipy/integrate/_quadpack.cpython-312-darwin.so +0 -0
  133. scipy/integrate/_quadpack_py.py +11 -7
  134. scipy/integrate/_quadrature.py +3 -3
  135. scipy/integrate/_rules/_base.py +2 -2
  136. scipy/integrate/_tanhsinh.py +48 -47
  137. scipy/integrate/_test_odeint_banded.cpython-312-darwin.so +0 -0
  138. scipy/integrate/_vode.cpython-312-darwin.so +0 -0
  139. scipy/integrate/tests/test__quad_vec.py +0 -6
  140. scipy/integrate/tests/test_banded_ode_solvers.py +85 -0
  141. scipy/integrate/tests/test_cubature.py +21 -35
  142. scipy/integrate/tests/test_quadrature.py +6 -8
  143. scipy/integrate/tests/test_tanhsinh.py +56 -48
  144. scipy/interpolate/__init__.py +70 -58
  145. scipy/interpolate/_bary_rational.py +22 -22
  146. scipy/interpolate/_bsplines.py +119 -66
  147. scipy/interpolate/_cubic.py +65 -50
  148. scipy/interpolate/_dfitpack.cpython-312-darwin.so +0 -0
  149. scipy/interpolate/_dierckx.cpython-312-darwin.so +0 -0
  150. scipy/interpolate/_fitpack.cpython-312-darwin.so +0 -0
  151. scipy/interpolate/_fitpack2.py +9 -6
  152. scipy/interpolate/_fitpack_impl.py +32 -26
  153. scipy/interpolate/_fitpack_repro.py +23 -19
  154. scipy/interpolate/_interpnd.cpython-312-darwin.so +0 -0
  155. scipy/interpolate/_interpolate.py +30 -12
  156. scipy/interpolate/_ndbspline.py +13 -18
  157. scipy/interpolate/_ndgriddata.py +5 -8
  158. scipy/interpolate/_polyint.py +95 -31
  159. scipy/interpolate/_ppoly.cpython-312-darwin.so +0 -0
  160. scipy/interpolate/_rbf.py +2 -2
  161. scipy/interpolate/_rbfinterp.py +1 -1
  162. scipy/interpolate/_rbfinterp_pythran.cpython-312-darwin.so +0 -0
  163. scipy/interpolate/_rgi.py +31 -26
  164. scipy/interpolate/_rgi_cython.cpython-312-darwin.so +0 -0
  165. scipy/interpolate/dfitpack.py +0 -20
  166. scipy/interpolate/interpnd.py +1 -2
  167. scipy/interpolate/tests/test_bary_rational.py +2 -2
  168. scipy/interpolate/tests/test_bsplines.py +97 -1
  169. scipy/interpolate/tests/test_fitpack2.py +39 -1
  170. scipy/interpolate/tests/test_interpnd.py +32 -20
  171. scipy/interpolate/tests/test_interpolate.py +48 -4
  172. scipy/interpolate/tests/test_rgi.py +2 -1
  173. scipy/io/_fast_matrix_market/__init__.py +2 -0
  174. scipy/io/_harwell_boeing/_fortran_format_parser.py +19 -16
  175. scipy/io/_harwell_boeing/hb.py +7 -11
  176. scipy/io/_idl.py +5 -7
  177. scipy/io/_netcdf.py +15 -5
  178. scipy/io/_test_fortran.cpython-312-darwin.so +0 -0
  179. scipy/io/arff/tests/test_arffread.py +3 -3
  180. scipy/io/matlab/__init__.py +5 -3
  181. scipy/io/matlab/_mio.py +4 -1
  182. scipy/io/matlab/_mio5.py +19 -13
  183. scipy/io/matlab/_mio5_utils.cpython-312-darwin.so +0 -0
  184. scipy/io/matlab/_mio_utils.cpython-312-darwin.so +0 -0
  185. scipy/io/matlab/_miobase.py +4 -1
  186. scipy/io/matlab/_streams.cpython-312-darwin.so +0 -0
  187. scipy/io/matlab/tests/test_mio.py +46 -18
  188. scipy/io/matlab/tests/test_mio_funcs.py +1 -1
  189. scipy/io/tests/test_mmio.py +7 -1
  190. scipy/io/tests/test_wavfile.py +41 -0
  191. scipy/io/wavfile.py +57 -10
  192. scipy/linalg/_basic.py +113 -86
  193. scipy/linalg/_cythonized_array_utils.cpython-312-darwin.so +0 -0
  194. scipy/linalg/_decomp.py +22 -9
  195. scipy/linalg/_decomp_cholesky.py +28 -13
  196. scipy/linalg/_decomp_cossin.py +45 -30
  197. scipy/linalg/_decomp_interpolative.cpython-312-darwin.so +0 -0
  198. scipy/linalg/_decomp_ldl.py +4 -1
  199. scipy/linalg/_decomp_lu.py +18 -6
  200. scipy/linalg/_decomp_lu_cython.cpython-312-darwin.so +0 -0
  201. scipy/linalg/_decomp_polar.py +2 -0
  202. scipy/linalg/_decomp_qr.py +6 -2
  203. scipy/linalg/_decomp_qz.py +3 -0
  204. scipy/linalg/_decomp_schur.py +3 -1
  205. scipy/linalg/_decomp_svd.py +13 -2
  206. scipy/linalg/_decomp_update.cpython-312-darwin.so +0 -0
  207. scipy/linalg/_expm_frechet.py +4 -0
  208. scipy/linalg/_fblas.cpython-312-darwin.so +0 -0
  209. scipy/linalg/_flapack.cpython-312-darwin.so +0 -0
  210. scipy/linalg/_linalg_pythran.cpython-312-darwin.so +0 -0
  211. scipy/linalg/_matfuncs.py +187 -4
  212. scipy/linalg/_matfuncs_expm.cpython-312-darwin.so +0 -0
  213. scipy/linalg/_matfuncs_schur_sqrtm.cpython-312-darwin.so +0 -0
  214. scipy/linalg/_matfuncs_sqrtm.py +1 -99
  215. scipy/linalg/_matfuncs_sqrtm_triu.cpython-312-darwin.so +0 -0
  216. scipy/linalg/_procrustes.py +2 -0
  217. scipy/linalg/_sketches.py +17 -6
  218. scipy/linalg/_solve_toeplitz.cpython-312-darwin.so +0 -0
  219. scipy/linalg/_solvers.py +7 -2
  220. scipy/linalg/_special_matrices.py +26 -36
  221. scipy/linalg/blas.py +35 -24
  222. scipy/linalg/cython_blas.cpython-312-darwin.so +0 -0
  223. scipy/linalg/cython_lapack.cpython-312-darwin.so +0 -0
  224. scipy/linalg/lapack.py +22 -2
  225. scipy/linalg/tests/_cython_examples/meson.build +7 -0
  226. scipy/linalg/tests/test_basic.py +31 -16
  227. scipy/linalg/tests/test_batch.py +588 -0
  228. scipy/linalg/tests/test_cythonized_array_utils.py +0 -2
  229. scipy/linalg/tests/test_decomp.py +40 -3
  230. scipy/linalg/tests/test_decomp_cossin.py +14 -0
  231. scipy/linalg/tests/test_decomp_ldl.py +1 -1
  232. scipy/linalg/tests/test_lapack.py +115 -7
  233. scipy/linalg/tests/test_matfuncs.py +157 -102
  234. scipy/linalg/tests/test_procrustes.py +0 -7
  235. scipy/linalg/tests/test_solve_toeplitz.py +1 -1
  236. scipy/linalg/tests/test_special_matrices.py +1 -5
  237. scipy/ndimage/__init__.py +1 -0
  238. scipy/ndimage/_cytest.cpython-312-darwin.so +0 -0
  239. scipy/ndimage/_delegators.py +8 -2
  240. scipy/ndimage/_filters.py +453 -5
  241. scipy/ndimage/_interpolation.py +36 -6
  242. scipy/ndimage/_measurements.py +4 -2
  243. scipy/ndimage/_morphology.py +5 -0
  244. scipy/ndimage/_nd_image.cpython-312-darwin.so +0 -0
  245. scipy/ndimage/_ni_docstrings.py +5 -1
  246. scipy/ndimage/_ni_label.cpython-312-darwin.so +0 -0
  247. scipy/ndimage/_ni_support.py +1 -5
  248. scipy/ndimage/_rank_filter_1d.cpython-312-darwin.so +0 -0
  249. scipy/ndimage/_support_alternative_backends.py +18 -6
  250. scipy/ndimage/tests/test_filters.py +370 -259
  251. scipy/ndimage/tests/test_fourier.py +7 -9
  252. scipy/ndimage/tests/test_interpolation.py +68 -61
  253. scipy/ndimage/tests/test_measurements.py +18 -35
  254. scipy/ndimage/tests/test_morphology.py +143 -131
  255. scipy/ndimage/tests/test_splines.py +1 -3
  256. scipy/odr/__odrpack.cpython-312-darwin.so +0 -0
  257. scipy/optimize/_basinhopping.py +13 -7
  258. scipy/optimize/_bglu_dense.cpython-312-darwin.so +0 -0
  259. scipy/optimize/_bracket.py +17 -24
  260. scipy/optimize/_chandrupatla.py +9 -10
  261. scipy/optimize/_cobyla_py.py +104 -123
  262. scipy/optimize/_constraints.py +14 -10
  263. scipy/optimize/_differentiable_functions.py +371 -230
  264. scipy/optimize/_differentialevolution.py +4 -3
  265. scipy/optimize/_direct.cpython-312-darwin.so +0 -0
  266. scipy/optimize/_dual_annealing.py +1 -1
  267. scipy/optimize/_elementwise.py +1 -4
  268. scipy/optimize/_group_columns.cpython-312-darwin.so +0 -0
  269. scipy/optimize/_lbfgsb.cpython-312-darwin.so +0 -0
  270. scipy/optimize/_lbfgsb_py.py +80 -24
  271. scipy/optimize/_linprog_doc.py +2 -2
  272. scipy/optimize/_linprog_highs.py +2 -2
  273. scipy/optimize/_linprog_ip.py +25 -10
  274. scipy/optimize/_linprog_util.py +14 -16
  275. scipy/optimize/_lsap.cpython-312-darwin.so +0 -0
  276. scipy/optimize/_lsq/common.py +3 -3
  277. scipy/optimize/_lsq/dogbox.py +16 -2
  278. scipy/optimize/_lsq/givens_elimination.cpython-312-darwin.so +0 -0
  279. scipy/optimize/_lsq/least_squares.py +198 -126
  280. scipy/optimize/_lsq/lsq_linear.py +6 -6
  281. scipy/optimize/_lsq/trf.py +35 -8
  282. scipy/optimize/_milp.py +3 -1
  283. scipy/optimize/_minimize.py +105 -36
  284. scipy/optimize/_minpack.cpython-312-darwin.so +0 -0
  285. scipy/optimize/_minpack_py.py +21 -14
  286. scipy/optimize/_moduleTNC.cpython-312-darwin.so +0 -0
  287. scipy/optimize/_nnls.py +20 -21
  288. scipy/optimize/_nonlin.py +34 -3
  289. scipy/optimize/_numdiff.py +288 -110
  290. scipy/optimize/_optimize.py +86 -48
  291. scipy/optimize/_pava_pybind.cpython-312-darwin.so +0 -0
  292. scipy/optimize/_remove_redundancy.py +5 -5
  293. scipy/optimize/_root_scalar.py +1 -1
  294. scipy/optimize/_shgo.py +6 -0
  295. scipy/optimize/_shgo_lib/_complex.py +1 -1
  296. scipy/optimize/_slsqp_py.py +216 -124
  297. scipy/optimize/_slsqplib.cpython-312-darwin.so +0 -0
  298. scipy/optimize/_spectral.py +1 -1
  299. scipy/optimize/_tnc.py +8 -1
  300. scipy/optimize/_trlib/_trlib.cpython-312-darwin.so +0 -0
  301. scipy/optimize/_trustregion.py +20 -6
  302. scipy/optimize/_trustregion_constr/canonical_constraint.py +7 -7
  303. scipy/optimize/_trustregion_constr/equality_constrained_sqp.py +1 -1
  304. scipy/optimize/_trustregion_constr/minimize_trustregion_constr.py +11 -3
  305. scipy/optimize/_trustregion_constr/projections.py +12 -8
  306. scipy/optimize/_trustregion_constr/qp_subproblem.py +9 -9
  307. scipy/optimize/_trustregion_constr/tests/test_projections.py +7 -7
  308. scipy/optimize/_trustregion_constr/tests/test_qp_subproblem.py +77 -77
  309. scipy/optimize/_trustregion_constr/tr_interior_point.py +5 -5
  310. scipy/optimize/_trustregion_exact.py +0 -1
  311. scipy/optimize/_zeros.cpython-312-darwin.so +0 -0
  312. scipy/optimize/_zeros_py.py +97 -17
  313. scipy/optimize/cython_optimize/_zeros.cpython-312-darwin.so +0 -0
  314. scipy/optimize/slsqp.py +0 -1
  315. scipy/optimize/tests/test__basinhopping.py +1 -1
  316. scipy/optimize/tests/test__differential_evolution.py +4 -4
  317. scipy/optimize/tests/test__linprog_clean_inputs.py +5 -3
  318. scipy/optimize/tests/test__numdiff.py +66 -22
  319. scipy/optimize/tests/test__remove_redundancy.py +2 -2
  320. scipy/optimize/tests/test__shgo.py +9 -1
  321. scipy/optimize/tests/test_bracket.py +36 -46
  322. scipy/optimize/tests/test_chandrupatla.py +133 -135
  323. scipy/optimize/tests/test_cobyla.py +74 -45
  324. scipy/optimize/tests/test_constraints.py +1 -1
  325. scipy/optimize/tests/test_differentiable_functions.py +226 -6
  326. scipy/optimize/tests/test_lbfgsb_hessinv.py +22 -0
  327. scipy/optimize/tests/test_least_squares.py +125 -13
  328. scipy/optimize/tests/test_linear_assignment.py +3 -3
  329. scipy/optimize/tests/test_linprog.py +3 -3
  330. scipy/optimize/tests/test_lsq_linear.py +6 -6
  331. scipy/optimize/tests/test_minimize_constrained.py +2 -2
  332. scipy/optimize/tests/test_minpack.py +4 -4
  333. scipy/optimize/tests/test_nnls.py +43 -3
  334. scipy/optimize/tests/test_nonlin.py +36 -0
  335. scipy/optimize/tests/test_optimize.py +98 -20
  336. scipy/optimize/tests/test_slsqp.py +36 -4
  337. scipy/optimize/tests/test_zeros.py +34 -1
  338. scipy/signal/__init__.py +12 -23
  339. scipy/signal/_delegators.py +568 -0
  340. scipy/signal/_filter_design.py +459 -241
  341. scipy/signal/_fir_filter_design.py +262 -90
  342. scipy/signal/_lti_conversion.py +3 -2
  343. scipy/signal/_ltisys.py +118 -91
  344. scipy/signal/_max_len_seq_inner.cpython-312-darwin.so +0 -0
  345. scipy/signal/_peak_finding_utils.cpython-312-darwin.so +0 -0
  346. scipy/signal/_polyutils.py +172 -0
  347. scipy/signal/_short_time_fft.py +519 -70
  348. scipy/signal/_signal_api.py +30 -0
  349. scipy/signal/_signaltools.py +719 -399
  350. scipy/signal/_sigtools.cpython-312-darwin.so +0 -0
  351. scipy/signal/_sosfilt.cpython-312-darwin.so +0 -0
  352. scipy/signal/_spectral_py.py +230 -50
  353. scipy/signal/_spline.cpython-312-darwin.so +0 -0
  354. scipy/signal/_spline_filters.py +108 -68
  355. scipy/signal/_support_alternative_backends.py +73 -0
  356. scipy/signal/_upfirdn.py +4 -1
  357. scipy/signal/_upfirdn_apply.cpython-312-darwin.so +0 -0
  358. scipy/signal/_waveforms.py +2 -11
  359. scipy/signal/_wavelets.py +1 -1
  360. scipy/signal/fir_filter_design.py +1 -0
  361. scipy/signal/spline.py +4 -11
  362. scipy/signal/tests/_scipy_spectral_test_shim.py +2 -171
  363. scipy/signal/tests/test_bsplines.py +114 -79
  364. scipy/signal/tests/test_cont2discrete.py +9 -2
  365. scipy/signal/tests/test_filter_design.py +721 -481
  366. scipy/signal/tests/test_fir_filter_design.py +332 -140
  367. scipy/signal/tests/test_savitzky_golay.py +4 -3
  368. scipy/signal/tests/test_short_time_fft.py +221 -3
  369. scipy/signal/tests/test_signaltools.py +2145 -1349
  370. scipy/signal/tests/test_spectral.py +50 -6
  371. scipy/signal/tests/test_splines.py +161 -96
  372. scipy/signal/tests/test_upfirdn.py +84 -50
  373. scipy/signal/tests/test_waveforms.py +20 -0
  374. scipy/signal/tests/test_windows.py +607 -466
  375. scipy/signal/windows/_windows.py +287 -148
  376. scipy/sparse/__init__.py +23 -4
  377. scipy/sparse/_base.py +270 -108
  378. scipy/sparse/_bsr.py +7 -4
  379. scipy/sparse/_compressed.py +59 -231
  380. scipy/sparse/_construct.py +90 -38
  381. scipy/sparse/_coo.py +115 -181
  382. scipy/sparse/_csc.py +4 -4
  383. scipy/sparse/_csparsetools.cpython-312-darwin.so +0 -0
  384. scipy/sparse/_csr.py +2 -2
  385. scipy/sparse/_data.py +48 -48
  386. scipy/sparse/_dia.py +105 -18
  387. scipy/sparse/_dok.py +0 -23
  388. scipy/sparse/_index.py +4 -4
  389. scipy/sparse/_matrix.py +23 -0
  390. scipy/sparse/_sparsetools.cpython-312-darwin.so +0 -0
  391. scipy/sparse/_sputils.py +37 -22
  392. scipy/sparse/base.py +0 -9
  393. scipy/sparse/bsr.py +0 -14
  394. scipy/sparse/compressed.py +0 -23
  395. scipy/sparse/construct.py +0 -6
  396. scipy/sparse/coo.py +0 -14
  397. scipy/sparse/csc.py +0 -3
  398. scipy/sparse/csgraph/_flow.cpython-312-darwin.so +0 -0
  399. scipy/sparse/csgraph/_matching.cpython-312-darwin.so +0 -0
  400. scipy/sparse/csgraph/_min_spanning_tree.cpython-312-darwin.so +0 -0
  401. scipy/sparse/csgraph/_reordering.cpython-312-darwin.so +0 -0
  402. scipy/sparse/csgraph/_shortest_path.cpython-312-darwin.so +0 -0
  403. scipy/sparse/csgraph/_tools.cpython-312-darwin.so +0 -0
  404. scipy/sparse/csgraph/_traversal.cpython-312-darwin.so +0 -0
  405. scipy/sparse/csgraph/tests/test_matching.py +14 -2
  406. scipy/sparse/csgraph/tests/test_pydata_sparse.py +4 -1
  407. scipy/sparse/csgraph/tests/test_shortest_path.py +83 -27
  408. scipy/sparse/csr.py +0 -5
  409. scipy/sparse/data.py +1 -6
  410. scipy/sparse/dia.py +0 -7
  411. scipy/sparse/dok.py +0 -10
  412. scipy/sparse/linalg/_dsolve/_superlu.cpython-312-darwin.so +0 -0
  413. scipy/sparse/linalg/_dsolve/linsolve.py +9 -0
  414. scipy/sparse/linalg/_dsolve/tests/test_linsolve.py +35 -28
  415. scipy/sparse/linalg/_eigen/arpack/_arpack.cpython-312-darwin.so +0 -0
  416. scipy/sparse/linalg/_eigen/arpack/arpack.py +23 -17
  417. scipy/sparse/linalg/_eigen/lobpcg/lobpcg.py +6 -6
  418. scipy/sparse/linalg/_interface.py +17 -18
  419. scipy/sparse/linalg/_isolve/_gcrotmk.py +4 -4
  420. scipy/sparse/linalg/_isolve/iterative.py +51 -45
  421. scipy/sparse/linalg/_isolve/lgmres.py +6 -6
  422. scipy/sparse/linalg/_isolve/minres.py +5 -5
  423. scipy/sparse/linalg/_isolve/tfqmr.py +7 -7
  424. scipy/sparse/linalg/_isolve/utils.py +2 -8
  425. scipy/sparse/linalg/_matfuncs.py +1 -1
  426. scipy/sparse/linalg/_norm.py +1 -1
  427. scipy/sparse/linalg/_propack/_cpropack.cpython-312-darwin.so +0 -0
  428. scipy/sparse/linalg/_propack/_dpropack.cpython-312-darwin.so +0 -0
  429. scipy/sparse/linalg/_propack/_spropack.cpython-312-darwin.so +0 -0
  430. scipy/sparse/linalg/_propack/_zpropack.cpython-312-darwin.so +0 -0
  431. scipy/sparse/linalg/_special_sparse_arrays.py +39 -38
  432. scipy/sparse/linalg/tests/test_pydata_sparse.py +14 -0
  433. scipy/sparse/tests/test_arithmetic1d.py +5 -2
  434. scipy/sparse/tests/test_base.py +214 -42
  435. scipy/sparse/tests/test_common1d.py +7 -7
  436. scipy/sparse/tests/test_construct.py +1 -1
  437. scipy/sparse/tests/test_coo.py +272 -4
  438. scipy/sparse/tests/test_sparsetools.py +5 -0
  439. scipy/sparse/tests/test_sputils.py +36 -7
  440. scipy/spatial/_ckdtree.cpython-312-darwin.so +0 -0
  441. scipy/spatial/_distance_pybind.cpython-312-darwin.so +0 -0
  442. scipy/spatial/_distance_wrap.cpython-312-darwin.so +0 -0
  443. scipy/spatial/_hausdorff.cpython-312-darwin.so +0 -0
  444. scipy/spatial/_qhull.cpython-312-darwin.so +0 -0
  445. scipy/spatial/_voronoi.cpython-312-darwin.so +0 -0
  446. scipy/spatial/distance.py +49 -42
  447. scipy/spatial/tests/test_distance.py +15 -1
  448. scipy/spatial/tests/test_kdtree.py +1 -0
  449. scipy/spatial/tests/test_qhull.py +7 -2
  450. scipy/spatial/transform/__init__.py +5 -3
  451. scipy/spatial/transform/_rigid_transform.cpython-312-darwin.so +0 -0
  452. scipy/spatial/transform/_rotation.cpython-312-darwin.so +0 -0
  453. scipy/spatial/transform/tests/test_rigid_transform.py +1221 -0
  454. scipy/spatial/transform/tests/test_rotation.py +1213 -832
  455. scipy/spatial/transform/tests/test_rotation_groups.py +3 -3
  456. scipy/spatial/transform/tests/test_rotation_spline.py +29 -8
  457. scipy/special/__init__.py +1 -47
  458. scipy/special/_add_newdocs.py +34 -772
  459. scipy/special/_basic.py +22 -25
  460. scipy/special/_comb.cpython-312-darwin.so +0 -0
  461. scipy/special/_ellip_harm_2.cpython-312-darwin.so +0 -0
  462. scipy/special/_gufuncs.cpython-312-darwin.so +0 -0
  463. scipy/special/_logsumexp.py +67 -58
  464. scipy/special/_orthogonal.pyi +1 -1
  465. scipy/special/_specfun.cpython-312-darwin.so +0 -0
  466. scipy/special/_special_ufuncs.cpython-312-darwin.so +0 -0
  467. scipy/special/_spherical_bessel.py +4 -4
  468. scipy/special/_support_alternative_backends.py +212 -119
  469. scipy/special/_test_internal.cpython-312-darwin.so +0 -0
  470. scipy/special/_testutils.py +4 -4
  471. scipy/special/_ufuncs.cpython-312-darwin.so +0 -0
  472. scipy/special/_ufuncs.pyi +1 -0
  473. scipy/special/_ufuncs.pyx +215 -1400
  474. scipy/special/_ufuncs_cxx.cpython-312-darwin.so +0 -0
  475. scipy/special/_ufuncs_cxx.pxd +2 -15
  476. scipy/special/_ufuncs_cxx.pyx +5 -44
  477. scipy/special/_ufuncs_cxx_defs.h +2 -16
  478. scipy/special/_ufuncs_defs.h +0 -8
  479. scipy/special/cython_special.cpython-312-darwin.so +0 -0
  480. scipy/special/cython_special.pxd +1 -1
  481. scipy/special/tests/_cython_examples/meson.build +10 -1
  482. scipy/special/tests/test_basic.py +153 -20
  483. scipy/special/tests/test_boost_ufuncs.py +3 -0
  484. scipy/special/tests/test_cdflib.py +35 -11
  485. scipy/special/tests/test_gammainc.py +16 -0
  486. scipy/special/tests/test_hyp2f1.py +2 -2
  487. scipy/special/tests/test_log1mexp.py +85 -0
  488. scipy/special/tests/test_logsumexp.py +206 -64
  489. scipy/special/tests/test_mpmath.py +1 -0
  490. scipy/special/tests/test_nan_inputs.py +1 -1
  491. scipy/special/tests/test_orthogonal.py +17 -18
  492. scipy/special/tests/test_sf_error.py +3 -2
  493. scipy/special/tests/test_sph_harm.py +6 -7
  494. scipy/special/tests/test_support_alternative_backends.py +211 -76
  495. scipy/stats/__init__.py +4 -1
  496. scipy/stats/_ansari_swilk_statistics.cpython-312-darwin.so +0 -0
  497. scipy/stats/_axis_nan_policy.py +5 -12
  498. scipy/stats/_biasedurn.cpython-312-darwin.so +0 -0
  499. scipy/stats/_continued_fraction.py +387 -0
  500. scipy/stats/_continuous_distns.py +277 -310
  501. scipy/stats/_correlation.py +1 -1
  502. scipy/stats/_covariance.py +6 -3
  503. scipy/stats/_discrete_distns.py +39 -32
  504. scipy/stats/_distn_infrastructure.py +39 -12
  505. scipy/stats/_distribution_infrastructure.py +920 -238
  506. scipy/stats/_entropy.py +9 -10
  507. scipy/{_lib → stats}/_finite_differences.py +1 -1
  508. scipy/stats/_hypotests.py +83 -50
  509. scipy/stats/_kde.py +53 -49
  510. scipy/stats/_ksstats.py +1 -1
  511. scipy/stats/_levy_stable/__init__.py +7 -15
  512. scipy/stats/_levy_stable/levyst.cpython-312-darwin.so +0 -0
  513. scipy/stats/_morestats.py +118 -73
  514. scipy/stats/_mstats_basic.py +13 -17
  515. scipy/stats/_mstats_extras.py +8 -8
  516. scipy/stats/_multivariate.py +89 -113
  517. scipy/stats/_new_distributions.py +97 -20
  518. scipy/stats/_page_trend_test.py +12 -5
  519. scipy/stats/_probability_distribution.py +265 -43
  520. scipy/stats/_qmc.py +14 -9
  521. scipy/stats/_qmc_cy.cpython-312-darwin.so +0 -0
  522. scipy/stats/_qmvnt.py +16 -95
  523. scipy/stats/_qmvnt_cy.cpython-312-darwin.so +0 -0
  524. scipy/stats/_quantile.py +335 -0
  525. scipy/stats/_rcont/rcont.cpython-312-darwin.so +0 -0
  526. scipy/stats/_resampling.py +5 -30
  527. scipy/stats/_sampling.py +1 -1
  528. scipy/stats/_sobol.cpython-312-darwin.so +0 -0
  529. scipy/stats/_stats.cpython-312-darwin.so +0 -0
  530. scipy/stats/_stats_mstats_common.py +21 -2
  531. scipy/stats/_stats_py.py +551 -477
  532. scipy/stats/_stats_pythran.cpython-312-darwin.so +0 -0
  533. scipy/stats/_unuran/unuran_wrapper.cpython-312-darwin.so +0 -0
  534. scipy/stats/_unuran/unuran_wrapper.pyi +2 -1
  535. scipy/stats/_variation.py +6 -8
  536. scipy/stats/_wilcoxon.py +13 -7
  537. scipy/stats/tests/common_tests.py +6 -4
  538. scipy/stats/tests/test_axis_nan_policy.py +62 -24
  539. scipy/stats/tests/test_continued_fraction.py +173 -0
  540. scipy/stats/tests/test_continuous.py +379 -60
  541. scipy/stats/tests/test_continuous_basic.py +18 -12
  542. scipy/stats/tests/test_discrete_basic.py +14 -8
  543. scipy/stats/tests/test_discrete_distns.py +16 -16
  544. scipy/stats/tests/test_distributions.py +95 -75
  545. scipy/stats/tests/test_entropy.py +40 -48
  546. scipy/stats/tests/test_fit.py +4 -3
  547. scipy/stats/tests/test_hypotests.py +153 -24
  548. scipy/stats/tests/test_kdeoth.py +109 -41
  549. scipy/stats/tests/test_marray.py +289 -0
  550. scipy/stats/tests/test_morestats.py +81 -49
  551. scipy/stats/tests/test_mstats_basic.py +3 -3
  552. scipy/stats/tests/test_multivariate.py +434 -83
  553. scipy/stats/tests/test_qmc.py +13 -10
  554. scipy/stats/tests/test_quantile.py +199 -0
  555. scipy/stats/tests/test_rank.py +119 -112
  556. scipy/stats/tests/test_resampling.py +47 -56
  557. scipy/stats/tests/test_sampling.py +9 -4
  558. scipy/stats/tests/test_stats.py +799 -939
  559. scipy/stats/tests/test_variation.py +8 -6
  560. scipy/version.py +2 -2
  561. {scipy-1.15.3.dist-info → scipy-1.16.0.dist-info}/LICENSE.txt +4 -4
  562. {scipy-1.15.3.dist-info → scipy-1.16.0.dist-info}/METADATA +11 -11
  563. {scipy-1.15.3.dist-info → scipy-1.16.0.dist-info}/RECORD +564 -571
  564. scipy-1.16.0.dist-info/WHEEL +6 -0
  565. scipy/_lib/array_api_extra/_funcs.py +0 -484
  566. scipy/_lib/array_api_extra/_typing.py +0 -8
  567. scipy/interpolate/_bspl.cpython-312-darwin.so +0 -0
  568. scipy/optimize/_cobyla.cpython-312-darwin.so +0 -0
  569. scipy/optimize/_cython_nnls.cpython-312-darwin.so +0 -0
  570. scipy/optimize/_slsqp.cpython-312-darwin.so +0 -0
  571. scipy/spatial/qhull_src/COPYING.txt +0 -38
  572. scipy/special/libsf_error_state.dylib +0 -0
  573. scipy/special/tests/test_log_softmax.py +0 -109
  574. scipy/special/tests/test_xsf_cuda.py +0 -114
  575. scipy/special/xsf/binom.h +0 -89
  576. scipy/special/xsf/cdflib.h +0 -100
  577. scipy/special/xsf/cephes/airy.h +0 -307
  578. scipy/special/xsf/cephes/besselpoly.h +0 -51
  579. scipy/special/xsf/cephes/beta.h +0 -257
  580. scipy/special/xsf/cephes/cbrt.h +0 -131
  581. scipy/special/xsf/cephes/chbevl.h +0 -85
  582. scipy/special/xsf/cephes/chdtr.h +0 -193
  583. scipy/special/xsf/cephes/const.h +0 -87
  584. scipy/special/xsf/cephes/ellie.h +0 -293
  585. scipy/special/xsf/cephes/ellik.h +0 -251
  586. scipy/special/xsf/cephes/ellpe.h +0 -107
  587. scipy/special/xsf/cephes/ellpk.h +0 -117
  588. scipy/special/xsf/cephes/expn.h +0 -260
  589. scipy/special/xsf/cephes/gamma.h +0 -398
  590. scipy/special/xsf/cephes/hyp2f1.h +0 -596
  591. scipy/special/xsf/cephes/hyperg.h +0 -361
  592. scipy/special/xsf/cephes/i0.h +0 -149
  593. scipy/special/xsf/cephes/i1.h +0 -158
  594. scipy/special/xsf/cephes/igam.h +0 -421
  595. scipy/special/xsf/cephes/igam_asymp_coeff.h +0 -195
  596. scipy/special/xsf/cephes/igami.h +0 -313
  597. scipy/special/xsf/cephes/j0.h +0 -225
  598. scipy/special/xsf/cephes/j1.h +0 -198
  599. scipy/special/xsf/cephes/jv.h +0 -715
  600. scipy/special/xsf/cephes/k0.h +0 -164
  601. scipy/special/xsf/cephes/k1.h +0 -163
  602. scipy/special/xsf/cephes/kn.h +0 -243
  603. scipy/special/xsf/cephes/lanczos.h +0 -112
  604. scipy/special/xsf/cephes/ndtr.h +0 -275
  605. scipy/special/xsf/cephes/poch.h +0 -85
  606. scipy/special/xsf/cephes/polevl.h +0 -167
  607. scipy/special/xsf/cephes/psi.h +0 -194
  608. scipy/special/xsf/cephes/rgamma.h +0 -111
  609. scipy/special/xsf/cephes/scipy_iv.h +0 -811
  610. scipy/special/xsf/cephes/shichi.h +0 -248
  611. scipy/special/xsf/cephes/sici.h +0 -224
  612. scipy/special/xsf/cephes/sindg.h +0 -221
  613. scipy/special/xsf/cephes/tandg.h +0 -139
  614. scipy/special/xsf/cephes/trig.h +0 -58
  615. scipy/special/xsf/cephes/unity.h +0 -186
  616. scipy/special/xsf/cephes/zeta.h +0 -172
  617. scipy/special/xsf/config.h +0 -304
  618. scipy/special/xsf/digamma.h +0 -205
  619. scipy/special/xsf/error.h +0 -57
  620. scipy/special/xsf/evalpoly.h +0 -47
  621. scipy/special/xsf/expint.h +0 -266
  622. scipy/special/xsf/hyp2f1.h +0 -694
  623. scipy/special/xsf/iv_ratio.h +0 -173
  624. scipy/special/xsf/lambertw.h +0 -150
  625. scipy/special/xsf/loggamma.h +0 -163
  626. scipy/special/xsf/sici.h +0 -200
  627. scipy/special/xsf/tools.h +0 -427
  628. scipy/special/xsf/trig.h +0 -164
  629. scipy/special/xsf/wright_bessel.h +0 -843
  630. scipy/special/xsf/zlog1.h +0 -35
  631. scipy/stats/_mvn.cpython-312-darwin.so +0 -0
  632. scipy-1.15.3.dist-info/WHEEL +0 -4
@@ -5,14 +5,15 @@ Added by Andrew Nelson 2014
5
5
  import warnings
6
6
 
7
7
  import numpy as np
8
+
8
9
  from scipy.optimize import OptimizeResult, minimize
10
+ from scipy.optimize._constraints import (Bounds, new_bounds_to_old,
11
+ NonlinearConstraint, LinearConstraint)
9
12
  from scipy.optimize._optimize import _status_message, _wrap_callback
10
13
  from scipy._lib._util import (check_random_state, MapWrapper, _FunctionWrapper,
11
14
  rng_integers, _transition_to_rng)
15
+ from scipy._lib._sparse import issparse
12
16
 
13
- from scipy.optimize._constraints import (Bounds, new_bounds_to_old,
14
- NonlinearConstraint, LinearConstraint)
15
- from scipy.sparse import issparse
16
17
 
17
18
  __all__ = ['differential_evolution']
18
19
 
@@ -599,7 +599,7 @@ def dual_annealing(func, bounds, args=(), maxiter=1000,
599
599
  References
600
600
  ----------
601
601
  .. [1] Tsallis C. Possible generalization of Boltzmann-Gibbs
602
- statistics. Journal of Statistical Physics, 52, 479-487 (1998).
602
+ statistics. Journal of Statistical Physics, 52, 479-487 (1988).
603
603
  .. [2] Tsallis C, Stariolo DA. Generalized Simulated Annealing.
604
604
  Physica A, 233, 395-406 (1996).
605
605
  .. [3] Xiang Y, Sun DY, Fan W, Gong XG. Generalized Simulated
@@ -342,12 +342,9 @@ def find_minimum(f, init, /, *, args=(), tolerances=None, maxiter=100, callback=
342
342
  (where one of the inequalities is strict) are the values of `f` evaluated
343
343
  at those points, then the algorithm is considered to have converged when:
344
344
 
345
- - ``xr - xl <= abs(xm)*xrtol + xatol`` or
345
+ - ``abs(xr - xm)/2 <= abs(xm)*xrtol + xatol`` or
346
346
  - ``(fl - 2*fm + fr)/2 <= abs(fm)*frtol + fatol``.
347
347
 
348
- Note that first of these differs from the termination conditions described
349
- in [1]_.
350
-
351
348
  The default value of `xrtol` is the square root of the precision of the
352
349
  appropriate dtype, and ``xatol = fatol = frtol`` is the smallest normal
353
350
  number of the appropriate dtype.
@@ -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,10 +292,11 @@ 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,
294
- finite_diff_rel_step=None, **unknown_options):
297
+ iprint=_NoValue, callback=None, maxls=20,
298
+ finite_diff_rel_step=None, workers=None,
299
+ **unknown_options):
295
300
  """
296
301
  Minimize a scalar function of one or more variables using the L-BFGS-B
297
302
  algorithm.
@@ -304,7 +309,7 @@ def _minimize_lbfgsb(fun, x0, args=(), jac=None, bounds=None,
304
309
  output and this keyword has no function.
305
310
 
306
311
  .. deprecated:: 1.15.0
307
- 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.
308
313
 
309
314
  maxcor : int
310
315
  The maximum number of variable metric corrections used to
@@ -322,18 +327,18 @@ def _minimize_lbfgsb(fun, x0, args=(), jac=None, bounds=None,
322
327
  If `jac is None` the absolute step size used for numerical
323
328
  approximation of the jacobian via forward differences.
324
329
  maxfun : int
325
- Maximum number of function evaluations. Note that this function
326
- may violate the limit because of evaluating gradients by numerical
327
- differentiation.
330
+ Maximum number of function evaluations before minimization terminates.
331
+ Note that this function may violate the limit if the gradients
332
+ are evaluated by numerical differentiation.
328
333
  maxiter : int
329
- Maximum number of iterations.
334
+ Maximum number of algorithm iterations.
330
335
  iprint : int, optional
331
336
  Deprecated option that previously controlled the text printed on the
332
337
  screen during the problem solution. Now the code does not emit any
333
338
  output and this keyword has no function.
334
339
 
335
340
  .. deprecated:: 1.15.0
336
- 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.
337
342
 
338
343
  maxls : int, optional
339
344
  Maximum number of line search steps (per iteration). Default is 20.
@@ -344,6 +349,12 @@ def _minimize_lbfgsb(fun, x0, args=(), jac=None, bounds=None,
344
349
  possibly adjusted to fit into the bounds. For ``method='3-point'``
345
350
  the sign of `h` is ignored. If None (default) then step is selected
346
351
  automatically.
352
+ workers : int, map-like callable, optional
353
+ A map-like callable, such as `multiprocessing.Pool.map` for evaluating
354
+ any numerical differentiation in parallel.
355
+ This evaluation is carried out as ``workers(fun, iterable)``.
356
+
357
+ .. versionadded:: 1.16.0
347
358
 
348
359
  Notes
349
360
  -----
@@ -352,6 +363,11 @@ def _minimize_lbfgsb(fun, x0, args=(), jac=None, bounds=None,
352
363
  relationship between the two is ``ftol = factr * numpy.finfo(float).eps``.
353
364
  I.e., `factr` multiplies the default machine floating-point precision to
354
365
  arrive at `ftol`.
366
+ If the minimization is slow to converge the optimizer may halt if the
367
+ total number of function evaluations exceeds `maxfun`, or the number of
368
+ algorithm iterations has reached `maxiter` (whichever comes first). If
369
+ this is the case then ``result.success=False``, and an appropriate
370
+ error message is contained in ``result.message``.
355
371
 
356
372
  """
357
373
  _check_unknown_options(unknown_options)
@@ -361,6 +377,17 @@ def _minimize_lbfgsb(fun, x0, args=(), jac=None, bounds=None,
361
377
 
362
378
  x0 = asarray(x0).ravel()
363
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)
364
391
 
365
392
  # historically old-style bounds were/are expected by lbfgsb.
366
393
  # That's still the case but we'll deal with new-style from here on,
@@ -385,7 +412,8 @@ def _minimize_lbfgsb(fun, x0, args=(), jac=None, bounds=None,
385
412
  # _prepare_scalar_function can use bounds=None to represent no bounds
386
413
  sf = _prepare_scalar_function(fun, x0, jac=jac, args=args, epsilon=eps,
387
414
  bounds=bounds,
388
- finite_diff_rel_step=finite_diff_rel_step)
415
+ finite_diff_rel_step=finite_diff_rel_step,
416
+ workers=workers)
389
417
 
390
418
  func_and_grad = sf.fun_and_grad
391
419
 
@@ -555,6 +583,43 @@ class LbfgsInvHessProduct(LinearOperator):
555
583
 
556
584
  return r
557
585
 
586
+ def _matmat(self, X):
587
+ """Efficient matrix-matrix multiply with the BFGS matrices.
588
+
589
+ This calculation is described in Section (4) of [1].
590
+
591
+ Parameters
592
+ ----------
593
+ X : ndarray
594
+ An array with shape (n,m)
595
+
596
+ Returns
597
+ -------
598
+ Y : ndarray
599
+ The matrix-matrix product
600
+
601
+ Notes
602
+ -----
603
+ This implementation is written starting from _matvec and broadcasting
604
+ all expressions along the second axis of X.
605
+
606
+ """
607
+ s, y, n_corrs, rho = self.sk, self.yk, self.n_corrs, self.rho
608
+ Q = np.array(X, dtype=self.dtype, copy=True)
609
+
610
+ alpha = np.empty((n_corrs, Q.shape[1]))
611
+
612
+ for i in range(n_corrs-1, -1, -1):
613
+ alpha[i] = rho[i] * np.dot(s[i], Q)
614
+ Q -= alpha[i]*y[i][:, np.newaxis]
615
+
616
+ R = Q
617
+ for i in range(n_corrs):
618
+ beta = rho[i] * np.dot(y[i], R)
619
+ R += s[i][:, np.newaxis] * (alpha[i] - beta)
620
+
621
+ return R
622
+
558
623
  def todense(self):
559
624
  """Return a dense array representation of this operator.
560
625
 
@@ -565,14 +630,5 @@ class LbfgsInvHessProduct(LinearOperator):
565
630
  the same data represented by this `LinearOperator`.
566
631
 
567
632
  """
568
- s, y, n_corrs, rho = self.sk, self.yk, self.n_corrs, self.rho
569
633
  I_arr = np.eye(*self.shape, dtype=self.dtype)
570
- Hk = I_arr
571
-
572
- for i in range(n_corrs):
573
- A1 = I_arr - s[i][:, np.newaxis] * y[i][np.newaxis, :] * rho[i]
574
- A2 = I_arr - y[i][:, np.newaxis] * s[i][np.newaxis, :] * rho[i]
575
-
576
- Hk = np.dot(A1, np.dot(Hk, A2)) + (rho[i] * s[i][:, np.newaxis] *
577
- s[i][np.newaxis, :])
578
- return Hk
634
+ return self._matmat(I_arr)
@@ -867,12 +867,12 @@ def _linprog_ip_doc(c, A_ub=None, b_ub=None, A_eq=None, b_eq=None,
867
867
  when Mehrota's predictor-corrector is not in use (uncommon).
868
868
  sparse : bool (default: False)
869
869
  Set to ``True`` if the problem is to be treated as sparse after
870
- presolve. If either ``A_eq`` or ``A_ub`` is a sparse matrix,
870
+ presolve. If either ``A_eq`` or ``A_ub`` is sparse,
871
871
  this option will automatically be set ``True``, and the problem
872
872
  will be treated as sparse even during presolve. If your constraint
873
873
  matrices contain mostly zeros and the problem is not very small (less
874
874
  than about 100 constraints or variables), consider setting ``True``
875
- or providing ``A_eq`` and ``A_ub`` as sparse matrices.
875
+ or providing ``A_eq`` and ``A_ub`` as sparse arrays.
876
876
  lstsq : bool (default: ``False``)
877
877
  Set to ``True`` if the problem is expected to be very poorly
878
878
  conditioned. This should always be left ``False`` unless severe
@@ -25,7 +25,7 @@ from ._highspy._core import(
25
25
  HighsModelStatus,
26
26
  simplex_constants as s_c, # [1]
27
27
  )
28
- from scipy.sparse import csc_matrix, vstack, issparse
28
+ from scipy.sparse import csc_array, vstack, issparse
29
29
 
30
30
  # [1]: Directly importing from "._highspy._core.simplex_constants"
31
31
  # causes problems when reloading.
@@ -318,7 +318,7 @@ def _linprog_highs(lp, solver, time_limit=None, presolve=True,
318
318
  A = vstack((A_ub, A_eq))
319
319
  else:
320
320
  A = np.vstack((A_ub, A_eq))
321
- A = csc_matrix(A)
321
+ A = csc_array(A)
322
322
 
323
323
  options = {
324
324
  'presolve': presolve,
@@ -31,6 +31,8 @@ try:
31
31
  import sksparse # noqa: F401
32
32
  from sksparse.cholmod import cholesky as cholmod # noqa: F401
33
33
  from sksparse.cholmod import analyze as cholmod_analyze
34
+ from sksparse.cholmod import CholmodTypeConversionWarning
35
+ from warnings import catch_warnings
34
36
  except ImportError:
35
37
  has_cholmod = False
36
38
  try:
@@ -87,13 +89,26 @@ def _get_solver(M, sparse=False, lstsq=False, sym_pos=True,
87
89
  def solve(r, sym_pos=False):
88
90
  return sps.linalg.lsqr(M, r)[0]
89
91
  elif cholesky:
90
- try:
91
- # Will raise an exception in the first call,
92
- # or when the matrix changes due to a new problem
93
- _get_solver.cholmod_factor.cholesky_inplace(M)
94
- except Exception:
95
- _get_solver.cholmod_factor = cholmod_analyze(M)
96
- _get_solver.cholmod_factor.cholesky_inplace(M)
92
+ # TODO: revert this suppress_warning once the warning bug fix in
93
+ # sksparse is merged/released
94
+ # Suppress spurious warning bug from sksparse with csc_array gh-22089
95
+ # try:
96
+ # # Will raise an exception in the first call,
97
+ # # or when the matrix changes due to a new problem
98
+ # _get_solver.cholmod_factor.cholesky_inplace(M)
99
+ # except Exception:
100
+ # _get_solver.cholmod_factor = cholmod_analyze(M)
101
+ # _get_solver.cholmod_factor.cholesky_inplace(M)
102
+ with catch_warnings(
103
+ action='ignore', category=CholmodTypeConversionWarning
104
+ ):
105
+ try:
106
+ # Will raise an exception in the first call,
107
+ # or when the matrix changes due to a new problem
108
+ _get_solver.cholmod_factor.cholesky_inplace(M)
109
+ except Exception:
110
+ _get_solver.cholmod_factor = cholmod_analyze(M)
111
+ _get_solver.cholmod_factor.cholesky_inplace(M)
97
112
  solve = _get_solver.cholmod_factor
98
113
  else:
99
114
  if has_umfpack and sym_pos:
@@ -199,7 +214,7 @@ def _get_delta(A, b, c, x, y, z, tau, kappa, gamma, eta, sparse=False,
199
214
  if A.shape[0] == 0:
200
215
  # If there are no constraints, some solvers fail (understandably)
201
216
  # rather than returning empty solution. This gets the job done.
202
- sparse, lstsq, sym_pos, cholesky = False, False, True, False
217
+ lstsq, sym_pos, cholesky = False, True, False
203
218
  n_x = len(x)
204
219
 
205
220
  # [4] Equation 8.8
@@ -212,7 +227,7 @@ def _get_delta(A, b, c, x, y, z, tau, kappa, gamma, eta, sparse=False,
212
227
  Dinv = x / z
213
228
 
214
229
  if sparse:
215
- M = A.dot(sps.diags(Dinv, 0, format="csc").dot(A.T))
230
+ M = A.dot(sps.diags_array(Dinv, format="csc").dot(A.T))
216
231
  else:
217
232
  M = A.dot(Dinv.reshape(-1, 1) * A.T)
218
233
  solve = _get_solver(M, sparse, lstsq, sym_pos, cholesky, permc_spec)
@@ -723,7 +738,7 @@ def _ip_hsd(A, b, c, c0, alpha0, beta, maxiter, disp, tol, sparse, lstsq,
723
738
  message = "Optimization terminated successfully."
724
739
 
725
740
  if sparse:
726
- A = sps.csc_matrix(A)
741
+ A = sps.csc_array(A)
727
742
 
728
743
  while go:
729
744
 
@@ -136,9 +136,9 @@ def _check_sparse_inputs(options, meth, A_ub, A_eq):
136
136
  # This is an undocumented option for unit testing sparse presolve
137
137
  _sparse_presolve = options.pop('_sparse_presolve', False)
138
138
  if _sparse_presolve and A_eq is not None:
139
- A_eq = sps.coo_matrix(A_eq)
139
+ A_eq = sps.coo_array(A_eq)
140
140
  if _sparse_presolve and A_ub is not None:
141
- A_ub = sps.coo_matrix(A_ub)
141
+ A_ub = sps.coo_array(A_ub)
142
142
 
143
143
  sparse_constraint = sps.issparse(A_eq) or sps.issparse(A_ub)
144
144
 
@@ -169,17 +169,17 @@ def _format_A_constraints(A, n_x, sparse_lhs=False):
169
169
  The number of variables in the linear programming problem.
170
170
  sparse_lhs : bool
171
171
  Whether either of `A_ub` or `A_eq` are sparse. If true return a
172
- coo_matrix instead of a numpy array.
172
+ coo_array instead of a numpy array.
173
173
 
174
174
  Returns
175
175
  -------
176
- np.ndarray or sparse.coo_matrix
176
+ np.ndarray or sparse.coo_array
177
177
  2-D array such that ``A @ x`` gives the values of the upper-bound
178
178
  (in)equality constraints at ``x``.
179
179
 
180
180
  """
181
181
  if sparse_lhs:
182
- return sps.coo_matrix(
182
+ return sps.coo_array(
183
183
  (0, n_x) if A is None else A, dtype=float, copy=True
184
184
  )
185
185
  elif A is None:
@@ -1116,8 +1116,8 @@ def _get_Abc(lp, c0):
1116
1116
 
1117
1117
  if sps.issparse(A_eq):
1118
1118
  sparse = True
1119
- A_eq = sps.csr_matrix(A_eq)
1120
- A_ub = sps.csr_matrix(A_ub)
1119
+ A_eq = sps.csr_array(A_eq)
1120
+ A_ub = sps.csr_array(A_ub)
1121
1121
 
1122
1122
  def hstack(blocks):
1123
1123
  return sps.hstack(blocks, format="csr")
@@ -1125,8 +1125,8 @@ def _get_Abc(lp, c0):
1125
1125
  def vstack(blocks):
1126
1126
  return sps.vstack(blocks, format="csr")
1127
1127
 
1128
- zeros = sps.csr_matrix
1129
- eye = sps.eye
1128
+ zeros = sps.csr_array
1129
+ eye = sps.eye_array
1130
1130
  else:
1131
1131
  sparse = False
1132
1132
  hstack = np.hstack
@@ -1175,8 +1175,8 @@ def _get_Abc(lp, c0):
1175
1175
  shape = (n_bounds, A_ub.shape[1])
1176
1176
  if sparse:
1177
1177
  idxs = (np.arange(n_bounds), i_newub)
1178
- A_ub = vstack((A_ub, sps.csr_matrix((np.ones(n_bounds), idxs),
1179
- shape=shape)))
1178
+ A_ub = vstack((A_ub, sps.csr_array((np.ones(n_bounds), idxs),
1179
+ shape=shape)))
1180
1180
  else:
1181
1181
  A_ub = vstack((A_ub, np.zeros(shape)))
1182
1182
  A_ub[np.arange(m_ub, A_ub.shape[0]), i_newub] = 1
@@ -1213,10 +1213,8 @@ def _get_Abc(lp, c0):
1213
1213
  lb_shift = lbs[lb_some].astype(float)
1214
1214
  c0 += np.sum(lb_shift * c[i_shift])
1215
1215
  if sparse:
1216
- b = b.reshape(-1, 1)
1217
1216
  A = A.tocsc()
1218
- b -= (A[:, i_shift] @ sps.diags(lb_shift)).sum(axis=1)
1219
- b = b.ravel()
1217
+ b -= (A[:, i_shift] @ sps.diags_array(lb_shift)).sum(axis=1)
1220
1218
  else:
1221
1219
  b -= (A[:, i_shift] * lb_shift).sum(axis=1)
1222
1220
  if x0 is not None:
@@ -1249,7 +1247,7 @@ def _autoscale(A, b, c, x0):
1249
1247
  R = R.toarray().flatten()
1250
1248
  R[R == 0] = 1
1251
1249
  R = 1/_round_to_power_of_two(R)
1252
- A = sps.diags(R)@A if sps.issparse(A) else A*R.reshape(m, 1)
1250
+ A = sps.diags_array(R)@A if sps.issparse(A) else A*R.reshape(m, 1)
1253
1251
  b = b*R
1254
1252
 
1255
1253
  C = np.max(np.abs(A), axis=0)
@@ -1257,7 +1255,7 @@ def _autoscale(A, b, c, x0):
1257
1255
  C = C.toarray().flatten()
1258
1256
  C[C == 0] = 1
1259
1257
  C = 1/_round_to_power_of_two(C)
1260
- A = A@sps.diags(C) if sps.issparse(A) else A*C
1258
+ A = A@sps.diags_array(C) if sps.issparse(A) else A*C
1261
1259
  c = c*C
1262
1260
 
1263
1261
  b_scale = np.max(np.abs(b)) if b.size > 0 else 1
Binary file
@@ -5,8 +5,8 @@ import numpy as np
5
5
  from numpy.linalg import norm
6
6
 
7
7
  from scipy.linalg import cho_factor, cho_solve, LinAlgError
8
- from scipy.sparse import issparse
9
8
  from scipy.sparse.linalg import LinearOperator, aslinearoperator
9
+ from scipy._lib._sparse import issparse
10
10
 
11
11
 
12
12
  EPS = np.finfo(float).eps
@@ -258,7 +258,7 @@ def build_quadratic_1d(J, g, s, diag=None, s0=None):
258
258
 
259
259
  Parameters
260
260
  ----------
261
- J : ndarray, sparse matrix or LinearOperator shape (m, n)
261
+ J : ndarray, sparse array or LinearOperator shape (m, n)
262
262
  Jacobian matrix, affects the quadratic term.
263
263
  g : ndarray, shape (n,)
264
264
  Gradient, defines the linear term.
@@ -329,7 +329,7 @@ def evaluate_quadratic(J, g, s, diag=None):
329
329
 
330
330
  Parameters
331
331
  ----------
332
- J : ndarray, sparse matrix or LinearOperator, shape (m, n)
332
+ J : ndarray, sparse array or LinearOperator, shape (m, n)
333
333
  Jacobian matrix, affects the quadratic term.
334
334
  g : ndarray, shape (n,)
335
335
  Gradient, defines the linear term.
@@ -45,6 +45,8 @@ from numpy.linalg import lstsq, norm
45
45
 
46
46
  from scipy.sparse.linalg import LinearOperator, aslinearoperator, lsmr
47
47
  from scipy.optimize import OptimizeResult
48
+ from scipy._lib._util import _call_callback_maybe_halt
49
+
48
50
 
49
51
  from .common import (
50
52
  step_size_to_bound, in_bounds, update_tr_radius, evaluate_quadratic,
@@ -147,7 +149,7 @@ def dogleg_step(x, newton_step, g, a, b, tr_bounds, lb, ub):
147
149
 
148
150
 
149
151
  def dogbox(fun, jac, x0, f0, J0, lb, ub, ftol, xtol, gtol, max_nfev, x_scale,
150
- loss_function, tr_solver, tr_options, verbose):
152
+ loss_function, tr_solver, tr_options, verbose, callback=None):
151
153
  f = f0
152
154
  f_true = f.copy()
153
155
  nfev = 1
@@ -306,7 +308,7 @@ def dogbox(fun, jac, x0, f0, J0, lb, ub, ftol, xtol, gtol, max_nfev, x_scale,
306
308
 
307
309
  cost = cost_new
308
310
 
309
- J = jac(x, f)
311
+ J = jac(x)
310
312
  njev += 1
311
313
 
312
314
  if loss_function is not None:
@@ -322,6 +324,18 @@ def dogbox(fun, jac, x0, f0, J0, lb, ub, ftol, xtol, gtol, max_nfev, x_scale,
322
324
  actual_reduction = 0
323
325
 
324
326
  iteration += 1
327
+
328
+ # Call callback function and possibly stop optimization
329
+ if callback is not None:
330
+ intermediate_result = OptimizeResult(
331
+ x=x, fun=f, nit=iteration, nfev=nfev)
332
+ intermediate_result["cost"] = cost_new
333
+
334
+ if _call_callback_maybe_halt(
335
+ callback, intermediate_result
336
+ ):
337
+ termination_status = -2
338
+ break
325
339
 
326
340
  if termination_status is None:
327
341
  termination_status = 0