scipy 1.16.1__cp314-cp314t-macosx_10_14_x86_64.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 (1416) 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/.dylibs/libscipy_openblas.dylib +0 -0
  5. scipy/__config__.py +161 -0
  6. scipy/__init__.py +138 -0
  7. scipy/_cyutility.cpython-314t-darwin.so +0 -0
  8. scipy/_distributor_init.py +18 -0
  9. scipy/_lib/__init__.py +14 -0
  10. scipy/_lib/_array_api.py +931 -0
  11. scipy/_lib/_array_api_compat_vendor.py +9 -0
  12. scipy/_lib/_array_api_no_0d.py +103 -0
  13. scipy/_lib/_bunch.py +229 -0
  14. scipy/_lib/_ccallback.py +251 -0
  15. scipy/_lib/_ccallback_c.cpython-314t-darwin.so +0 -0
  16. scipy/_lib/_disjoint_set.py +254 -0
  17. scipy/_lib/_docscrape.py +761 -0
  18. scipy/_lib/_elementwise_iterative_method.py +346 -0
  19. scipy/_lib/_fpumode.cpython-314t-darwin.so +0 -0
  20. scipy/_lib/_gcutils.py +105 -0
  21. scipy/_lib/_pep440.py +487 -0
  22. scipy/_lib/_sparse.py +41 -0
  23. scipy/_lib/_test_ccallback.cpython-314t-darwin.so +0 -0
  24. scipy/_lib/_test_deprecation_call.cpython-314t-darwin.so +0 -0
  25. scipy/_lib/_test_deprecation_def.cpython-314t-darwin.so +0 -0
  26. scipy/_lib/_testutils.py +373 -0
  27. scipy/_lib/_threadsafety.py +58 -0
  28. scipy/_lib/_tmpdirs.py +86 -0
  29. scipy/_lib/_uarray/LICENSE +29 -0
  30. scipy/_lib/_uarray/__init__.py +116 -0
  31. scipy/_lib/_uarray/_backend.py +707 -0
  32. scipy/_lib/_uarray/_uarray.cpython-314t-darwin.so +0 -0
  33. scipy/_lib/_util.py +1283 -0
  34. scipy/_lib/array_api_compat/__init__.py +22 -0
  35. scipy/_lib/array_api_compat/_internal.py +59 -0
  36. scipy/_lib/array_api_compat/common/__init__.py +1 -0
  37. scipy/_lib/array_api_compat/common/_aliases.py +727 -0
  38. scipy/_lib/array_api_compat/common/_fft.py +213 -0
  39. scipy/_lib/array_api_compat/common/_helpers.py +1058 -0
  40. scipy/_lib/array_api_compat/common/_linalg.py +232 -0
  41. scipy/_lib/array_api_compat/common/_typing.py +192 -0
  42. scipy/_lib/array_api_compat/cupy/__init__.py +13 -0
  43. scipy/_lib/array_api_compat/cupy/_aliases.py +156 -0
  44. scipy/_lib/array_api_compat/cupy/_info.py +336 -0
  45. scipy/_lib/array_api_compat/cupy/_typing.py +31 -0
  46. scipy/_lib/array_api_compat/cupy/fft.py +36 -0
  47. scipy/_lib/array_api_compat/cupy/linalg.py +49 -0
  48. scipy/_lib/array_api_compat/dask/__init__.py +0 -0
  49. scipy/_lib/array_api_compat/dask/array/__init__.py +12 -0
  50. scipy/_lib/array_api_compat/dask/array/_aliases.py +376 -0
  51. scipy/_lib/array_api_compat/dask/array/_info.py +416 -0
  52. scipy/_lib/array_api_compat/dask/array/fft.py +21 -0
  53. scipy/_lib/array_api_compat/dask/array/linalg.py +72 -0
  54. scipy/_lib/array_api_compat/numpy/__init__.py +28 -0
  55. scipy/_lib/array_api_compat/numpy/_aliases.py +190 -0
  56. scipy/_lib/array_api_compat/numpy/_info.py +366 -0
  57. scipy/_lib/array_api_compat/numpy/_typing.py +30 -0
  58. scipy/_lib/array_api_compat/numpy/fft.py +35 -0
  59. scipy/_lib/array_api_compat/numpy/linalg.py +143 -0
  60. scipy/_lib/array_api_compat/torch/__init__.py +22 -0
  61. scipy/_lib/array_api_compat/torch/_aliases.py +855 -0
  62. scipy/_lib/array_api_compat/torch/_info.py +369 -0
  63. scipy/_lib/array_api_compat/torch/_typing.py +3 -0
  64. scipy/_lib/array_api_compat/torch/fft.py +85 -0
  65. scipy/_lib/array_api_compat/torch/linalg.py +121 -0
  66. scipy/_lib/array_api_extra/__init__.py +38 -0
  67. scipy/_lib/array_api_extra/_delegation.py +171 -0
  68. scipy/_lib/array_api_extra/_lib/__init__.py +1 -0
  69. scipy/_lib/array_api_extra/_lib/_at.py +463 -0
  70. scipy/_lib/array_api_extra/_lib/_backends.py +46 -0
  71. scipy/_lib/array_api_extra/_lib/_funcs.py +937 -0
  72. scipy/_lib/array_api_extra/_lib/_lazy.py +357 -0
  73. scipy/_lib/array_api_extra/_lib/_testing.py +278 -0
  74. scipy/_lib/array_api_extra/_lib/_utils/__init__.py +1 -0
  75. scipy/_lib/array_api_extra/_lib/_utils/_compat.py +74 -0
  76. scipy/_lib/array_api_extra/_lib/_utils/_compat.pyi +45 -0
  77. scipy/_lib/array_api_extra/_lib/_utils/_helpers.py +559 -0
  78. scipy/_lib/array_api_extra/_lib/_utils/_typing.py +10 -0
  79. scipy/_lib/array_api_extra/_lib/_utils/_typing.pyi +105 -0
  80. scipy/_lib/array_api_extra/testing.py +359 -0
  81. scipy/_lib/cobyqa/__init__.py +20 -0
  82. scipy/_lib/cobyqa/framework.py +1240 -0
  83. scipy/_lib/cobyqa/main.py +1506 -0
  84. scipy/_lib/cobyqa/models.py +1529 -0
  85. scipy/_lib/cobyqa/problem.py +1296 -0
  86. scipy/_lib/cobyqa/settings.py +132 -0
  87. scipy/_lib/cobyqa/subsolvers/__init__.py +14 -0
  88. scipy/_lib/cobyqa/subsolvers/geometry.py +387 -0
  89. scipy/_lib/cobyqa/subsolvers/optim.py +1203 -0
  90. scipy/_lib/cobyqa/utils/__init__.py +18 -0
  91. scipy/_lib/cobyqa/utils/exceptions.py +22 -0
  92. scipy/_lib/cobyqa/utils/math.py +77 -0
  93. scipy/_lib/cobyqa/utils/versions.py +67 -0
  94. scipy/_lib/decorator.py +399 -0
  95. scipy/_lib/deprecation.py +274 -0
  96. scipy/_lib/doccer.py +366 -0
  97. scipy/_lib/messagestream.cpython-314t-darwin.so +0 -0
  98. scipy/_lib/pyprima/__init__.py +212 -0
  99. scipy/_lib/pyprima/cobyla/__init__.py +0 -0
  100. scipy/_lib/pyprima/cobyla/cobyla.py +559 -0
  101. scipy/_lib/pyprima/cobyla/cobylb.py +714 -0
  102. scipy/_lib/pyprima/cobyla/geometry.py +226 -0
  103. scipy/_lib/pyprima/cobyla/initialize.py +215 -0
  104. scipy/_lib/pyprima/cobyla/trustregion.py +492 -0
  105. scipy/_lib/pyprima/cobyla/update.py +289 -0
  106. scipy/_lib/pyprima/common/__init__.py +0 -0
  107. scipy/_lib/pyprima/common/_bounds.py +34 -0
  108. scipy/_lib/pyprima/common/_linear_constraints.py +46 -0
  109. scipy/_lib/pyprima/common/_nonlinear_constraints.py +54 -0
  110. scipy/_lib/pyprima/common/_project.py +173 -0
  111. scipy/_lib/pyprima/common/checkbreak.py +93 -0
  112. scipy/_lib/pyprima/common/consts.py +47 -0
  113. scipy/_lib/pyprima/common/evaluate.py +99 -0
  114. scipy/_lib/pyprima/common/history.py +38 -0
  115. scipy/_lib/pyprima/common/infos.py +30 -0
  116. scipy/_lib/pyprima/common/linalg.py +435 -0
  117. scipy/_lib/pyprima/common/message.py +290 -0
  118. scipy/_lib/pyprima/common/powalg.py +131 -0
  119. scipy/_lib/pyprima/common/preproc.py +277 -0
  120. scipy/_lib/pyprima/common/present.py +5 -0
  121. scipy/_lib/pyprima/common/ratio.py +54 -0
  122. scipy/_lib/pyprima/common/redrho.py +47 -0
  123. scipy/_lib/pyprima/common/selectx.py +296 -0
  124. scipy/_lib/tests/__init__.py +0 -0
  125. scipy/_lib/tests/test__gcutils.py +110 -0
  126. scipy/_lib/tests/test__pep440.py +67 -0
  127. scipy/_lib/tests/test__testutils.py +32 -0
  128. scipy/_lib/tests/test__threadsafety.py +51 -0
  129. scipy/_lib/tests/test__util.py +641 -0
  130. scipy/_lib/tests/test_array_api.py +322 -0
  131. scipy/_lib/tests/test_bunch.py +169 -0
  132. scipy/_lib/tests/test_ccallback.py +196 -0
  133. scipy/_lib/tests/test_config.py +45 -0
  134. scipy/_lib/tests/test_deprecation.py +10 -0
  135. scipy/_lib/tests/test_doccer.py +143 -0
  136. scipy/_lib/tests/test_import_cycles.py +18 -0
  137. scipy/_lib/tests/test_public_api.py +482 -0
  138. scipy/_lib/tests/test_scipy_version.py +28 -0
  139. scipy/_lib/tests/test_tmpdirs.py +48 -0
  140. scipy/_lib/tests/test_warnings.py +137 -0
  141. scipy/_lib/uarray.py +31 -0
  142. scipy/cluster/__init__.py +31 -0
  143. scipy/cluster/_hierarchy.cpython-314t-darwin.so +0 -0
  144. scipy/cluster/_optimal_leaf_ordering.cpython-314t-darwin.so +0 -0
  145. scipy/cluster/_vq.cpython-314t-darwin.so +0 -0
  146. scipy/cluster/hierarchy.py +4348 -0
  147. scipy/cluster/tests/__init__.py +0 -0
  148. scipy/cluster/tests/hierarchy_test_data.py +145 -0
  149. scipy/cluster/tests/test_disjoint_set.py +202 -0
  150. scipy/cluster/tests/test_hierarchy.py +1238 -0
  151. scipy/cluster/tests/test_vq.py +434 -0
  152. scipy/cluster/vq.py +832 -0
  153. scipy/conftest.py +683 -0
  154. scipy/constants/__init__.py +358 -0
  155. scipy/constants/_codata.py +2266 -0
  156. scipy/constants/_constants.py +369 -0
  157. scipy/constants/codata.py +21 -0
  158. scipy/constants/constants.py +53 -0
  159. scipy/constants/tests/__init__.py +0 -0
  160. scipy/constants/tests/test_codata.py +78 -0
  161. scipy/constants/tests/test_constants.py +83 -0
  162. scipy/datasets/__init__.py +90 -0
  163. scipy/datasets/_download_all.py +71 -0
  164. scipy/datasets/_fetchers.py +225 -0
  165. scipy/datasets/_registry.py +26 -0
  166. scipy/datasets/_utils.py +81 -0
  167. scipy/datasets/tests/__init__.py +0 -0
  168. scipy/datasets/tests/test_data.py +128 -0
  169. scipy/differentiate/__init__.py +27 -0
  170. scipy/differentiate/_differentiate.py +1129 -0
  171. scipy/differentiate/tests/__init__.py +0 -0
  172. scipy/differentiate/tests/test_differentiate.py +694 -0
  173. scipy/fft/__init__.py +114 -0
  174. scipy/fft/_backend.py +196 -0
  175. scipy/fft/_basic.py +1650 -0
  176. scipy/fft/_basic_backend.py +197 -0
  177. scipy/fft/_debug_backends.py +22 -0
  178. scipy/fft/_fftlog.py +223 -0
  179. scipy/fft/_fftlog_backend.py +200 -0
  180. scipy/fft/_helper.py +348 -0
  181. scipy/fft/_pocketfft/LICENSE.md +25 -0
  182. scipy/fft/_pocketfft/__init__.py +9 -0
  183. scipy/fft/_pocketfft/basic.py +251 -0
  184. scipy/fft/_pocketfft/helper.py +249 -0
  185. scipy/fft/_pocketfft/pypocketfft.cpython-314t-darwin.so +0 -0
  186. scipy/fft/_pocketfft/realtransforms.py +109 -0
  187. scipy/fft/_pocketfft/tests/__init__.py +0 -0
  188. scipy/fft/_pocketfft/tests/test_basic.py +1011 -0
  189. scipy/fft/_pocketfft/tests/test_real_transforms.py +505 -0
  190. scipy/fft/_realtransforms.py +706 -0
  191. scipy/fft/_realtransforms_backend.py +63 -0
  192. scipy/fft/tests/__init__.py +0 -0
  193. scipy/fft/tests/mock_backend.py +96 -0
  194. scipy/fft/tests/test_backend.py +98 -0
  195. scipy/fft/tests/test_basic.py +504 -0
  196. scipy/fft/tests/test_fftlog.py +215 -0
  197. scipy/fft/tests/test_helper.py +558 -0
  198. scipy/fft/tests/test_multithreading.py +84 -0
  199. scipy/fft/tests/test_real_transforms.py +247 -0
  200. scipy/fftpack/__init__.py +103 -0
  201. scipy/fftpack/_basic.py +428 -0
  202. scipy/fftpack/_helper.py +115 -0
  203. scipy/fftpack/_pseudo_diffs.py +554 -0
  204. scipy/fftpack/_realtransforms.py +598 -0
  205. scipy/fftpack/basic.py +20 -0
  206. scipy/fftpack/convolve.cpython-314t-darwin.so +0 -0
  207. scipy/fftpack/helper.py +19 -0
  208. scipy/fftpack/pseudo_diffs.py +22 -0
  209. scipy/fftpack/realtransforms.py +19 -0
  210. scipy/fftpack/tests/__init__.py +0 -0
  211. scipy/fftpack/tests/fftw_double_ref.npz +0 -0
  212. scipy/fftpack/tests/fftw_longdouble_ref.npz +0 -0
  213. scipy/fftpack/tests/fftw_single_ref.npz +0 -0
  214. scipy/fftpack/tests/test.npz +0 -0
  215. scipy/fftpack/tests/test_basic.py +877 -0
  216. scipy/fftpack/tests/test_helper.py +54 -0
  217. scipy/fftpack/tests/test_import.py +33 -0
  218. scipy/fftpack/tests/test_pseudo_diffs.py +388 -0
  219. scipy/fftpack/tests/test_real_transforms.py +836 -0
  220. scipy/integrate/__init__.py +122 -0
  221. scipy/integrate/_bvp.py +1160 -0
  222. scipy/integrate/_cubature.py +729 -0
  223. scipy/integrate/_dop.cpython-314t-darwin.so +0 -0
  224. scipy/integrate/_ivp/__init__.py +8 -0
  225. scipy/integrate/_ivp/base.py +290 -0
  226. scipy/integrate/_ivp/bdf.py +478 -0
  227. scipy/integrate/_ivp/common.py +451 -0
  228. scipy/integrate/_ivp/dop853_coefficients.py +193 -0
  229. scipy/integrate/_ivp/ivp.py +755 -0
  230. scipy/integrate/_ivp/lsoda.py +224 -0
  231. scipy/integrate/_ivp/radau.py +572 -0
  232. scipy/integrate/_ivp/rk.py +601 -0
  233. scipy/integrate/_ivp/tests/__init__.py +0 -0
  234. scipy/integrate/_ivp/tests/test_ivp.py +1287 -0
  235. scipy/integrate/_ivp/tests/test_rk.py +37 -0
  236. scipy/integrate/_lebedev.py +5450 -0
  237. scipy/integrate/_lsoda.cpython-314t-darwin.so +0 -0
  238. scipy/integrate/_ode.py +1395 -0
  239. scipy/integrate/_odepack.cpython-314t-darwin.so +0 -0
  240. scipy/integrate/_odepack_py.py +273 -0
  241. scipy/integrate/_quad_vec.py +674 -0
  242. scipy/integrate/_quadpack.cpython-314t-darwin.so +0 -0
  243. scipy/integrate/_quadpack_py.py +1283 -0
  244. scipy/integrate/_quadrature.py +1336 -0
  245. scipy/integrate/_rules/__init__.py +12 -0
  246. scipy/integrate/_rules/_base.py +518 -0
  247. scipy/integrate/_rules/_gauss_kronrod.py +202 -0
  248. scipy/integrate/_rules/_gauss_legendre.py +62 -0
  249. scipy/integrate/_rules/_genz_malik.py +210 -0
  250. scipy/integrate/_tanhsinh.py +1385 -0
  251. scipy/integrate/_test_multivariate.cpython-314t-darwin.so +0 -0
  252. scipy/integrate/_test_odeint_banded.cpython-314t-darwin.so +0 -0
  253. scipy/integrate/_vode.cpython-314t-darwin.so +0 -0
  254. scipy/integrate/dop.py +15 -0
  255. scipy/integrate/lsoda.py +15 -0
  256. scipy/integrate/odepack.py +17 -0
  257. scipy/integrate/quadpack.py +23 -0
  258. scipy/integrate/tests/__init__.py +0 -0
  259. scipy/integrate/tests/test__quad_vec.py +211 -0
  260. scipy/integrate/tests/test_banded_ode_solvers.py +305 -0
  261. scipy/integrate/tests/test_bvp.py +714 -0
  262. scipy/integrate/tests/test_cubature.py +1375 -0
  263. scipy/integrate/tests/test_integrate.py +840 -0
  264. scipy/integrate/tests/test_odeint_jac.py +74 -0
  265. scipy/integrate/tests/test_quadpack.py +680 -0
  266. scipy/integrate/tests/test_quadrature.py +730 -0
  267. scipy/integrate/tests/test_tanhsinh.py +1171 -0
  268. scipy/integrate/vode.py +15 -0
  269. scipy/interpolate/__init__.py +228 -0
  270. scipy/interpolate/_bary_rational.py +715 -0
  271. scipy/interpolate/_bsplines.py +2469 -0
  272. scipy/interpolate/_cubic.py +973 -0
  273. scipy/interpolate/_dfitpack.cpython-314t-darwin.so +0 -0
  274. scipy/interpolate/_dierckx.cpython-314t-darwin.so +0 -0
  275. scipy/interpolate/_fitpack.cpython-314t-darwin.so +0 -0
  276. scipy/interpolate/_fitpack2.py +2397 -0
  277. scipy/interpolate/_fitpack_impl.py +811 -0
  278. scipy/interpolate/_fitpack_py.py +898 -0
  279. scipy/interpolate/_fitpack_repro.py +996 -0
  280. scipy/interpolate/_interpnd.cpython-314t-darwin.so +0 -0
  281. scipy/interpolate/_interpolate.py +2266 -0
  282. scipy/interpolate/_ndbspline.py +415 -0
  283. scipy/interpolate/_ndgriddata.py +329 -0
  284. scipy/interpolate/_pade.py +67 -0
  285. scipy/interpolate/_polyint.py +1025 -0
  286. scipy/interpolate/_ppoly.cpython-314t-darwin.so +0 -0
  287. scipy/interpolate/_rbf.py +290 -0
  288. scipy/interpolate/_rbfinterp.py +550 -0
  289. scipy/interpolate/_rbfinterp_pythran.cpython-314t-darwin.so +0 -0
  290. scipy/interpolate/_rgi.py +764 -0
  291. scipy/interpolate/_rgi_cython.cpython-314t-darwin.so +0 -0
  292. scipy/interpolate/dfitpack.py +24 -0
  293. scipy/interpolate/fitpack.py +31 -0
  294. scipy/interpolate/fitpack2.py +29 -0
  295. scipy/interpolate/interpnd.py +24 -0
  296. scipy/interpolate/interpolate.py +30 -0
  297. scipy/interpolate/ndgriddata.py +23 -0
  298. scipy/interpolate/polyint.py +24 -0
  299. scipy/interpolate/rbf.py +18 -0
  300. scipy/interpolate/tests/__init__.py +0 -0
  301. scipy/interpolate/tests/data/bug-1310.npz +0 -0
  302. scipy/interpolate/tests/data/estimate_gradients_hang.npy +0 -0
  303. scipy/interpolate/tests/data/gcvspl.npz +0 -0
  304. scipy/interpolate/tests/test_bary_rational.py +368 -0
  305. scipy/interpolate/tests/test_bsplines.py +3754 -0
  306. scipy/interpolate/tests/test_fitpack.py +519 -0
  307. scipy/interpolate/tests/test_fitpack2.py +1431 -0
  308. scipy/interpolate/tests/test_gil.py +64 -0
  309. scipy/interpolate/tests/test_interpnd.py +452 -0
  310. scipy/interpolate/tests/test_interpolate.py +2630 -0
  311. scipy/interpolate/tests/test_ndgriddata.py +308 -0
  312. scipy/interpolate/tests/test_pade.py +107 -0
  313. scipy/interpolate/tests/test_polyint.py +972 -0
  314. scipy/interpolate/tests/test_rbf.py +246 -0
  315. scipy/interpolate/tests/test_rbfinterp.py +534 -0
  316. scipy/interpolate/tests/test_rgi.py +1151 -0
  317. scipy/io/__init__.py +116 -0
  318. scipy/io/_fast_matrix_market/__init__.py +600 -0
  319. scipy/io/_fast_matrix_market/_fmm_core.cpython-314t-darwin.so +0 -0
  320. scipy/io/_fortran.py +354 -0
  321. scipy/io/_harwell_boeing/__init__.py +7 -0
  322. scipy/io/_harwell_boeing/_fortran_format_parser.py +316 -0
  323. scipy/io/_harwell_boeing/hb.py +571 -0
  324. scipy/io/_harwell_boeing/tests/__init__.py +0 -0
  325. scipy/io/_harwell_boeing/tests/test_fortran_format.py +74 -0
  326. scipy/io/_harwell_boeing/tests/test_hb.py +70 -0
  327. scipy/io/_idl.py +917 -0
  328. scipy/io/_mmio.py +968 -0
  329. scipy/io/_netcdf.py +1104 -0
  330. scipy/io/_test_fortran.cpython-314t-darwin.so +0 -0
  331. scipy/io/arff/__init__.py +28 -0
  332. scipy/io/arff/_arffread.py +873 -0
  333. scipy/io/arff/arffread.py +19 -0
  334. scipy/io/arff/tests/__init__.py +0 -0
  335. scipy/io/arff/tests/data/iris.arff +225 -0
  336. scipy/io/arff/tests/data/missing.arff +8 -0
  337. scipy/io/arff/tests/data/nodata.arff +11 -0
  338. scipy/io/arff/tests/data/quoted_nominal.arff +13 -0
  339. scipy/io/arff/tests/data/quoted_nominal_spaces.arff +13 -0
  340. scipy/io/arff/tests/data/test1.arff +10 -0
  341. scipy/io/arff/tests/data/test10.arff +8 -0
  342. scipy/io/arff/tests/data/test11.arff +11 -0
  343. scipy/io/arff/tests/data/test2.arff +15 -0
  344. scipy/io/arff/tests/data/test3.arff +6 -0
  345. scipy/io/arff/tests/data/test4.arff +11 -0
  346. scipy/io/arff/tests/data/test5.arff +26 -0
  347. scipy/io/arff/tests/data/test6.arff +12 -0
  348. scipy/io/arff/tests/data/test7.arff +15 -0
  349. scipy/io/arff/tests/data/test8.arff +12 -0
  350. scipy/io/arff/tests/data/test9.arff +14 -0
  351. scipy/io/arff/tests/test_arffread.py +421 -0
  352. scipy/io/harwell_boeing.py +17 -0
  353. scipy/io/idl.py +17 -0
  354. scipy/io/matlab/__init__.py +66 -0
  355. scipy/io/matlab/_byteordercodes.py +75 -0
  356. scipy/io/matlab/_mio.py +375 -0
  357. scipy/io/matlab/_mio4.py +632 -0
  358. scipy/io/matlab/_mio5.py +901 -0
  359. scipy/io/matlab/_mio5_params.py +281 -0
  360. scipy/io/matlab/_mio5_utils.cpython-314t-darwin.so +0 -0
  361. scipy/io/matlab/_mio_utils.cpython-314t-darwin.so +0 -0
  362. scipy/io/matlab/_miobase.py +435 -0
  363. scipy/io/matlab/_streams.cpython-314t-darwin.so +0 -0
  364. scipy/io/matlab/byteordercodes.py +17 -0
  365. scipy/io/matlab/mio.py +16 -0
  366. scipy/io/matlab/mio4.py +17 -0
  367. scipy/io/matlab/mio5.py +19 -0
  368. scipy/io/matlab/mio5_params.py +18 -0
  369. scipy/io/matlab/mio5_utils.py +17 -0
  370. scipy/io/matlab/mio_utils.py +17 -0
  371. scipy/io/matlab/miobase.py +16 -0
  372. scipy/io/matlab/streams.py +16 -0
  373. scipy/io/matlab/tests/__init__.py +0 -0
  374. scipy/io/matlab/tests/data/bad_miuint32.mat +0 -0
  375. scipy/io/matlab/tests/data/bad_miutf8_array_name.mat +0 -0
  376. scipy/io/matlab/tests/data/big_endian.mat +0 -0
  377. scipy/io/matlab/tests/data/broken_utf8.mat +0 -0
  378. scipy/io/matlab/tests/data/corrupted_zlib_checksum.mat +0 -0
  379. scipy/io/matlab/tests/data/corrupted_zlib_data.mat +0 -0
  380. scipy/io/matlab/tests/data/debigged_m4.mat +0 -0
  381. scipy/io/matlab/tests/data/japanese_utf8.txt +5 -0
  382. scipy/io/matlab/tests/data/little_endian.mat +0 -0
  383. scipy/io/matlab/tests/data/logical_sparse.mat +0 -0
  384. scipy/io/matlab/tests/data/malformed1.mat +0 -0
  385. scipy/io/matlab/tests/data/miuint32_for_miint32.mat +0 -0
  386. scipy/io/matlab/tests/data/miutf8_array_name.mat +0 -0
  387. scipy/io/matlab/tests/data/nasty_duplicate_fieldnames.mat +0 -0
  388. scipy/io/matlab/tests/data/one_by_zero_char.mat +0 -0
  389. scipy/io/matlab/tests/data/parabola.mat +0 -0
  390. scipy/io/matlab/tests/data/single_empty_string.mat +0 -0
  391. scipy/io/matlab/tests/data/some_functions.mat +0 -0
  392. scipy/io/matlab/tests/data/sqr.mat +0 -0
  393. scipy/io/matlab/tests/data/test3dmatrix_6.1_SOL2.mat +0 -0
  394. scipy/io/matlab/tests/data/test3dmatrix_6.5.1_GLNX86.mat +0 -0
  395. scipy/io/matlab/tests/data/test3dmatrix_7.1_GLNX86.mat +0 -0
  396. scipy/io/matlab/tests/data/test3dmatrix_7.4_GLNX86.mat +0 -0
  397. scipy/io/matlab/tests/data/test_empty_struct.mat +0 -0
  398. scipy/io/matlab/tests/data/test_mat4_le_floats.mat +0 -0
  399. scipy/io/matlab/tests/data/test_skip_variable.mat +0 -0
  400. scipy/io/matlab/tests/data/testbool_8_WIN64.mat +0 -0
  401. scipy/io/matlab/tests/data/testcell_6.1_SOL2.mat +0 -0
  402. scipy/io/matlab/tests/data/testcell_6.5.1_GLNX86.mat +0 -0
  403. scipy/io/matlab/tests/data/testcell_7.1_GLNX86.mat +0 -0
  404. scipy/io/matlab/tests/data/testcell_7.4_GLNX86.mat +0 -0
  405. scipy/io/matlab/tests/data/testcellnest_6.1_SOL2.mat +0 -0
  406. scipy/io/matlab/tests/data/testcellnest_6.5.1_GLNX86.mat +0 -0
  407. scipy/io/matlab/tests/data/testcellnest_7.1_GLNX86.mat +0 -0
  408. scipy/io/matlab/tests/data/testcellnest_7.4_GLNX86.mat +0 -0
  409. scipy/io/matlab/tests/data/testcomplex_4.2c_SOL2.mat +0 -0
  410. scipy/io/matlab/tests/data/testcomplex_6.1_SOL2.mat +0 -0
  411. scipy/io/matlab/tests/data/testcomplex_6.5.1_GLNX86.mat +0 -0
  412. scipy/io/matlab/tests/data/testcomplex_7.1_GLNX86.mat +0 -0
  413. scipy/io/matlab/tests/data/testcomplex_7.4_GLNX86.mat +0 -0
  414. scipy/io/matlab/tests/data/testdouble_4.2c_SOL2.mat +0 -0
  415. scipy/io/matlab/tests/data/testdouble_6.1_SOL2.mat +0 -0
  416. scipy/io/matlab/tests/data/testdouble_6.5.1_GLNX86.mat +0 -0
  417. scipy/io/matlab/tests/data/testdouble_7.1_GLNX86.mat +0 -0
  418. scipy/io/matlab/tests/data/testdouble_7.4_GLNX86.mat +0 -0
  419. scipy/io/matlab/tests/data/testemptycell_5.3_SOL2.mat +0 -0
  420. scipy/io/matlab/tests/data/testemptycell_6.5.1_GLNX86.mat +0 -0
  421. scipy/io/matlab/tests/data/testemptycell_7.1_GLNX86.mat +0 -0
  422. scipy/io/matlab/tests/data/testemptycell_7.4_GLNX86.mat +0 -0
  423. scipy/io/matlab/tests/data/testfunc_7.4_GLNX86.mat +0 -0
  424. scipy/io/matlab/tests/data/testhdf5_7.4_GLNX86.mat +0 -0
  425. scipy/io/matlab/tests/data/testmatrix_4.2c_SOL2.mat +0 -0
  426. scipy/io/matlab/tests/data/testmatrix_6.1_SOL2.mat +0 -0
  427. scipy/io/matlab/tests/data/testmatrix_6.5.1_GLNX86.mat +0 -0
  428. scipy/io/matlab/tests/data/testmatrix_7.1_GLNX86.mat +0 -0
  429. scipy/io/matlab/tests/data/testmatrix_7.4_GLNX86.mat +0 -0
  430. scipy/io/matlab/tests/data/testminus_4.2c_SOL2.mat +0 -0
  431. scipy/io/matlab/tests/data/testminus_6.1_SOL2.mat +0 -0
  432. scipy/io/matlab/tests/data/testminus_6.5.1_GLNX86.mat +0 -0
  433. scipy/io/matlab/tests/data/testminus_7.1_GLNX86.mat +0 -0
  434. scipy/io/matlab/tests/data/testminus_7.4_GLNX86.mat +0 -0
  435. scipy/io/matlab/tests/data/testmulti_4.2c_SOL2.mat +0 -0
  436. scipy/io/matlab/tests/data/testmulti_7.1_GLNX86.mat +0 -0
  437. scipy/io/matlab/tests/data/testmulti_7.4_GLNX86.mat +0 -0
  438. scipy/io/matlab/tests/data/testobject_6.1_SOL2.mat +0 -0
  439. scipy/io/matlab/tests/data/testobject_6.5.1_GLNX86.mat +0 -0
  440. scipy/io/matlab/tests/data/testobject_7.1_GLNX86.mat +0 -0
  441. scipy/io/matlab/tests/data/testobject_7.4_GLNX86.mat +0 -0
  442. scipy/io/matlab/tests/data/testonechar_4.2c_SOL2.mat +0 -0
  443. scipy/io/matlab/tests/data/testonechar_6.1_SOL2.mat +0 -0
  444. scipy/io/matlab/tests/data/testonechar_6.5.1_GLNX86.mat +0 -0
  445. scipy/io/matlab/tests/data/testonechar_7.1_GLNX86.mat +0 -0
  446. scipy/io/matlab/tests/data/testonechar_7.4_GLNX86.mat +0 -0
  447. scipy/io/matlab/tests/data/testscalarcell_7.4_GLNX86.mat +0 -0
  448. scipy/io/matlab/tests/data/testsimplecell.mat +0 -0
  449. scipy/io/matlab/tests/data/testsparse_4.2c_SOL2.mat +0 -0
  450. scipy/io/matlab/tests/data/testsparse_6.1_SOL2.mat +0 -0
  451. scipy/io/matlab/tests/data/testsparse_6.5.1_GLNX86.mat +0 -0
  452. scipy/io/matlab/tests/data/testsparse_7.1_GLNX86.mat +0 -0
  453. scipy/io/matlab/tests/data/testsparse_7.4_GLNX86.mat +0 -0
  454. scipy/io/matlab/tests/data/testsparsecomplex_4.2c_SOL2.mat +0 -0
  455. scipy/io/matlab/tests/data/testsparsecomplex_6.1_SOL2.mat +0 -0
  456. scipy/io/matlab/tests/data/testsparsecomplex_6.5.1_GLNX86.mat +0 -0
  457. scipy/io/matlab/tests/data/testsparsecomplex_7.1_GLNX86.mat +0 -0
  458. scipy/io/matlab/tests/data/testsparsecomplex_7.4_GLNX86.mat +0 -0
  459. scipy/io/matlab/tests/data/testsparsefloat_7.4_GLNX86.mat +0 -0
  460. scipy/io/matlab/tests/data/teststring_4.2c_SOL2.mat +0 -0
  461. scipy/io/matlab/tests/data/teststring_6.1_SOL2.mat +0 -0
  462. scipy/io/matlab/tests/data/teststring_6.5.1_GLNX86.mat +0 -0
  463. scipy/io/matlab/tests/data/teststring_7.1_GLNX86.mat +0 -0
  464. scipy/io/matlab/tests/data/teststring_7.4_GLNX86.mat +0 -0
  465. scipy/io/matlab/tests/data/teststringarray_4.2c_SOL2.mat +0 -0
  466. scipy/io/matlab/tests/data/teststringarray_6.1_SOL2.mat +0 -0
  467. scipy/io/matlab/tests/data/teststringarray_6.5.1_GLNX86.mat +0 -0
  468. scipy/io/matlab/tests/data/teststringarray_7.1_GLNX86.mat +0 -0
  469. scipy/io/matlab/tests/data/teststringarray_7.4_GLNX86.mat +0 -0
  470. scipy/io/matlab/tests/data/teststruct_6.1_SOL2.mat +0 -0
  471. scipy/io/matlab/tests/data/teststruct_6.5.1_GLNX86.mat +0 -0
  472. scipy/io/matlab/tests/data/teststruct_7.1_GLNX86.mat +0 -0
  473. scipy/io/matlab/tests/data/teststruct_7.4_GLNX86.mat +0 -0
  474. scipy/io/matlab/tests/data/teststructarr_6.1_SOL2.mat +0 -0
  475. scipy/io/matlab/tests/data/teststructarr_6.5.1_GLNX86.mat +0 -0
  476. scipy/io/matlab/tests/data/teststructarr_7.1_GLNX86.mat +0 -0
  477. scipy/io/matlab/tests/data/teststructarr_7.4_GLNX86.mat +0 -0
  478. scipy/io/matlab/tests/data/teststructnest_6.1_SOL2.mat +0 -0
  479. scipy/io/matlab/tests/data/teststructnest_6.5.1_GLNX86.mat +0 -0
  480. scipy/io/matlab/tests/data/teststructnest_7.1_GLNX86.mat +0 -0
  481. scipy/io/matlab/tests/data/teststructnest_7.4_GLNX86.mat +0 -0
  482. scipy/io/matlab/tests/data/testunicode_7.1_GLNX86.mat +0 -0
  483. scipy/io/matlab/tests/data/testunicode_7.4_GLNX86.mat +0 -0
  484. scipy/io/matlab/tests/data/testvec_4_GLNX86.mat +0 -0
  485. scipy/io/matlab/tests/test_byteordercodes.py +29 -0
  486. scipy/io/matlab/tests/test_mio.py +1399 -0
  487. scipy/io/matlab/tests/test_mio5_utils.py +179 -0
  488. scipy/io/matlab/tests/test_mio_funcs.py +51 -0
  489. scipy/io/matlab/tests/test_mio_utils.py +45 -0
  490. scipy/io/matlab/tests/test_miobase.py +32 -0
  491. scipy/io/matlab/tests/test_pathological.py +33 -0
  492. scipy/io/matlab/tests/test_streams.py +241 -0
  493. scipy/io/mmio.py +17 -0
  494. scipy/io/netcdf.py +17 -0
  495. scipy/io/tests/__init__.py +0 -0
  496. scipy/io/tests/data/Transparent Busy.ani +0 -0
  497. scipy/io/tests/data/array_float32_1d.sav +0 -0
  498. scipy/io/tests/data/array_float32_2d.sav +0 -0
  499. scipy/io/tests/data/array_float32_3d.sav +0 -0
  500. scipy/io/tests/data/array_float32_4d.sav +0 -0
  501. scipy/io/tests/data/array_float32_5d.sav +0 -0
  502. scipy/io/tests/data/array_float32_6d.sav +0 -0
  503. scipy/io/tests/data/array_float32_7d.sav +0 -0
  504. scipy/io/tests/data/array_float32_8d.sav +0 -0
  505. scipy/io/tests/data/array_float32_pointer_1d.sav +0 -0
  506. scipy/io/tests/data/array_float32_pointer_2d.sav +0 -0
  507. scipy/io/tests/data/array_float32_pointer_3d.sav +0 -0
  508. scipy/io/tests/data/array_float32_pointer_4d.sav +0 -0
  509. scipy/io/tests/data/array_float32_pointer_5d.sav +0 -0
  510. scipy/io/tests/data/array_float32_pointer_6d.sav +0 -0
  511. scipy/io/tests/data/array_float32_pointer_7d.sav +0 -0
  512. scipy/io/tests/data/array_float32_pointer_8d.sav +0 -0
  513. scipy/io/tests/data/example_1.nc +0 -0
  514. scipy/io/tests/data/example_2.nc +0 -0
  515. scipy/io/tests/data/example_3_maskedvals.nc +0 -0
  516. scipy/io/tests/data/fortran-3x3d-2i.dat +0 -0
  517. scipy/io/tests/data/fortran-mixed.dat +0 -0
  518. scipy/io/tests/data/fortran-sf8-11x1x10.dat +0 -0
  519. scipy/io/tests/data/fortran-sf8-15x10x22.dat +0 -0
  520. scipy/io/tests/data/fortran-sf8-1x1x1.dat +0 -0
  521. scipy/io/tests/data/fortran-sf8-1x1x5.dat +0 -0
  522. scipy/io/tests/data/fortran-sf8-1x1x7.dat +0 -0
  523. scipy/io/tests/data/fortran-sf8-1x3x5.dat +0 -0
  524. scipy/io/tests/data/fortran-si4-11x1x10.dat +0 -0
  525. scipy/io/tests/data/fortran-si4-15x10x22.dat +0 -0
  526. scipy/io/tests/data/fortran-si4-1x1x1.dat +0 -0
  527. scipy/io/tests/data/fortran-si4-1x1x5.dat +0 -0
  528. scipy/io/tests/data/fortran-si4-1x1x7.dat +0 -0
  529. scipy/io/tests/data/fortran-si4-1x3x5.dat +0 -0
  530. scipy/io/tests/data/invalid_pointer.sav +0 -0
  531. scipy/io/tests/data/null_pointer.sav +0 -0
  532. scipy/io/tests/data/scalar_byte.sav +0 -0
  533. scipy/io/tests/data/scalar_byte_descr.sav +0 -0
  534. scipy/io/tests/data/scalar_complex32.sav +0 -0
  535. scipy/io/tests/data/scalar_complex64.sav +0 -0
  536. scipy/io/tests/data/scalar_float32.sav +0 -0
  537. scipy/io/tests/data/scalar_float64.sav +0 -0
  538. scipy/io/tests/data/scalar_heap_pointer.sav +0 -0
  539. scipy/io/tests/data/scalar_int16.sav +0 -0
  540. scipy/io/tests/data/scalar_int32.sav +0 -0
  541. scipy/io/tests/data/scalar_int64.sav +0 -0
  542. scipy/io/tests/data/scalar_string.sav +0 -0
  543. scipy/io/tests/data/scalar_uint16.sav +0 -0
  544. scipy/io/tests/data/scalar_uint32.sav +0 -0
  545. scipy/io/tests/data/scalar_uint64.sav +0 -0
  546. scipy/io/tests/data/struct_arrays.sav +0 -0
  547. scipy/io/tests/data/struct_arrays_byte_idl80.sav +0 -0
  548. scipy/io/tests/data/struct_arrays_replicated.sav +0 -0
  549. scipy/io/tests/data/struct_arrays_replicated_3d.sav +0 -0
  550. scipy/io/tests/data/struct_inherit.sav +0 -0
  551. scipy/io/tests/data/struct_pointer_arrays.sav +0 -0
  552. scipy/io/tests/data/struct_pointer_arrays_replicated.sav +0 -0
  553. scipy/io/tests/data/struct_pointer_arrays_replicated_3d.sav +0 -0
  554. scipy/io/tests/data/struct_pointers.sav +0 -0
  555. scipy/io/tests/data/struct_pointers_replicated.sav +0 -0
  556. scipy/io/tests/data/struct_pointers_replicated_3d.sav +0 -0
  557. scipy/io/tests/data/struct_scalars.sav +0 -0
  558. scipy/io/tests/data/struct_scalars_replicated.sav +0 -0
  559. scipy/io/tests/data/struct_scalars_replicated_3d.sav +0 -0
  560. scipy/io/tests/data/test-1234Hz-le-1ch-10S-20bit-extra.wav +0 -0
  561. scipy/io/tests/data/test-44100Hz-2ch-32bit-float-be.wav +0 -0
  562. scipy/io/tests/data/test-44100Hz-2ch-32bit-float-le.wav +0 -0
  563. scipy/io/tests/data/test-44100Hz-be-1ch-4bytes.wav +0 -0
  564. scipy/io/tests/data/test-44100Hz-le-1ch-4bytes-early-eof-no-data.wav +0 -0
  565. scipy/io/tests/data/test-44100Hz-le-1ch-4bytes-early-eof.wav +0 -0
  566. scipy/io/tests/data/test-44100Hz-le-1ch-4bytes-incomplete-chunk.wav +0 -0
  567. scipy/io/tests/data/test-44100Hz-le-1ch-4bytes-rf64.wav +0 -0
  568. scipy/io/tests/data/test-44100Hz-le-1ch-4bytes.wav +0 -0
  569. scipy/io/tests/data/test-48000Hz-2ch-64bit-float-le-wavex.wav +0 -0
  570. scipy/io/tests/data/test-8000Hz-be-3ch-5S-24bit.wav +0 -0
  571. scipy/io/tests/data/test-8000Hz-le-1ch-1byte-ulaw.wav +0 -0
  572. scipy/io/tests/data/test-8000Hz-le-2ch-1byteu.wav +0 -0
  573. scipy/io/tests/data/test-8000Hz-le-3ch-5S-24bit-inconsistent.wav +0 -0
  574. scipy/io/tests/data/test-8000Hz-le-3ch-5S-24bit-rf64.wav +0 -0
  575. scipy/io/tests/data/test-8000Hz-le-3ch-5S-24bit.wav +0 -0
  576. scipy/io/tests/data/test-8000Hz-le-3ch-5S-36bit.wav +0 -0
  577. scipy/io/tests/data/test-8000Hz-le-3ch-5S-45bit.wav +0 -0
  578. scipy/io/tests/data/test-8000Hz-le-3ch-5S-53bit.wav +0 -0
  579. scipy/io/tests/data/test-8000Hz-le-3ch-5S-64bit.wav +0 -0
  580. scipy/io/tests/data/test-8000Hz-le-4ch-9S-12bit.wav +0 -0
  581. scipy/io/tests/data/test-8000Hz-le-5ch-9S-5bit.wav +0 -0
  582. scipy/io/tests/data/various_compressed.sav +0 -0
  583. scipy/io/tests/test_fortran.py +264 -0
  584. scipy/io/tests/test_idl.py +483 -0
  585. scipy/io/tests/test_mmio.py +831 -0
  586. scipy/io/tests/test_netcdf.py +550 -0
  587. scipy/io/tests/test_paths.py +93 -0
  588. scipy/io/tests/test_wavfile.py +501 -0
  589. scipy/io/wavfile.py +938 -0
  590. scipy/linalg/__init__.pxd +1 -0
  591. scipy/linalg/__init__.py +236 -0
  592. scipy/linalg/_basic.py +2146 -0
  593. scipy/linalg/_blas_subroutines.h +164 -0
  594. scipy/linalg/_cythonized_array_utils.cpython-314t-darwin.so +0 -0
  595. scipy/linalg/_cythonized_array_utils.pxd +40 -0
  596. scipy/linalg/_cythonized_array_utils.pyi +16 -0
  597. scipy/linalg/_decomp.py +1645 -0
  598. scipy/linalg/_decomp_cholesky.py +413 -0
  599. scipy/linalg/_decomp_cossin.py +236 -0
  600. scipy/linalg/_decomp_interpolative.cpython-314t-darwin.so +0 -0
  601. scipy/linalg/_decomp_ldl.py +356 -0
  602. scipy/linalg/_decomp_lu.py +401 -0
  603. scipy/linalg/_decomp_lu_cython.cpython-314t-darwin.so +0 -0
  604. scipy/linalg/_decomp_lu_cython.pyi +6 -0
  605. scipy/linalg/_decomp_polar.py +113 -0
  606. scipy/linalg/_decomp_qr.py +494 -0
  607. scipy/linalg/_decomp_qz.py +452 -0
  608. scipy/linalg/_decomp_schur.py +336 -0
  609. scipy/linalg/_decomp_svd.py +545 -0
  610. scipy/linalg/_decomp_update.cpython-314t-darwin.so +0 -0
  611. scipy/linalg/_expm_frechet.py +417 -0
  612. scipy/linalg/_fblas.cpython-314t-darwin.so +0 -0
  613. scipy/linalg/_flapack.cpython-314t-darwin.so +0 -0
  614. scipy/linalg/_lapack_subroutines.h +1521 -0
  615. scipy/linalg/_linalg_pythran.cpython-314t-darwin.so +0 -0
  616. scipy/linalg/_matfuncs.py +1050 -0
  617. scipy/linalg/_matfuncs_expm.cpython-314t-darwin.so +0 -0
  618. scipy/linalg/_matfuncs_expm.pyi +6 -0
  619. scipy/linalg/_matfuncs_inv_ssq.py +886 -0
  620. scipy/linalg/_matfuncs_schur_sqrtm.cpython-314t-darwin.so +0 -0
  621. scipy/linalg/_matfuncs_sqrtm.py +107 -0
  622. scipy/linalg/_matfuncs_sqrtm_triu.cpython-314t-darwin.so +0 -0
  623. scipy/linalg/_misc.py +191 -0
  624. scipy/linalg/_procrustes.py +113 -0
  625. scipy/linalg/_sketches.py +189 -0
  626. scipy/linalg/_solve_toeplitz.cpython-314t-darwin.so +0 -0
  627. scipy/linalg/_solvers.py +862 -0
  628. scipy/linalg/_special_matrices.py +1322 -0
  629. scipy/linalg/_testutils.py +65 -0
  630. scipy/linalg/basic.py +23 -0
  631. scipy/linalg/blas.py +495 -0
  632. scipy/linalg/cython_blas.cpython-314t-darwin.so +0 -0
  633. scipy/linalg/cython_blas.pxd +169 -0
  634. scipy/linalg/cython_blas.pyx +1432 -0
  635. scipy/linalg/cython_lapack.cpython-314t-darwin.so +0 -0
  636. scipy/linalg/cython_lapack.pxd +1528 -0
  637. scipy/linalg/cython_lapack.pyx +12045 -0
  638. scipy/linalg/decomp.py +23 -0
  639. scipy/linalg/decomp_cholesky.py +21 -0
  640. scipy/linalg/decomp_lu.py +21 -0
  641. scipy/linalg/decomp_qr.py +20 -0
  642. scipy/linalg/decomp_schur.py +21 -0
  643. scipy/linalg/decomp_svd.py +21 -0
  644. scipy/linalg/interpolative.py +989 -0
  645. scipy/linalg/lapack.py +1081 -0
  646. scipy/linalg/matfuncs.py +23 -0
  647. scipy/linalg/misc.py +21 -0
  648. scipy/linalg/special_matrices.py +22 -0
  649. scipy/linalg/tests/__init__.py +0 -0
  650. scipy/linalg/tests/_cython_examples/extending.pyx +23 -0
  651. scipy/linalg/tests/_cython_examples/meson.build +34 -0
  652. scipy/linalg/tests/data/carex_15_data.npz +0 -0
  653. scipy/linalg/tests/data/carex_18_data.npz +0 -0
  654. scipy/linalg/tests/data/carex_19_data.npz +0 -0
  655. scipy/linalg/tests/data/carex_20_data.npz +0 -0
  656. scipy/linalg/tests/data/carex_6_data.npz +0 -0
  657. scipy/linalg/tests/data/gendare_20170120_data.npz +0 -0
  658. scipy/linalg/tests/test_basic.py +2074 -0
  659. scipy/linalg/tests/test_batch.py +588 -0
  660. scipy/linalg/tests/test_blas.py +1127 -0
  661. scipy/linalg/tests/test_cython_blas.py +118 -0
  662. scipy/linalg/tests/test_cython_lapack.py +22 -0
  663. scipy/linalg/tests/test_cythonized_array_utils.py +130 -0
  664. scipy/linalg/tests/test_decomp.py +3189 -0
  665. scipy/linalg/tests/test_decomp_cholesky.py +268 -0
  666. scipy/linalg/tests/test_decomp_cossin.py +314 -0
  667. scipy/linalg/tests/test_decomp_ldl.py +137 -0
  668. scipy/linalg/tests/test_decomp_lu.py +308 -0
  669. scipy/linalg/tests/test_decomp_polar.py +110 -0
  670. scipy/linalg/tests/test_decomp_update.py +1701 -0
  671. scipy/linalg/tests/test_extending.py +46 -0
  672. scipy/linalg/tests/test_fblas.py +607 -0
  673. scipy/linalg/tests/test_interpolative.py +232 -0
  674. scipy/linalg/tests/test_lapack.py +3616 -0
  675. scipy/linalg/tests/test_matfuncs.py +1125 -0
  676. scipy/linalg/tests/test_matmul_toeplitz.py +136 -0
  677. scipy/linalg/tests/test_procrustes.py +214 -0
  678. scipy/linalg/tests/test_sketches.py +118 -0
  679. scipy/linalg/tests/test_solve_toeplitz.py +150 -0
  680. scipy/linalg/tests/test_solvers.py +844 -0
  681. scipy/linalg/tests/test_special_matrices.py +636 -0
  682. scipy/misc/__init__.py +6 -0
  683. scipy/misc/common.py +6 -0
  684. scipy/misc/doccer.py +6 -0
  685. scipy/ndimage/__init__.py +174 -0
  686. scipy/ndimage/_ctest.cpython-314t-darwin.so +0 -0
  687. scipy/ndimage/_cytest.cpython-314t-darwin.so +0 -0
  688. scipy/ndimage/_delegators.py +303 -0
  689. scipy/ndimage/_filters.py +2422 -0
  690. scipy/ndimage/_fourier.py +306 -0
  691. scipy/ndimage/_interpolation.py +1033 -0
  692. scipy/ndimage/_measurements.py +1689 -0
  693. scipy/ndimage/_morphology.py +2634 -0
  694. scipy/ndimage/_nd_image.cpython-314t-darwin.so +0 -0
  695. scipy/ndimage/_ndimage_api.py +16 -0
  696. scipy/ndimage/_ni_docstrings.py +214 -0
  697. scipy/ndimage/_ni_label.cpython-314t-darwin.so +0 -0
  698. scipy/ndimage/_ni_support.py +139 -0
  699. scipy/ndimage/_rank_filter_1d.cpython-314t-darwin.so +0 -0
  700. scipy/ndimage/_support_alternative_backends.py +84 -0
  701. scipy/ndimage/filters.py +27 -0
  702. scipy/ndimage/fourier.py +21 -0
  703. scipy/ndimage/interpolation.py +22 -0
  704. scipy/ndimage/measurements.py +24 -0
  705. scipy/ndimage/morphology.py +27 -0
  706. scipy/ndimage/tests/__init__.py +12 -0
  707. scipy/ndimage/tests/data/label_inputs.txt +21 -0
  708. scipy/ndimage/tests/data/label_results.txt +294 -0
  709. scipy/ndimage/tests/data/label_strels.txt +42 -0
  710. scipy/ndimage/tests/dots.png +0 -0
  711. scipy/ndimage/tests/test_c_api.py +102 -0
  712. scipy/ndimage/tests/test_datatypes.py +67 -0
  713. scipy/ndimage/tests/test_filters.py +3083 -0
  714. scipy/ndimage/tests/test_fourier.py +187 -0
  715. scipy/ndimage/tests/test_interpolation.py +1491 -0
  716. scipy/ndimage/tests/test_measurements.py +1592 -0
  717. scipy/ndimage/tests/test_morphology.py +2950 -0
  718. scipy/ndimage/tests/test_ni_support.py +78 -0
  719. scipy/ndimage/tests/test_splines.py +70 -0
  720. scipy/odr/__init__.py +131 -0
  721. scipy/odr/__odrpack.cpython-314t-darwin.so +0 -0
  722. scipy/odr/_add_newdocs.py +34 -0
  723. scipy/odr/_models.py +315 -0
  724. scipy/odr/_odrpack.py +1154 -0
  725. scipy/odr/models.py +20 -0
  726. scipy/odr/odrpack.py +21 -0
  727. scipy/odr/tests/__init__.py +0 -0
  728. scipy/odr/tests/test_odr.py +607 -0
  729. scipy/optimize/__init__.pxd +1 -0
  730. scipy/optimize/__init__.py +460 -0
  731. scipy/optimize/_basinhopping.py +741 -0
  732. scipy/optimize/_bglu_dense.cpython-314t-darwin.so +0 -0
  733. scipy/optimize/_bracket.py +706 -0
  734. scipy/optimize/_chandrupatla.py +551 -0
  735. scipy/optimize/_cobyla_py.py +297 -0
  736. scipy/optimize/_cobyqa_py.py +72 -0
  737. scipy/optimize/_constraints.py +598 -0
  738. scipy/optimize/_dcsrch.py +728 -0
  739. scipy/optimize/_differentiable_functions.py +835 -0
  740. scipy/optimize/_differentialevolution.py +1970 -0
  741. scipy/optimize/_direct.cpython-314t-darwin.so +0 -0
  742. scipy/optimize/_direct_py.py +280 -0
  743. scipy/optimize/_dual_annealing.py +732 -0
  744. scipy/optimize/_elementwise.py +798 -0
  745. scipy/optimize/_group_columns.cpython-314t-darwin.so +0 -0
  746. scipy/optimize/_hessian_update_strategy.py +479 -0
  747. scipy/optimize/_highspy/__init__.py +0 -0
  748. scipy/optimize/_highspy/_core.cpython-314t-darwin.so +0 -0
  749. scipy/optimize/_highspy/_highs_options.cpython-314t-darwin.so +0 -0
  750. scipy/optimize/_highspy/_highs_wrapper.py +338 -0
  751. scipy/optimize/_isotonic.py +157 -0
  752. scipy/optimize/_lbfgsb.cpython-314t-darwin.so +0 -0
  753. scipy/optimize/_lbfgsb_py.py +634 -0
  754. scipy/optimize/_linesearch.py +896 -0
  755. scipy/optimize/_linprog.py +733 -0
  756. scipy/optimize/_linprog_doc.py +1434 -0
  757. scipy/optimize/_linprog_highs.py +422 -0
  758. scipy/optimize/_linprog_ip.py +1141 -0
  759. scipy/optimize/_linprog_rs.py +572 -0
  760. scipy/optimize/_linprog_simplex.py +663 -0
  761. scipy/optimize/_linprog_util.py +1521 -0
  762. scipy/optimize/_lsap.cpython-314t-darwin.so +0 -0
  763. scipy/optimize/_lsq/__init__.py +5 -0
  764. scipy/optimize/_lsq/bvls.py +183 -0
  765. scipy/optimize/_lsq/common.py +731 -0
  766. scipy/optimize/_lsq/dogbox.py +345 -0
  767. scipy/optimize/_lsq/givens_elimination.cpython-314t-darwin.so +0 -0
  768. scipy/optimize/_lsq/least_squares.py +1044 -0
  769. scipy/optimize/_lsq/lsq_linear.py +361 -0
  770. scipy/optimize/_lsq/trf.py +587 -0
  771. scipy/optimize/_lsq/trf_linear.py +249 -0
  772. scipy/optimize/_milp.py +394 -0
  773. scipy/optimize/_minimize.py +1199 -0
  774. scipy/optimize/_minpack.cpython-314t-darwin.so +0 -0
  775. scipy/optimize/_minpack_py.py +1178 -0
  776. scipy/optimize/_moduleTNC.cpython-314t-darwin.so +0 -0
  777. scipy/optimize/_nnls.py +96 -0
  778. scipy/optimize/_nonlin.py +1634 -0
  779. scipy/optimize/_numdiff.py +963 -0
  780. scipy/optimize/_optimize.py +4169 -0
  781. scipy/optimize/_pava_pybind.cpython-314t-darwin.so +0 -0
  782. scipy/optimize/_qap.py +760 -0
  783. scipy/optimize/_remove_redundancy.py +522 -0
  784. scipy/optimize/_root.py +732 -0
  785. scipy/optimize/_root_scalar.py +538 -0
  786. scipy/optimize/_shgo.py +1606 -0
  787. scipy/optimize/_shgo_lib/__init__.py +0 -0
  788. scipy/optimize/_shgo_lib/_complex.py +1225 -0
  789. scipy/optimize/_shgo_lib/_vertex.py +460 -0
  790. scipy/optimize/_slsqp_py.py +603 -0
  791. scipy/optimize/_slsqplib.cpython-314t-darwin.so +0 -0
  792. scipy/optimize/_spectral.py +260 -0
  793. scipy/optimize/_tnc.py +438 -0
  794. scipy/optimize/_trlib/__init__.py +12 -0
  795. scipy/optimize/_trlib/_trlib.cpython-314t-darwin.so +0 -0
  796. scipy/optimize/_trustregion.py +318 -0
  797. scipy/optimize/_trustregion_constr/__init__.py +6 -0
  798. scipy/optimize/_trustregion_constr/canonical_constraint.py +390 -0
  799. scipy/optimize/_trustregion_constr/equality_constrained_sqp.py +231 -0
  800. scipy/optimize/_trustregion_constr/minimize_trustregion_constr.py +584 -0
  801. scipy/optimize/_trustregion_constr/projections.py +411 -0
  802. scipy/optimize/_trustregion_constr/qp_subproblem.py +637 -0
  803. scipy/optimize/_trustregion_constr/report.py +49 -0
  804. scipy/optimize/_trustregion_constr/tests/__init__.py +0 -0
  805. scipy/optimize/_trustregion_constr/tests/test_canonical_constraint.py +296 -0
  806. scipy/optimize/_trustregion_constr/tests/test_nested_minimize.py +39 -0
  807. scipy/optimize/_trustregion_constr/tests/test_projections.py +214 -0
  808. scipy/optimize/_trustregion_constr/tests/test_qp_subproblem.py +645 -0
  809. scipy/optimize/_trustregion_constr/tests/test_report.py +34 -0
  810. scipy/optimize/_trustregion_constr/tr_interior_point.py +361 -0
  811. scipy/optimize/_trustregion_dogleg.py +122 -0
  812. scipy/optimize/_trustregion_exact.py +437 -0
  813. scipy/optimize/_trustregion_krylov.py +65 -0
  814. scipy/optimize/_trustregion_ncg.py +126 -0
  815. scipy/optimize/_tstutils.py +972 -0
  816. scipy/optimize/_zeros.cpython-314t-darwin.so +0 -0
  817. scipy/optimize/_zeros_py.py +1475 -0
  818. scipy/optimize/cobyla.py +19 -0
  819. scipy/optimize/cython_optimize/__init__.py +133 -0
  820. scipy/optimize/cython_optimize/_zeros.cpython-314t-darwin.so +0 -0
  821. scipy/optimize/cython_optimize/_zeros.pxd +33 -0
  822. scipy/optimize/cython_optimize/c_zeros.pxd +26 -0
  823. scipy/optimize/cython_optimize.pxd +11 -0
  824. scipy/optimize/elementwise.py +38 -0
  825. scipy/optimize/lbfgsb.py +23 -0
  826. scipy/optimize/linesearch.py +18 -0
  827. scipy/optimize/minpack.py +27 -0
  828. scipy/optimize/minpack2.py +17 -0
  829. scipy/optimize/moduleTNC.py +19 -0
  830. scipy/optimize/nonlin.py +29 -0
  831. scipy/optimize/optimize.py +40 -0
  832. scipy/optimize/slsqp.py +22 -0
  833. scipy/optimize/tests/__init__.py +0 -0
  834. scipy/optimize/tests/_cython_examples/extending.pyx +43 -0
  835. scipy/optimize/tests/_cython_examples/meson.build +32 -0
  836. scipy/optimize/tests/test__basinhopping.py +535 -0
  837. scipy/optimize/tests/test__differential_evolution.py +1703 -0
  838. scipy/optimize/tests/test__dual_annealing.py +416 -0
  839. scipy/optimize/tests/test__linprog_clean_inputs.py +312 -0
  840. scipy/optimize/tests/test__numdiff.py +885 -0
  841. scipy/optimize/tests/test__remove_redundancy.py +228 -0
  842. scipy/optimize/tests/test__root.py +124 -0
  843. scipy/optimize/tests/test__shgo.py +1164 -0
  844. scipy/optimize/tests/test__spectral.py +226 -0
  845. scipy/optimize/tests/test_bracket.py +896 -0
  846. scipy/optimize/tests/test_chandrupatla.py +982 -0
  847. scipy/optimize/tests/test_cobyla.py +195 -0
  848. scipy/optimize/tests/test_cobyqa.py +252 -0
  849. scipy/optimize/tests/test_constraint_conversion.py +286 -0
  850. scipy/optimize/tests/test_constraints.py +255 -0
  851. scipy/optimize/tests/test_cython_optimize.py +92 -0
  852. scipy/optimize/tests/test_differentiable_functions.py +1025 -0
  853. scipy/optimize/tests/test_direct.py +321 -0
  854. scipy/optimize/tests/test_extending.py +28 -0
  855. scipy/optimize/tests/test_hessian_update_strategy.py +300 -0
  856. scipy/optimize/tests/test_isotonic_regression.py +167 -0
  857. scipy/optimize/tests/test_lbfgsb_hessinv.py +65 -0
  858. scipy/optimize/tests/test_lbfgsb_setulb.py +122 -0
  859. scipy/optimize/tests/test_least_squares.py +986 -0
  860. scipy/optimize/tests/test_linear_assignment.py +116 -0
  861. scipy/optimize/tests/test_linesearch.py +328 -0
  862. scipy/optimize/tests/test_linprog.py +2577 -0
  863. scipy/optimize/tests/test_lsq_common.py +297 -0
  864. scipy/optimize/tests/test_lsq_linear.py +287 -0
  865. scipy/optimize/tests/test_milp.py +459 -0
  866. scipy/optimize/tests/test_minimize_constrained.py +845 -0
  867. scipy/optimize/tests/test_minpack.py +1194 -0
  868. scipy/optimize/tests/test_nnls.py +469 -0
  869. scipy/optimize/tests/test_nonlin.py +572 -0
  870. scipy/optimize/tests/test_optimize.py +3335 -0
  871. scipy/optimize/tests/test_quadratic_assignment.py +455 -0
  872. scipy/optimize/tests/test_regression.py +40 -0
  873. scipy/optimize/tests/test_slsqp.py +645 -0
  874. scipy/optimize/tests/test_tnc.py +345 -0
  875. scipy/optimize/tests/test_trustregion.py +110 -0
  876. scipy/optimize/tests/test_trustregion_exact.py +351 -0
  877. scipy/optimize/tests/test_trustregion_krylov.py +170 -0
  878. scipy/optimize/tests/test_zeros.py +998 -0
  879. scipy/optimize/tnc.py +22 -0
  880. scipy/optimize/zeros.py +26 -0
  881. scipy/signal/__init__.py +316 -0
  882. scipy/signal/_arraytools.py +264 -0
  883. scipy/signal/_czt.py +575 -0
  884. scipy/signal/_delegators.py +568 -0
  885. scipy/signal/_filter_design.py +5893 -0
  886. scipy/signal/_fir_filter_design.py +1458 -0
  887. scipy/signal/_lti_conversion.py +534 -0
  888. scipy/signal/_ltisys.py +3546 -0
  889. scipy/signal/_max_len_seq.py +139 -0
  890. scipy/signal/_max_len_seq_inner.cpython-314t-darwin.so +0 -0
  891. scipy/signal/_peak_finding.py +1310 -0
  892. scipy/signal/_peak_finding_utils.cpython-314t-darwin.so +0 -0
  893. scipy/signal/_polyutils.py +172 -0
  894. scipy/signal/_savitzky_golay.py +357 -0
  895. scipy/signal/_short_time_fft.py +2187 -0
  896. scipy/signal/_signal_api.py +30 -0
  897. scipy/signal/_signaltools.py +5309 -0
  898. scipy/signal/_sigtools.cpython-314t-darwin.so +0 -0
  899. scipy/signal/_sosfilt.cpython-314t-darwin.so +0 -0
  900. scipy/signal/_spectral_py.py +2471 -0
  901. scipy/signal/_spline.cpython-314t-darwin.so +0 -0
  902. scipy/signal/_spline.pyi +34 -0
  903. scipy/signal/_spline_filters.py +848 -0
  904. scipy/signal/_support_alternative_backends.py +73 -0
  905. scipy/signal/_upfirdn.py +219 -0
  906. scipy/signal/_upfirdn_apply.cpython-314t-darwin.so +0 -0
  907. scipy/signal/_waveforms.py +687 -0
  908. scipy/signal/_wavelets.py +29 -0
  909. scipy/signal/bsplines.py +21 -0
  910. scipy/signal/filter_design.py +28 -0
  911. scipy/signal/fir_filter_design.py +21 -0
  912. scipy/signal/lti_conversion.py +20 -0
  913. scipy/signal/ltisys.py +25 -0
  914. scipy/signal/signaltools.py +27 -0
  915. scipy/signal/spectral.py +21 -0
  916. scipy/signal/spline.py +18 -0
  917. scipy/signal/tests/__init__.py +0 -0
  918. scipy/signal/tests/_scipy_spectral_test_shim.py +311 -0
  919. scipy/signal/tests/mpsig.py +122 -0
  920. scipy/signal/tests/test_array_tools.py +111 -0
  921. scipy/signal/tests/test_bsplines.py +365 -0
  922. scipy/signal/tests/test_cont2discrete.py +424 -0
  923. scipy/signal/tests/test_czt.py +221 -0
  924. scipy/signal/tests/test_dltisys.py +599 -0
  925. scipy/signal/tests/test_filter_design.py +4744 -0
  926. scipy/signal/tests/test_fir_filter_design.py +851 -0
  927. scipy/signal/tests/test_ltisys.py +1225 -0
  928. scipy/signal/tests/test_max_len_seq.py +71 -0
  929. scipy/signal/tests/test_peak_finding.py +915 -0
  930. scipy/signal/tests/test_result_type.py +51 -0
  931. scipy/signal/tests/test_savitzky_golay.py +363 -0
  932. scipy/signal/tests/test_short_time_fft.py +1098 -0
  933. scipy/signal/tests/test_signaltools.py +4729 -0
  934. scipy/signal/tests/test_spectral.py +2103 -0
  935. scipy/signal/tests/test_splines.py +427 -0
  936. scipy/signal/tests/test_upfirdn.py +322 -0
  937. scipy/signal/tests/test_waveforms.py +400 -0
  938. scipy/signal/tests/test_wavelets.py +59 -0
  939. scipy/signal/tests/test_windows.py +987 -0
  940. scipy/signal/waveforms.py +20 -0
  941. scipy/signal/wavelets.py +17 -0
  942. scipy/signal/windows/__init__.py +52 -0
  943. scipy/signal/windows/_windows.py +2513 -0
  944. scipy/signal/windows/windows.py +23 -0
  945. scipy/sparse/__init__.py +350 -0
  946. scipy/sparse/_base.py +1613 -0
  947. scipy/sparse/_bsr.py +880 -0
  948. scipy/sparse/_compressed.py +1328 -0
  949. scipy/sparse/_construct.py +1454 -0
  950. scipy/sparse/_coo.py +1581 -0
  951. scipy/sparse/_csc.py +367 -0
  952. scipy/sparse/_csparsetools.cpython-314t-darwin.so +0 -0
  953. scipy/sparse/_csr.py +558 -0
  954. scipy/sparse/_data.py +569 -0
  955. scipy/sparse/_dia.py +677 -0
  956. scipy/sparse/_dok.py +669 -0
  957. scipy/sparse/_extract.py +178 -0
  958. scipy/sparse/_index.py +444 -0
  959. scipy/sparse/_lil.py +632 -0
  960. scipy/sparse/_matrix.py +169 -0
  961. scipy/sparse/_matrix_io.py +167 -0
  962. scipy/sparse/_sparsetools.cpython-314t-darwin.so +0 -0
  963. scipy/sparse/_spfuncs.py +76 -0
  964. scipy/sparse/_sputils.py +632 -0
  965. scipy/sparse/base.py +24 -0
  966. scipy/sparse/bsr.py +22 -0
  967. scipy/sparse/compressed.py +20 -0
  968. scipy/sparse/construct.py +38 -0
  969. scipy/sparse/coo.py +23 -0
  970. scipy/sparse/csc.py +22 -0
  971. scipy/sparse/csgraph/__init__.py +210 -0
  972. scipy/sparse/csgraph/_flow.cpython-314t-darwin.so +0 -0
  973. scipy/sparse/csgraph/_laplacian.py +563 -0
  974. scipy/sparse/csgraph/_matching.cpython-314t-darwin.so +0 -0
  975. scipy/sparse/csgraph/_min_spanning_tree.cpython-314t-darwin.so +0 -0
  976. scipy/sparse/csgraph/_reordering.cpython-314t-darwin.so +0 -0
  977. scipy/sparse/csgraph/_shortest_path.cpython-314t-darwin.so +0 -0
  978. scipy/sparse/csgraph/_tools.cpython-314t-darwin.so +0 -0
  979. scipy/sparse/csgraph/_traversal.cpython-314t-darwin.so +0 -0
  980. scipy/sparse/csgraph/_validation.py +66 -0
  981. scipy/sparse/csgraph/tests/__init__.py +0 -0
  982. scipy/sparse/csgraph/tests/test_connected_components.py +119 -0
  983. scipy/sparse/csgraph/tests/test_conversions.py +61 -0
  984. scipy/sparse/csgraph/tests/test_flow.py +209 -0
  985. scipy/sparse/csgraph/tests/test_graph_laplacian.py +368 -0
  986. scipy/sparse/csgraph/tests/test_matching.py +307 -0
  987. scipy/sparse/csgraph/tests/test_pydata_sparse.py +197 -0
  988. scipy/sparse/csgraph/tests/test_reordering.py +70 -0
  989. scipy/sparse/csgraph/tests/test_shortest_path.py +540 -0
  990. scipy/sparse/csgraph/tests/test_spanning_tree.py +66 -0
  991. scipy/sparse/csgraph/tests/test_traversal.py +148 -0
  992. scipy/sparse/csr.py +22 -0
  993. scipy/sparse/data.py +18 -0
  994. scipy/sparse/dia.py +22 -0
  995. scipy/sparse/dok.py +22 -0
  996. scipy/sparse/extract.py +23 -0
  997. scipy/sparse/lil.py +22 -0
  998. scipy/sparse/linalg/__init__.py +148 -0
  999. scipy/sparse/linalg/_dsolve/__init__.py +71 -0
  1000. scipy/sparse/linalg/_dsolve/_add_newdocs.py +147 -0
  1001. scipy/sparse/linalg/_dsolve/_superlu.cpython-314t-darwin.so +0 -0
  1002. scipy/sparse/linalg/_dsolve/linsolve.py +882 -0
  1003. scipy/sparse/linalg/_dsolve/tests/__init__.py +0 -0
  1004. scipy/sparse/linalg/_dsolve/tests/test_linsolve.py +928 -0
  1005. scipy/sparse/linalg/_eigen/__init__.py +22 -0
  1006. scipy/sparse/linalg/_eigen/_svds.py +540 -0
  1007. scipy/sparse/linalg/_eigen/_svds_doc.py +382 -0
  1008. scipy/sparse/linalg/_eigen/arpack/COPYING +45 -0
  1009. scipy/sparse/linalg/_eigen/arpack/__init__.py +20 -0
  1010. scipy/sparse/linalg/_eigen/arpack/_arpack.cpython-314t-darwin.so +0 -0
  1011. scipy/sparse/linalg/_eigen/arpack/arpack.py +1706 -0
  1012. scipy/sparse/linalg/_eigen/arpack/tests/__init__.py +0 -0
  1013. scipy/sparse/linalg/_eigen/arpack/tests/test_arpack.py +717 -0
  1014. scipy/sparse/linalg/_eigen/lobpcg/__init__.py +16 -0
  1015. scipy/sparse/linalg/_eigen/lobpcg/lobpcg.py +1110 -0
  1016. scipy/sparse/linalg/_eigen/lobpcg/tests/__init__.py +0 -0
  1017. scipy/sparse/linalg/_eigen/lobpcg/tests/test_lobpcg.py +725 -0
  1018. scipy/sparse/linalg/_eigen/tests/__init__.py +0 -0
  1019. scipy/sparse/linalg/_eigen/tests/test_svds.py +886 -0
  1020. scipy/sparse/linalg/_expm_multiply.py +816 -0
  1021. scipy/sparse/linalg/_interface.py +920 -0
  1022. scipy/sparse/linalg/_isolve/__init__.py +20 -0
  1023. scipy/sparse/linalg/_isolve/_gcrotmk.py +503 -0
  1024. scipy/sparse/linalg/_isolve/iterative.py +1051 -0
  1025. scipy/sparse/linalg/_isolve/lgmres.py +230 -0
  1026. scipy/sparse/linalg/_isolve/lsmr.py +486 -0
  1027. scipy/sparse/linalg/_isolve/lsqr.py +589 -0
  1028. scipy/sparse/linalg/_isolve/minres.py +372 -0
  1029. scipy/sparse/linalg/_isolve/tests/__init__.py +0 -0
  1030. scipy/sparse/linalg/_isolve/tests/test_gcrotmk.py +183 -0
  1031. scipy/sparse/linalg/_isolve/tests/test_iterative.py +809 -0
  1032. scipy/sparse/linalg/_isolve/tests/test_lgmres.py +225 -0
  1033. scipy/sparse/linalg/_isolve/tests/test_lsmr.py +185 -0
  1034. scipy/sparse/linalg/_isolve/tests/test_lsqr.py +120 -0
  1035. scipy/sparse/linalg/_isolve/tests/test_minres.py +97 -0
  1036. scipy/sparse/linalg/_isolve/tests/test_utils.py +9 -0
  1037. scipy/sparse/linalg/_isolve/tfqmr.py +179 -0
  1038. scipy/sparse/linalg/_isolve/utils.py +121 -0
  1039. scipy/sparse/linalg/_matfuncs.py +940 -0
  1040. scipy/sparse/linalg/_norm.py +195 -0
  1041. scipy/sparse/linalg/_onenormest.py +467 -0
  1042. scipy/sparse/linalg/_propack/_cpropack.cpython-314t-darwin.so +0 -0
  1043. scipy/sparse/linalg/_propack/_dpropack.cpython-314t-darwin.so +0 -0
  1044. scipy/sparse/linalg/_propack/_spropack.cpython-314t-darwin.so +0 -0
  1045. scipy/sparse/linalg/_propack/_zpropack.cpython-314t-darwin.so +0 -0
  1046. scipy/sparse/linalg/_special_sparse_arrays.py +949 -0
  1047. scipy/sparse/linalg/_svdp.py +309 -0
  1048. scipy/sparse/linalg/dsolve.py +22 -0
  1049. scipy/sparse/linalg/eigen.py +21 -0
  1050. scipy/sparse/linalg/interface.py +20 -0
  1051. scipy/sparse/linalg/isolve.py +22 -0
  1052. scipy/sparse/linalg/matfuncs.py +18 -0
  1053. scipy/sparse/linalg/tests/__init__.py +0 -0
  1054. scipy/sparse/linalg/tests/propack_test_data.npz +0 -0
  1055. scipy/sparse/linalg/tests/test_expm_multiply.py +367 -0
  1056. scipy/sparse/linalg/tests/test_interface.py +561 -0
  1057. scipy/sparse/linalg/tests/test_matfuncs.py +592 -0
  1058. scipy/sparse/linalg/tests/test_norm.py +154 -0
  1059. scipy/sparse/linalg/tests/test_onenormest.py +252 -0
  1060. scipy/sparse/linalg/tests/test_propack.py +165 -0
  1061. scipy/sparse/linalg/tests/test_pydata_sparse.py +272 -0
  1062. scipy/sparse/linalg/tests/test_special_sparse_arrays.py +337 -0
  1063. scipy/sparse/sparsetools.py +17 -0
  1064. scipy/sparse/spfuncs.py +17 -0
  1065. scipy/sparse/sputils.py +17 -0
  1066. scipy/sparse/tests/__init__.py +0 -0
  1067. scipy/sparse/tests/data/csc_py2.npz +0 -0
  1068. scipy/sparse/tests/data/csc_py3.npz +0 -0
  1069. scipy/sparse/tests/test_arithmetic1d.py +341 -0
  1070. scipy/sparse/tests/test_array_api.py +561 -0
  1071. scipy/sparse/tests/test_base.py +5870 -0
  1072. scipy/sparse/tests/test_common1d.py +447 -0
  1073. scipy/sparse/tests/test_construct.py +872 -0
  1074. scipy/sparse/tests/test_coo.py +1119 -0
  1075. scipy/sparse/tests/test_csc.py +98 -0
  1076. scipy/sparse/tests/test_csr.py +214 -0
  1077. scipy/sparse/tests/test_dok.py +209 -0
  1078. scipy/sparse/tests/test_extract.py +51 -0
  1079. scipy/sparse/tests/test_indexing1d.py +603 -0
  1080. scipy/sparse/tests/test_matrix_io.py +109 -0
  1081. scipy/sparse/tests/test_minmax1d.py +128 -0
  1082. scipy/sparse/tests/test_sparsetools.py +344 -0
  1083. scipy/sparse/tests/test_spfuncs.py +97 -0
  1084. scipy/sparse/tests/test_sputils.py +424 -0
  1085. scipy/spatial/__init__.py +129 -0
  1086. scipy/spatial/_ckdtree.cpython-314t-darwin.so +0 -0
  1087. scipy/spatial/_distance_pybind.cpython-314t-darwin.so +0 -0
  1088. scipy/spatial/_distance_wrap.cpython-314t-darwin.so +0 -0
  1089. scipy/spatial/_geometric_slerp.py +238 -0
  1090. scipy/spatial/_hausdorff.cpython-314t-darwin.so +0 -0
  1091. scipy/spatial/_kdtree.py +920 -0
  1092. scipy/spatial/_plotutils.py +274 -0
  1093. scipy/spatial/_procrustes.py +132 -0
  1094. scipy/spatial/_qhull.cpython-314t-darwin.so +0 -0
  1095. scipy/spatial/_qhull.pyi +213 -0
  1096. scipy/spatial/_spherical_voronoi.py +341 -0
  1097. scipy/spatial/_voronoi.cpython-314t-darwin.so +0 -0
  1098. scipy/spatial/_voronoi.pyi +4 -0
  1099. scipy/spatial/ckdtree.py +18 -0
  1100. scipy/spatial/distance.py +3147 -0
  1101. scipy/spatial/distance.pyi +210 -0
  1102. scipy/spatial/kdtree.py +25 -0
  1103. scipy/spatial/qhull.py +25 -0
  1104. scipy/spatial/tests/__init__.py +0 -0
  1105. scipy/spatial/tests/data/cdist-X1.txt +10 -0
  1106. scipy/spatial/tests/data/cdist-X2.txt +20 -0
  1107. scipy/spatial/tests/data/degenerate_pointset.npz +0 -0
  1108. scipy/spatial/tests/data/iris.txt +150 -0
  1109. scipy/spatial/tests/data/pdist-boolean-inp.txt +20 -0
  1110. scipy/spatial/tests/data/pdist-chebyshev-ml-iris.txt +1 -0
  1111. scipy/spatial/tests/data/pdist-chebyshev-ml.txt +1 -0
  1112. scipy/spatial/tests/data/pdist-cityblock-ml-iris.txt +1 -0
  1113. scipy/spatial/tests/data/pdist-cityblock-ml.txt +1 -0
  1114. scipy/spatial/tests/data/pdist-correlation-ml-iris.txt +1 -0
  1115. scipy/spatial/tests/data/pdist-correlation-ml.txt +1 -0
  1116. scipy/spatial/tests/data/pdist-cosine-ml-iris.txt +1 -0
  1117. scipy/spatial/tests/data/pdist-cosine-ml.txt +1 -0
  1118. scipy/spatial/tests/data/pdist-double-inp.txt +20 -0
  1119. scipy/spatial/tests/data/pdist-euclidean-ml-iris.txt +1 -0
  1120. scipy/spatial/tests/data/pdist-euclidean-ml.txt +1 -0
  1121. scipy/spatial/tests/data/pdist-hamming-ml.txt +1 -0
  1122. scipy/spatial/tests/data/pdist-jaccard-ml.txt +1 -0
  1123. scipy/spatial/tests/data/pdist-jensenshannon-ml-iris.txt +1 -0
  1124. scipy/spatial/tests/data/pdist-jensenshannon-ml.txt +1 -0
  1125. scipy/spatial/tests/data/pdist-minkowski-3.2-ml-iris.txt +1 -0
  1126. scipy/spatial/tests/data/pdist-minkowski-3.2-ml.txt +1 -0
  1127. scipy/spatial/tests/data/pdist-minkowski-5.8-ml-iris.txt +1 -0
  1128. scipy/spatial/tests/data/pdist-seuclidean-ml-iris.txt +1 -0
  1129. scipy/spatial/tests/data/pdist-seuclidean-ml.txt +1 -0
  1130. scipy/spatial/tests/data/pdist-spearman-ml.txt +1 -0
  1131. scipy/spatial/tests/data/random-bool-data.txt +100 -0
  1132. scipy/spatial/tests/data/random-double-data.txt +100 -0
  1133. scipy/spatial/tests/data/random-int-data.txt +100 -0
  1134. scipy/spatial/tests/data/random-uint-data.txt +100 -0
  1135. scipy/spatial/tests/data/selfdual-4d-polytope.txt +27 -0
  1136. scipy/spatial/tests/test__plotutils.py +91 -0
  1137. scipy/spatial/tests/test__procrustes.py +116 -0
  1138. scipy/spatial/tests/test_distance.py +2388 -0
  1139. scipy/spatial/tests/test_hausdorff.py +199 -0
  1140. scipy/spatial/tests/test_kdtree.py +1536 -0
  1141. scipy/spatial/tests/test_qhull.py +1313 -0
  1142. scipy/spatial/tests/test_slerp.py +417 -0
  1143. scipy/spatial/tests/test_spherical_voronoi.py +358 -0
  1144. scipy/spatial/transform/__init__.py +31 -0
  1145. scipy/spatial/transform/_rigid_transform.cpython-314t-darwin.so +0 -0
  1146. scipy/spatial/transform/_rotation.cpython-314t-darwin.so +0 -0
  1147. scipy/spatial/transform/_rotation_groups.py +140 -0
  1148. scipy/spatial/transform/_rotation_spline.py +460 -0
  1149. scipy/spatial/transform/rotation.py +21 -0
  1150. scipy/spatial/transform/tests/__init__.py +0 -0
  1151. scipy/spatial/transform/tests/test_rigid_transform.py +1221 -0
  1152. scipy/spatial/transform/tests/test_rotation.py +2569 -0
  1153. scipy/spatial/transform/tests/test_rotation_groups.py +169 -0
  1154. scipy/spatial/transform/tests/test_rotation_spline.py +183 -0
  1155. scipy/special/__init__.pxd +1 -0
  1156. scipy/special/__init__.py +841 -0
  1157. scipy/special/_add_newdocs.py +9961 -0
  1158. scipy/special/_basic.py +3576 -0
  1159. scipy/special/_comb.cpython-314t-darwin.so +0 -0
  1160. scipy/special/_ellip_harm.py +214 -0
  1161. scipy/special/_ellip_harm_2.cpython-314t-darwin.so +0 -0
  1162. scipy/special/_gufuncs.cpython-314t-darwin.so +0 -0
  1163. scipy/special/_input_validation.py +17 -0
  1164. scipy/special/_lambertw.py +149 -0
  1165. scipy/special/_logsumexp.py +426 -0
  1166. scipy/special/_mptestutils.py +453 -0
  1167. scipy/special/_multiufuncs.py +610 -0
  1168. scipy/special/_orthogonal.py +2592 -0
  1169. scipy/special/_orthogonal.pyi +330 -0
  1170. scipy/special/_precompute/__init__.py +0 -0
  1171. scipy/special/_precompute/cosine_cdf.py +17 -0
  1172. scipy/special/_precompute/expn_asy.py +54 -0
  1173. scipy/special/_precompute/gammainc_asy.py +116 -0
  1174. scipy/special/_precompute/gammainc_data.py +124 -0
  1175. scipy/special/_precompute/hyp2f1_data.py +484 -0
  1176. scipy/special/_precompute/lambertw.py +68 -0
  1177. scipy/special/_precompute/loggamma.py +43 -0
  1178. scipy/special/_precompute/struve_convergence.py +131 -0
  1179. scipy/special/_precompute/utils.py +38 -0
  1180. scipy/special/_precompute/wright_bessel.py +342 -0
  1181. scipy/special/_precompute/wright_bessel_data.py +152 -0
  1182. scipy/special/_precompute/wrightomega.py +41 -0
  1183. scipy/special/_precompute/zetac.py +27 -0
  1184. scipy/special/_sf_error.py +15 -0
  1185. scipy/special/_specfun.cpython-314t-darwin.so +0 -0
  1186. scipy/special/_special_ufuncs.cpython-314t-darwin.so +0 -0
  1187. scipy/special/_spfun_stats.py +106 -0
  1188. scipy/special/_spherical_bessel.py +397 -0
  1189. scipy/special/_support_alternative_backends.py +295 -0
  1190. scipy/special/_test_internal.cpython-314t-darwin.so +0 -0
  1191. scipy/special/_test_internal.pyi +9 -0
  1192. scipy/special/_testutils.py +321 -0
  1193. scipy/special/_ufuncs.cpython-314t-darwin.so +0 -0
  1194. scipy/special/_ufuncs.pyi +522 -0
  1195. scipy/special/_ufuncs.pyx +13173 -0
  1196. scipy/special/_ufuncs_cxx.cpython-314t-darwin.so +0 -0
  1197. scipy/special/_ufuncs_cxx.pxd +142 -0
  1198. scipy/special/_ufuncs_cxx.pyx +427 -0
  1199. scipy/special/_ufuncs_cxx_defs.h +147 -0
  1200. scipy/special/_ufuncs_defs.h +57 -0
  1201. scipy/special/add_newdocs.py +15 -0
  1202. scipy/special/basic.py +87 -0
  1203. scipy/special/cython_special.cpython-314t-darwin.so +0 -0
  1204. scipy/special/cython_special.pxd +259 -0
  1205. scipy/special/cython_special.pyi +3 -0
  1206. scipy/special/orthogonal.py +45 -0
  1207. scipy/special/sf_error.py +20 -0
  1208. scipy/special/specfun.py +24 -0
  1209. scipy/special/spfun_stats.py +17 -0
  1210. scipy/special/tests/__init__.py +0 -0
  1211. scipy/special/tests/_cython_examples/extending.pyx +12 -0
  1212. scipy/special/tests/_cython_examples/meson.build +34 -0
  1213. scipy/special/tests/data/__init__.py +0 -0
  1214. scipy/special/tests/data/boost.npz +0 -0
  1215. scipy/special/tests/data/gsl.npz +0 -0
  1216. scipy/special/tests/data/local.npz +0 -0
  1217. scipy/special/tests/test_basic.py +4815 -0
  1218. scipy/special/tests/test_bdtr.py +112 -0
  1219. scipy/special/tests/test_boost_ufuncs.py +64 -0
  1220. scipy/special/tests/test_boxcox.py +125 -0
  1221. scipy/special/tests/test_cdflib.py +712 -0
  1222. scipy/special/tests/test_cdft_asymptotic.py +49 -0
  1223. scipy/special/tests/test_cephes_intp_cast.py +29 -0
  1224. scipy/special/tests/test_cosine_distr.py +83 -0
  1225. scipy/special/tests/test_cython_special.py +363 -0
  1226. scipy/special/tests/test_data.py +719 -0
  1227. scipy/special/tests/test_dd.py +42 -0
  1228. scipy/special/tests/test_digamma.py +45 -0
  1229. scipy/special/tests/test_ellip_harm.py +278 -0
  1230. scipy/special/tests/test_erfinv.py +89 -0
  1231. scipy/special/tests/test_exponential_integrals.py +118 -0
  1232. scipy/special/tests/test_extending.py +28 -0
  1233. scipy/special/tests/test_faddeeva.py +85 -0
  1234. scipy/special/tests/test_gamma.py +12 -0
  1235. scipy/special/tests/test_gammainc.py +152 -0
  1236. scipy/special/tests/test_hyp2f1.py +2566 -0
  1237. scipy/special/tests/test_hypergeometric.py +234 -0
  1238. scipy/special/tests/test_iv_ratio.py +249 -0
  1239. scipy/special/tests/test_kolmogorov.py +491 -0
  1240. scipy/special/tests/test_lambertw.py +109 -0
  1241. scipy/special/tests/test_legendre.py +1518 -0
  1242. scipy/special/tests/test_log1mexp.py +85 -0
  1243. scipy/special/tests/test_loggamma.py +70 -0
  1244. scipy/special/tests/test_logit.py +162 -0
  1245. scipy/special/tests/test_logsumexp.py +469 -0
  1246. scipy/special/tests/test_mpmath.py +2293 -0
  1247. scipy/special/tests/test_nan_inputs.py +65 -0
  1248. scipy/special/tests/test_ndtr.py +77 -0
  1249. scipy/special/tests/test_ndtri_exp.py +94 -0
  1250. scipy/special/tests/test_orthogonal.py +821 -0
  1251. scipy/special/tests/test_orthogonal_eval.py +275 -0
  1252. scipy/special/tests/test_owens_t.py +53 -0
  1253. scipy/special/tests/test_pcf.py +24 -0
  1254. scipy/special/tests/test_pdtr.py +48 -0
  1255. scipy/special/tests/test_powm1.py +65 -0
  1256. scipy/special/tests/test_precompute_expn_asy.py +24 -0
  1257. scipy/special/tests/test_precompute_gammainc.py +108 -0
  1258. scipy/special/tests/test_precompute_utils.py +36 -0
  1259. scipy/special/tests/test_round.py +18 -0
  1260. scipy/special/tests/test_sf_error.py +146 -0
  1261. scipy/special/tests/test_sici.py +36 -0
  1262. scipy/special/tests/test_specfun.py +48 -0
  1263. scipy/special/tests/test_spence.py +32 -0
  1264. scipy/special/tests/test_spfun_stats.py +61 -0
  1265. scipy/special/tests/test_sph_harm.py +85 -0
  1266. scipy/special/tests/test_spherical_bessel.py +400 -0
  1267. scipy/special/tests/test_support_alternative_backends.py +248 -0
  1268. scipy/special/tests/test_trig.py +72 -0
  1269. scipy/special/tests/test_ufunc_signatures.py +46 -0
  1270. scipy/special/tests/test_wright_bessel.py +205 -0
  1271. scipy/special/tests/test_wrightomega.py +117 -0
  1272. scipy/special/tests/test_zeta.py +301 -0
  1273. scipy/stats/__init__.py +670 -0
  1274. scipy/stats/_ansari_swilk_statistics.cpython-314t-darwin.so +0 -0
  1275. scipy/stats/_axis_nan_policy.py +692 -0
  1276. scipy/stats/_biasedurn.cpython-314t-darwin.so +0 -0
  1277. scipy/stats/_biasedurn.pxd +27 -0
  1278. scipy/stats/_binned_statistic.py +795 -0
  1279. scipy/stats/_binomtest.py +375 -0
  1280. scipy/stats/_bws_test.py +177 -0
  1281. scipy/stats/_censored_data.py +459 -0
  1282. scipy/stats/_common.py +5 -0
  1283. scipy/stats/_constants.py +42 -0
  1284. scipy/stats/_continued_fraction.py +387 -0
  1285. scipy/stats/_continuous_distns.py +12486 -0
  1286. scipy/stats/_correlation.py +210 -0
  1287. scipy/stats/_covariance.py +636 -0
  1288. scipy/stats/_crosstab.py +204 -0
  1289. scipy/stats/_discrete_distns.py +2098 -0
  1290. scipy/stats/_distn_infrastructure.py +4201 -0
  1291. scipy/stats/_distr_params.py +299 -0
  1292. scipy/stats/_distribution_infrastructure.py +5750 -0
  1293. scipy/stats/_entropy.py +428 -0
  1294. scipy/stats/_finite_differences.py +145 -0
  1295. scipy/stats/_fit.py +1351 -0
  1296. scipy/stats/_hypotests.py +2060 -0
  1297. scipy/stats/_kde.py +732 -0
  1298. scipy/stats/_ksstats.py +600 -0
  1299. scipy/stats/_levy_stable/__init__.py +1231 -0
  1300. scipy/stats/_levy_stable/levyst.cpython-314t-darwin.so +0 -0
  1301. scipy/stats/_mannwhitneyu.py +492 -0
  1302. scipy/stats/_mgc.py +550 -0
  1303. scipy/stats/_morestats.py +4626 -0
  1304. scipy/stats/_mstats_basic.py +3658 -0
  1305. scipy/stats/_mstats_extras.py +521 -0
  1306. scipy/stats/_multicomp.py +449 -0
  1307. scipy/stats/_multivariate.py +7281 -0
  1308. scipy/stats/_new_distributions.py +452 -0
  1309. scipy/stats/_odds_ratio.py +466 -0
  1310. scipy/stats/_page_trend_test.py +486 -0
  1311. scipy/stats/_probability_distribution.py +1964 -0
  1312. scipy/stats/_qmc.py +2956 -0
  1313. scipy/stats/_qmc_cy.cpython-314t-darwin.so +0 -0
  1314. scipy/stats/_qmc_cy.pyi +54 -0
  1315. scipy/stats/_qmvnt.py +454 -0
  1316. scipy/stats/_qmvnt_cy.cpython-314t-darwin.so +0 -0
  1317. scipy/stats/_quantile.py +335 -0
  1318. scipy/stats/_rcont/__init__.py +4 -0
  1319. scipy/stats/_rcont/rcont.cpython-314t-darwin.so +0 -0
  1320. scipy/stats/_relative_risk.py +263 -0
  1321. scipy/stats/_resampling.py +2352 -0
  1322. scipy/stats/_result_classes.py +40 -0
  1323. scipy/stats/_sampling.py +1314 -0
  1324. scipy/stats/_sensitivity_analysis.py +713 -0
  1325. scipy/stats/_sobol.cpython-314t-darwin.so +0 -0
  1326. scipy/stats/_sobol.pyi +54 -0
  1327. scipy/stats/_sobol_direction_numbers.npz +0 -0
  1328. scipy/stats/_stats.cpython-314t-darwin.so +0 -0
  1329. scipy/stats/_stats.pxd +10 -0
  1330. scipy/stats/_stats_mstats_common.py +322 -0
  1331. scipy/stats/_stats_py.py +11089 -0
  1332. scipy/stats/_stats_pythran.cpython-314t-darwin.so +0 -0
  1333. scipy/stats/_survival.py +683 -0
  1334. scipy/stats/_tukeylambda_stats.py +199 -0
  1335. scipy/stats/_unuran/__init__.py +0 -0
  1336. scipy/stats/_unuran/unuran_wrapper.cpython-314t-darwin.so +0 -0
  1337. scipy/stats/_unuran/unuran_wrapper.pyi +179 -0
  1338. scipy/stats/_variation.py +126 -0
  1339. scipy/stats/_warnings_errors.py +38 -0
  1340. scipy/stats/_wilcoxon.py +265 -0
  1341. scipy/stats/biasedurn.py +16 -0
  1342. scipy/stats/contingency.py +521 -0
  1343. scipy/stats/distributions.py +24 -0
  1344. scipy/stats/kde.py +18 -0
  1345. scipy/stats/morestats.py +27 -0
  1346. scipy/stats/mstats.py +140 -0
  1347. scipy/stats/mstats_basic.py +42 -0
  1348. scipy/stats/mstats_extras.py +25 -0
  1349. scipy/stats/mvn.py +17 -0
  1350. scipy/stats/qmc.py +236 -0
  1351. scipy/stats/sampling.py +73 -0
  1352. scipy/stats/stats.py +41 -0
  1353. scipy/stats/tests/__init__.py +0 -0
  1354. scipy/stats/tests/common_tests.py +356 -0
  1355. scipy/stats/tests/data/_mvt.py +171 -0
  1356. scipy/stats/tests/data/fisher_exact_results_from_r.py +607 -0
  1357. scipy/stats/tests/data/jf_skew_t_gamlss_pdf_data.npy +0 -0
  1358. scipy/stats/tests/data/levy_stable/stable-Z1-cdf-sample-data.npy +0 -0
  1359. scipy/stats/tests/data/levy_stable/stable-Z1-pdf-sample-data.npy +0 -0
  1360. scipy/stats/tests/data/levy_stable/stable-loc-scale-sample-data.npy +0 -0
  1361. scipy/stats/tests/data/nist_anova/AtmWtAg.dat +108 -0
  1362. scipy/stats/tests/data/nist_anova/SiRstv.dat +85 -0
  1363. scipy/stats/tests/data/nist_anova/SmLs01.dat +249 -0
  1364. scipy/stats/tests/data/nist_anova/SmLs02.dat +1869 -0
  1365. scipy/stats/tests/data/nist_anova/SmLs03.dat +18069 -0
  1366. scipy/stats/tests/data/nist_anova/SmLs04.dat +249 -0
  1367. scipy/stats/tests/data/nist_anova/SmLs05.dat +1869 -0
  1368. scipy/stats/tests/data/nist_anova/SmLs06.dat +18069 -0
  1369. scipy/stats/tests/data/nist_anova/SmLs07.dat +249 -0
  1370. scipy/stats/tests/data/nist_anova/SmLs08.dat +1869 -0
  1371. scipy/stats/tests/data/nist_anova/SmLs09.dat +18069 -0
  1372. scipy/stats/tests/data/nist_linregress/Norris.dat +97 -0
  1373. scipy/stats/tests/data/rel_breitwigner_pdf_sample_data_ROOT.npy +0 -0
  1374. scipy/stats/tests/data/studentized_range_mpmath_ref.json +1499 -0
  1375. scipy/stats/tests/test_axis_nan_policy.py +1388 -0
  1376. scipy/stats/tests/test_binned_statistic.py +568 -0
  1377. scipy/stats/tests/test_censored_data.py +152 -0
  1378. scipy/stats/tests/test_contingency.py +294 -0
  1379. scipy/stats/tests/test_continued_fraction.py +173 -0
  1380. scipy/stats/tests/test_continuous.py +2198 -0
  1381. scipy/stats/tests/test_continuous_basic.py +1053 -0
  1382. scipy/stats/tests/test_continuous_fit_censored.py +683 -0
  1383. scipy/stats/tests/test_correlation.py +80 -0
  1384. scipy/stats/tests/test_crosstab.py +115 -0
  1385. scipy/stats/tests/test_discrete_basic.py +580 -0
  1386. scipy/stats/tests/test_discrete_distns.py +700 -0
  1387. scipy/stats/tests/test_distributions.py +10413 -0
  1388. scipy/stats/tests/test_entropy.py +322 -0
  1389. scipy/stats/tests/test_fast_gen_inversion.py +435 -0
  1390. scipy/stats/tests/test_fit.py +1090 -0
  1391. scipy/stats/tests/test_hypotests.py +1991 -0
  1392. scipy/stats/tests/test_kdeoth.py +676 -0
  1393. scipy/stats/tests/test_marray.py +289 -0
  1394. scipy/stats/tests/test_mgc.py +217 -0
  1395. scipy/stats/tests/test_morestats.py +3259 -0
  1396. scipy/stats/tests/test_mstats_basic.py +2071 -0
  1397. scipy/stats/tests/test_mstats_extras.py +172 -0
  1398. scipy/stats/tests/test_multicomp.py +405 -0
  1399. scipy/stats/tests/test_multivariate.py +4381 -0
  1400. scipy/stats/tests/test_odds_ratio.py +148 -0
  1401. scipy/stats/tests/test_qmc.py +1492 -0
  1402. scipy/stats/tests/test_quantile.py +199 -0
  1403. scipy/stats/tests/test_rank.py +345 -0
  1404. scipy/stats/tests/test_relative_risk.py +95 -0
  1405. scipy/stats/tests/test_resampling.py +2000 -0
  1406. scipy/stats/tests/test_sampling.py +1450 -0
  1407. scipy/stats/tests/test_sensitivity_analysis.py +310 -0
  1408. scipy/stats/tests/test_stats.py +9707 -0
  1409. scipy/stats/tests/test_survival.py +466 -0
  1410. scipy/stats/tests/test_tukeylambda_stats.py +85 -0
  1411. scipy/stats/tests/test_variation.py +216 -0
  1412. scipy/version.py +12 -0
  1413. scipy-1.16.1.dist-info/LICENSE.txt +934 -0
  1414. scipy-1.16.1.dist-info/METADATA +1083 -0
  1415. scipy-1.16.1.dist-info/RECORD +1416 -0
  1416. scipy-1.16.1.dist-info/WHEEL +6 -0
@@ -0,0 +1,1328 @@
1
+ """Base class for sparse matrix formats using compressed storage."""
2
+ __all__ = []
3
+
4
+ from warnings import warn
5
+ import itertools
6
+
7
+ import numpy as np
8
+ from scipy._lib._util import _prune_array, copy_if_needed
9
+
10
+ from ._base import _spbase, issparse, sparray, SparseEfficiencyWarning
11
+ from ._data import _data_matrix, _minmax_mixin
12
+ from . import _sparsetools
13
+ from ._sparsetools import (get_csr_submatrix, csr_sample_offsets, csr_todense,
14
+ csr_sample_values, csr_row_index, csr_row_slice,
15
+ csr_column_index1, csr_column_index2, csr_diagonal,
16
+ expandptr, csr_has_canonical_format, csr_eliminate_zeros,
17
+ csr_sum_duplicates, csr_has_sorted_indices, csr_sort_indices,
18
+ csr_matmat_maxnnz, csr_matmat)
19
+ from ._index import IndexMixin
20
+ from ._sputils import (upcast, upcast_char, to_native, isshape,
21
+ getdtype, isintlike, downcast_intp_index,
22
+ get_sum_dtype, check_shape, get_index_dtype, broadcast_shapes)
23
+
24
+
25
+ class _cs_matrix(_data_matrix, _minmax_mixin, IndexMixin):
26
+ """
27
+ base array/matrix class for compressed row- and column-oriented arrays/matrices
28
+ """
29
+
30
+ def __init__(self, arg1, shape=None, dtype=None, copy=False, *, maxprint=None):
31
+ _data_matrix.__init__(self, arg1, maxprint=maxprint)
32
+
33
+ if issparse(arg1):
34
+ if arg1.format == self.format and copy:
35
+ arg1 = arg1.copy()
36
+ else:
37
+ arg1 = arg1.asformat(self.format)
38
+ self.indptr, self.indices, self.data, self._shape = (
39
+ arg1.indptr, arg1.indices, arg1.data, arg1._shape
40
+ )
41
+
42
+ elif isinstance(arg1, tuple):
43
+ if isshape(arg1, allow_nd=self._allow_nd):
44
+ # It's a tuple of matrix dimensions (M, N)
45
+ # create empty matrix
46
+ self._shape = check_shape(arg1, allow_nd=self._allow_nd)
47
+ M, N = self._swap(self._shape_as_2d)
48
+ # Select index dtype large enough to pass array and
49
+ # scalar parameters to sparsetools
50
+ idx_dtype = self._get_index_dtype(maxval=max(self.shape))
51
+ self.data = np.zeros(0, getdtype(dtype, default=float))
52
+ self.indices = np.zeros(0, idx_dtype)
53
+ self.indptr = np.zeros(M + 1, dtype=idx_dtype)
54
+ else:
55
+ if len(arg1) == 2:
56
+ # (data, ij) format
57
+ coo = self._coo_container(arg1, shape=shape, dtype=dtype)
58
+ arrays = coo._coo_to_compressed(self._swap)
59
+ self.indptr, self.indices, self.data, self._shape = arrays
60
+ self.sum_duplicates()
61
+ elif len(arg1) == 3:
62
+ # (data, indices, indptr) format
63
+ (data, indices, indptr) = arg1
64
+
65
+ # Select index dtype large enough to pass array and
66
+ # scalar parameters to sparsetools
67
+ maxval = None
68
+ if shape is not None and 0 not in shape:
69
+ maxval = max(shape)
70
+ idx_dtype = self._get_index_dtype((indices, indptr),
71
+ maxval=maxval,
72
+ check_contents=True)
73
+
74
+ if not copy:
75
+ copy = copy_if_needed
76
+ self.indices = np.array(indices, copy=copy, dtype=idx_dtype)
77
+ self.indptr = np.array(indptr, copy=copy, dtype=idx_dtype)
78
+ self.data = np.array(data, copy=copy, dtype=dtype)
79
+ else:
80
+ raise ValueError(f"unrecognized {self.__class__.__name__} "
81
+ f"constructor input: {arg1}")
82
+
83
+ else:
84
+ # must be dense
85
+ try:
86
+ arg1 = np.asarray(arg1)
87
+ except Exception as e:
88
+ raise ValueError(f"unrecognized {self.__class__.__name__} "
89
+ f"constructor input: {arg1}") from e
90
+ if isinstance(self, sparray) and arg1.ndim != 2 and self.format == "csc":
91
+ raise ValueError(f"CSC arrays don't support {arg1.ndim}D input. Use 2D")
92
+ if arg1.ndim > 2:
93
+ raise ValueError(f"CSR arrays don't yet support {arg1.ndim}D.")
94
+
95
+ coo = self._coo_container(arg1, dtype=dtype)
96
+ arrays = coo._coo_to_compressed(self._swap)
97
+ self.indptr, self.indices, self.data, self._shape = arrays
98
+
99
+ # Read matrix dimensions given, if any
100
+ if shape is not None:
101
+ self._shape = check_shape(shape, allow_nd=self._allow_nd)
102
+ elif self.shape is None:
103
+ # shape not already set, try to infer dimensions
104
+ try:
105
+ M = len(self.indptr) - 1
106
+ N = self.indices.max() + 1
107
+ except Exception as e:
108
+ raise ValueError('unable to infer matrix dimensions') from e
109
+
110
+ self._shape = check_shape(self._swap((M, N)), allow_nd=self._allow_nd)
111
+
112
+ if dtype is not None:
113
+ newdtype = getdtype(dtype)
114
+ self.data = self.data.astype(newdtype, copy=False)
115
+
116
+ self.check_format(full_check=False)
117
+
118
+ def _getnnz(self, axis=None):
119
+ if axis is None:
120
+ return int(self.indptr[-1])
121
+ elif self.ndim == 1:
122
+ if axis in (0, -1):
123
+ return int(self.indptr[-1])
124
+ raise ValueError('axis out of bounds')
125
+ else:
126
+ if axis < 0:
127
+ axis += 2
128
+ axis, _ = self._swap((axis, 1 - axis))
129
+ _, N = self._swap(self.shape)
130
+ if axis == 0:
131
+ return np.bincount(downcast_intp_index(self.indices), minlength=N)
132
+ elif axis == 1:
133
+ return np.diff(self.indptr)
134
+ raise ValueError('axis out of bounds')
135
+
136
+ _getnnz.__doc__ = _spbase._getnnz.__doc__
137
+
138
+ def count_nonzero(self, axis=None):
139
+ self.sum_duplicates()
140
+ if axis is None:
141
+ return np.count_nonzero(self.data)
142
+
143
+ if self.ndim == 1:
144
+ if axis not in (0, -1):
145
+ raise ValueError('axis out of bounds')
146
+ return np.count_nonzero(self.data)
147
+
148
+ if axis < 0:
149
+ axis += 2
150
+ axis, _ = self._swap((axis, 1 - axis))
151
+ if axis == 0:
152
+ _, N = self._swap(self.shape)
153
+ mask = self.data != 0
154
+ idx = self.indices if mask.all() else self.indices[mask]
155
+ return np.bincount(downcast_intp_index(idx), minlength=N)
156
+ elif axis == 1:
157
+ if self.data.all():
158
+ return np.diff(self.indptr)
159
+ pairs = itertools.pairwise(self.indptr)
160
+ return np.array([np.count_nonzero(self.data[i:j]) for i, j in pairs])
161
+ else:
162
+ raise ValueError('axis out of bounds')
163
+
164
+ count_nonzero.__doc__ = _spbase.count_nonzero.__doc__
165
+
166
+ def check_format(self, full_check=True):
167
+ """Check whether the array/matrix respects the CSR or CSC format.
168
+
169
+ Parameters
170
+ ----------
171
+ full_check : bool, optional
172
+ If `True`, run rigorous check, scanning arrays for valid values.
173
+ Note that activating those check might copy arrays for casting,
174
+ modifying indices and index pointers' inplace.
175
+ If `False`, run basic checks on attributes. O(1) operations.
176
+ Default is `True`.
177
+ """
178
+ # index arrays should have integer data types
179
+ if self.indptr.dtype.kind != 'i':
180
+ warn(f"indptr array has non-integer dtype ({self.indptr.dtype.name})",
181
+ stacklevel=3)
182
+ if self.indices.dtype.kind != 'i':
183
+ warn(f"indices array has non-integer dtype ({self.indices.dtype.name})",
184
+ stacklevel=3)
185
+
186
+ # check array shapes
187
+ for x in [self.data.ndim, self.indices.ndim, self.indptr.ndim]:
188
+ if x != 1:
189
+ raise ValueError('data, indices, and indptr should be 1-D')
190
+
191
+ # check index pointer. Use _swap to determine proper bounds
192
+ M, N = self._swap(self._shape_as_2d)
193
+
194
+ if (len(self.indptr) != M + 1):
195
+ raise ValueError(f"index pointer size {len(self.indptr)} should be {M + 1}")
196
+ if (self.indptr[0] != 0):
197
+ raise ValueError("index pointer should start with 0")
198
+
199
+ # check index and data arrays
200
+ if (len(self.indices) != len(self.data)):
201
+ raise ValueError("indices and data should have the same size")
202
+ if (self.indptr[-1] > len(self.indices)):
203
+ raise ValueError("Last value of index pointer should be less than "
204
+ "the size of index and data arrays")
205
+
206
+ self.prune()
207
+
208
+ if full_check:
209
+ # check format validity (more expensive)
210
+ if self.nnz > 0:
211
+ if self.indices.max() >= N:
212
+ raise ValueError(f"indices must be < {N}")
213
+ if self.indices.min() < 0:
214
+ raise ValueError("indices must be >= 0")
215
+ if np.diff(self.indptr).min() < 0:
216
+ raise ValueError("indptr must be a non-decreasing sequence")
217
+
218
+ idx_dtype = self._get_index_dtype((self.indptr, self.indices))
219
+ self.indptr = np.asarray(self.indptr, dtype=idx_dtype)
220
+ self.indices = np.asarray(self.indices, dtype=idx_dtype)
221
+ self.data = to_native(self.data)
222
+
223
+ # if not self.has_sorted_indices():
224
+ # warn('Indices were not in sorted order. Sorting indices.')
225
+ # self.sort_indices()
226
+ # assert(self.has_sorted_indices())
227
+ # TODO check for duplicates?
228
+
229
+ #######################
230
+ # Boolean comparisons #
231
+ #######################
232
+
233
+ def _scalar_binopt(self, other, op):
234
+ """Scalar version of self._binopt, for cases in which no new nonzeros
235
+ are added. Produces a new sparse array in canonical form.
236
+ """
237
+ self.sum_duplicates()
238
+ res = self._with_data(op(self.data, other), copy=True)
239
+ res.eliminate_zeros()
240
+ return res
241
+
242
+ #################################
243
+ # Arithmetic operator overrides #
244
+ #################################
245
+
246
+ def _add_dense(self, other):
247
+ if other.shape != self.shape:
248
+ raise ValueError(f'Incompatible shapes ({self.shape} and {other.shape})')
249
+ dtype = upcast_char(self.dtype.char, other.dtype.char)
250
+ order = self._swap('CF')[0]
251
+ result = np.array(other, dtype=dtype, order=order, copy=True)
252
+ y = result if result.flags.c_contiguous else result.T
253
+ M, N = self._swap(self._shape_as_2d)
254
+ csr_todense(M, N, self.indptr, self.indices, self.data, y)
255
+ return self._container(result, copy=False)
256
+
257
+ def _add_sparse(self, other):
258
+ return self._binopt(other, '_plus_')
259
+
260
+ def _sub_sparse(self, other):
261
+ return self._binopt(other, '_minus_')
262
+
263
+ def _multiply_2d_with_broadcasting(self, other):
264
+ """Element-wise multiplication by array/matrix, vector, or scalar."""
265
+ # Called after checking that other is not scalarlike and self.ndim <=2
266
+ if issparse(other):
267
+ if self.shape == other.shape:
268
+ other = self.__class__(other)
269
+ return self._binopt(other, '_elmul_')
270
+ # Single element.
271
+ if other.shape == (1, 1):
272
+ result = self._mul_scalar(other.toarray()[0, 0])
273
+ if self.ndim == 1:
274
+ return result.reshape((1, self.shape[0]))
275
+ return result
276
+ if other.shape == (1,):
277
+ return self._mul_scalar(other.toarray()[0])
278
+ if self.shape in ((1,), (1, 1)):
279
+ return other._mul_scalar(self.data.sum())
280
+
281
+ # broadcast. treat 1d like a row
282
+ sM, sN = self._shape_as_2d
283
+ oM, oN = other._shape_as_2d
284
+ # A row times a column.
285
+ if sM == 1 and oN == 1:
286
+ return other._matmul_sparse(self.reshape(sM, sN).tocsc())
287
+ if sN == 1 and oM == 1:
288
+ return self._matmul_sparse(other.reshape(oM, oN).tocsc())
289
+
290
+ is_array = isinstance(self, sparray)
291
+ # Other is a row.
292
+ if oM == 1 and sN == oN:
293
+ new_other = _make_diagonal_csr(other.toarray().ravel(), is_array)
294
+ result = self._matmul_sparse(new_other)
295
+ return result if self.ndim == 2 else result.reshape((1, oN))
296
+ # self is a row.
297
+ if sM == 1 and sN == oN:
298
+ copy = _make_diagonal_csr(self.toarray().ravel(), is_array)
299
+ return other._matmul_sparse(copy)
300
+
301
+ # Other is a column.
302
+ if oN == 1 and sM == oM:
303
+ new_other = _make_diagonal_csr(other.toarray().ravel(), is_array)
304
+ return new_other._matmul_sparse(self)
305
+ # self is a column.
306
+ if sN == 1 and sM == oM:
307
+ new_self = _make_diagonal_csr(self.toarray().ravel(), is_array)
308
+ return new_self._matmul_sparse(other)
309
+ raise ValueError(f"inconsistent shapes {self.shape} and {other.shape}")
310
+
311
+ # Assume other is a dense matrix/array, which produces a single-item
312
+ # object array if other isn't convertible to ndarray.
313
+ other = np.asanyarray(other)
314
+
315
+ if other.ndim > 2:
316
+ return np.multiply(self.toarray(), other)
317
+ # Single element / wrapped object.
318
+ if other.size == 1:
319
+ if other.dtype == np.object_:
320
+ # 'other' not convertible to ndarray.
321
+ return NotImplemented
322
+ bshape = broadcast_shapes(self.shape, other.shape)
323
+ return self._mul_scalar(other.flat[0]).reshape(bshape)
324
+ # Fast case for trivial sparse matrix.
325
+ if self.shape in ((1,), (1, 1)):
326
+ bshape = broadcast_shapes(self.shape, other.shape)
327
+ return np.multiply(self.data.sum(), other).reshape(bshape)
328
+
329
+ ret = self.tocoo()
330
+ # Matching shapes.
331
+ if self.shape == other.shape:
332
+ data = np.multiply(ret.data, other[ret.coords])
333
+ ret.data = data.view(np.ndarray).ravel()
334
+ return ret
335
+
336
+ # convert other to 2d
337
+ other2d = np.atleast_2d(other)
338
+ # Sparse row vector times...
339
+ if self.shape[0] == 1 or self.ndim == 1:
340
+ if other2d.shape[1] == 1: # Dense column vector.
341
+ data = np.multiply(ret.data, other2d)
342
+ elif other2d.shape[1] == self.shape[-1]: # Dense 2d matrix.
343
+ data = np.multiply(ret.data, other2d[:, ret.col])
344
+ else:
345
+ raise ValueError(f"inconsistent shapes {self.shape} and {other.shape}")
346
+ idx_dtype = self._get_index_dtype(ret.col,
347
+ maxval=ret.nnz * other2d.shape[0])
348
+ row = np.repeat(np.arange(other2d.shape[0], dtype=idx_dtype), ret.nnz)
349
+ col = np.tile(ret.col.astype(idx_dtype, copy=False), other2d.shape[0])
350
+ return self._coo_container(
351
+ (data.view(np.ndarray).ravel(), (row, col)),
352
+ shape=(other2d.shape[0], self.shape[-1]),
353
+ copy=False
354
+ )
355
+ # Sparse column vector times...
356
+ if self.shape[1] == 1:
357
+ if other2d.shape[0] == 1: # Dense row vector.
358
+ data = np.multiply(ret.data[:, None], other2d)
359
+ elif other2d.shape[0] == self.shape[0]: # Dense 2d array.
360
+ data = np.multiply(ret.data[:, None], other2d[ret.row])
361
+ else:
362
+ raise ValueError(f"inconsistent shapes {self.shape} and {other.shape}")
363
+ idx_dtype = self._get_index_dtype(ret.row,
364
+ maxval=ret.nnz * other2d.shape[1])
365
+ row = np.repeat(ret.row.astype(idx_dtype, copy=False), other2d.shape[1])
366
+ col = np.tile(np.arange(other2d.shape[1], dtype=idx_dtype), ret.nnz)
367
+ return self._coo_container(
368
+ (data.view(np.ndarray).ravel(), (row, col)),
369
+ shape=(self.shape[0], other2d.shape[1]),
370
+ copy=False
371
+ )
372
+ # Sparse matrix times dense row vector.
373
+ if other2d.shape[0] == 1 and self.shape[1] == other2d.shape[1]:
374
+ data = np.multiply(ret.data, other2d[:, ret.col].ravel())
375
+ # Sparse matrix times dense column vector.
376
+ elif other2d.shape[1] == 1 and self.shape[0] == other2d.shape[0]:
377
+ data = np.multiply(ret.data, other2d[ret.row].ravel())
378
+ else:
379
+ raise ValueError(f"inconsistent shapes {self.shape} and {other.shape}")
380
+ ret.data = data.view(np.ndarray).ravel()
381
+ return ret
382
+
383
+ ###########################
384
+ # Multiplication handlers #
385
+ ###########################
386
+
387
+ def _matmul_vector(self, other):
388
+ M, N = self._shape_as_2d
389
+
390
+ # output array
391
+ result = np.zeros(M, dtype=upcast_char(self.dtype.char, other.dtype.char))
392
+
393
+ # csr_matvec or csc_matvec
394
+ fn = getattr(_sparsetools, self.format + '_matvec')
395
+ fn(M, N, self.indptr, self.indices, self.data, other, result)
396
+
397
+ return result[0] if self.ndim == 1 else result
398
+
399
+ def _matmul_multivector(self, other):
400
+ M, N = self._shape_as_2d
401
+ n_vecs = other.shape[-1] # number of column vectors
402
+
403
+ result = np.zeros((M, n_vecs),
404
+ dtype=upcast_char(self.dtype.char, other.dtype.char))
405
+
406
+ # csr_matvecs or csc_matvecs
407
+ fn = getattr(_sparsetools, self.format + '_matvecs')
408
+ fn(M, N, n_vecs, self.indptr, self.indices, self.data,
409
+ other.ravel(), result.ravel())
410
+
411
+ if self.ndim == 1:
412
+ return result.reshape((n_vecs,))
413
+ return result
414
+
415
+ def _matmul_sparse(self, other):
416
+ M, K1 = self._shape_as_2d
417
+ # if other is 1d, treat as a **column**
418
+ o_ndim = other.ndim
419
+ if o_ndim == 1:
420
+ # convert 1d array to a 2d column when on the right of @
421
+ other = other.reshape((1, other.shape[0])).T # Note: converts to CSC
422
+ K2, N = other._shape if other.ndim == 2 else (other.shape[0], 1)
423
+
424
+ # find new_shape: (M, N), (M,), (N,) or ()
425
+ new_shape = ()
426
+ if self.ndim == 2:
427
+ new_shape += (M,)
428
+ if o_ndim == 2:
429
+ new_shape += (N,)
430
+ faux_shape = (M if self.ndim == 2 else 1, N if o_ndim == 2 else 1)
431
+
432
+ other = self.__class__(other) # convert to this format
433
+ index_arrays = (self.indptr, self.indices, other.indptr, other.indices)
434
+
435
+ M, N = self._swap((M, N))
436
+ s, o = self._swap((self, other))
437
+
438
+ idx_dtype = self._get_index_dtype(index_arrays)
439
+ s_indptr = np.asarray(s.indptr, dtype=idx_dtype)
440
+ s_indices = np.asarray(s.indices, dtype=idx_dtype)
441
+ o_indptr = np.asarray(o.indptr, dtype=idx_dtype)
442
+ o_indices = np.asarray(o.indices, dtype=idx_dtype)
443
+
444
+ nnz = csr_matmat_maxnnz(M, N, s_indptr, s_indices, o_indptr, o_indices)
445
+ if nnz == 0:
446
+ if new_shape == ():
447
+ return np.array(0, dtype=upcast(self.dtype, other.dtype))
448
+ return self.__class__(new_shape, dtype=upcast(self.dtype, other.dtype))
449
+
450
+ new_idx_dtype = self._get_index_dtype(index_arrays, maxval=nnz)
451
+ if new_idx_dtype != idx_dtype:
452
+ idx_dtype = new_idx_dtype
453
+ s_indptr = np.asarray(s.indptr, dtype=idx_dtype)
454
+ s_indices = np.asarray(s.indices, dtype=idx_dtype)
455
+ o_indptr = np.asarray(o.indptr, dtype=idx_dtype)
456
+ o_indices = np.asarray(o.indices, dtype=idx_dtype)
457
+
458
+ indptr = np.empty(M + 1, dtype=idx_dtype)
459
+ indices = np.empty(nnz, dtype=idx_dtype)
460
+ data = np.empty(nnz, dtype=upcast(self.dtype, other.dtype))
461
+
462
+ csr_matmat(M, N,
463
+ s_indptr, s_indices, s.data,
464
+ o_indptr, o_indices, o.data,
465
+ indptr, indices, data)
466
+
467
+ if new_shape == ():
468
+ return np.array(data[0])
469
+ res = self.__class__((data, indices, indptr), shape=faux_shape)
470
+ if faux_shape != new_shape:
471
+ if res.format != 'csr':
472
+ res = res.tocsr()
473
+ res = res.reshape(new_shape)
474
+ return res
475
+
476
+ def diagonal(self, k=0):
477
+ M, N = self._swap(self.shape)
478
+ k, _ = self._swap((k, -k))
479
+
480
+ if k <= -M or k >= N:
481
+ return np.empty(0, dtype=self.data.dtype)
482
+ y = np.empty(min(M + min(k, 0), N - max(k, 0)), dtype=upcast(self.dtype))
483
+ csr_diagonal(k, M, N, self.indptr, self.indices, self.data, y)
484
+ return y
485
+
486
+ diagonal.__doc__ = _spbase.diagonal.__doc__
487
+
488
+ #####################
489
+ # Reduce operations #
490
+ #####################
491
+
492
+ def sum(self, axis=None, dtype=None, out=None):
493
+ """Sum the array/matrix over the given axis. If the axis is None, sum
494
+ over both rows and columns, returning a scalar.
495
+ """
496
+ # The _spbase base class already does axis=None and major axis efficiently
497
+ # so we only do the case axis= minor axis
498
+ if (self.ndim == 2 and not hasattr(self, 'blocksize') and
499
+ axis in self._swap(((1, -1), (0, -2)))[0]):
500
+ # faster than multiplication for large minor axis in CSC/CSR
501
+ res_dtype = get_sum_dtype(self.dtype)
502
+ ret = np.zeros(len(self.indptr) - 1, dtype=res_dtype)
503
+
504
+ major_index, value = self._minor_reduce(np.add)
505
+ ret[major_index] = value
506
+ ret = self._ascontainer(ret)
507
+ if axis % 2 == 1:
508
+ ret = ret.T
509
+
510
+ return ret.sum(axis=(), dtype=dtype, out=out)
511
+ else:
512
+ return _spbase.sum(self, axis=axis, dtype=dtype, out=out)
513
+
514
+ sum.__doc__ = _spbase.sum.__doc__
515
+
516
+ def _minor_reduce(self, ufunc, data=None):
517
+ """Reduce nonzeros with a ufunc over the minor axis when non-empty
518
+
519
+ Can be applied to a function of self.data by supplying data parameter.
520
+
521
+ Warning: this does not call sum_duplicates()
522
+
523
+ Returns
524
+ -------
525
+ major_index : array of ints
526
+ Major indices where nonzero
527
+
528
+ value : array of self.dtype
529
+ Reduce result for nonzeros in each major_index
530
+ """
531
+ if data is None:
532
+ data = self.data
533
+ major_index = np.flatnonzero(np.diff(self.indptr))
534
+ value = ufunc.reduceat(data,
535
+ downcast_intp_index(self.indptr[major_index]))
536
+ return major_index, value
537
+
538
+ #######################
539
+ # Getting and Setting #
540
+ #######################
541
+
542
+ def _get_intXint(self, row, col):
543
+ M, N = self._swap(self.shape)
544
+ major, minor = self._swap((row, col))
545
+ indptr, indices, data = get_csr_submatrix(
546
+ M, N, self.indptr, self.indices, self.data,
547
+ major, major + 1, minor, minor + 1)
548
+ return data.sum(dtype=self.dtype)
549
+
550
+ def _get_sliceXslice(self, row, col):
551
+ major, minor = self._swap((row, col))
552
+ if major.step in (1, None) and minor.step in (1, None):
553
+ return self._get_submatrix(major, minor, copy=True)
554
+ return self._major_slice(major)._minor_slice(minor)
555
+
556
+ def _get_arrayXarray(self, row, col):
557
+ # inner indexing
558
+ idx_dtype = self.indices.dtype
559
+ M, N = self._swap(self.shape)
560
+ major, minor = self._swap((row, col))
561
+ major = np.asarray(major, dtype=idx_dtype)
562
+ minor = np.asarray(minor, dtype=idx_dtype)
563
+
564
+ val = np.empty(major.size, dtype=self.dtype)
565
+ csr_sample_values(M, N, self.indptr, self.indices, self.data,
566
+ major.size, major.ravel(), minor.ravel(), val)
567
+ if major.ndim == 1:
568
+ return self._ascontainer(val)
569
+ return self.__class__(val.reshape(major.shape))
570
+
571
+ def _get_columnXarray(self, row, col):
572
+ # outer indexing
573
+ major, minor = self._swap((row, col))
574
+ return self._major_index_fancy(major)._minor_index_fancy(minor)
575
+
576
+ def _major_index_fancy(self, idx):
577
+ """Index along the major axis where idx is an array of ints.
578
+ """
579
+ idx_dtype = self._get_index_dtype((self.indptr, self.indices))
580
+ indices = np.asarray(idx, dtype=idx_dtype).ravel()
581
+
582
+ N = self._swap(self._shape_as_2d)[1]
583
+ M = len(indices)
584
+ new_shape = self._swap((M, N)) if self.ndim == 2 else (M,)
585
+ if M == 0:
586
+ return self.__class__(new_shape, dtype=self.dtype)
587
+
588
+ row_nnz = (self.indptr[indices + 1] - self.indptr[indices]).astype(idx_dtype)
589
+ res_indptr = np.zeros(M + 1, dtype=idx_dtype)
590
+ np.cumsum(row_nnz, out=res_indptr[1:])
591
+
592
+ nnz = res_indptr[-1]
593
+ res_indices = np.empty(nnz, dtype=idx_dtype)
594
+ res_data = np.empty(nnz, dtype=self.dtype)
595
+ csr_row_index(
596
+ M,
597
+ indices,
598
+ self.indptr.astype(idx_dtype, copy=False),
599
+ self.indices.astype(idx_dtype, copy=False),
600
+ self.data,
601
+ res_indices,
602
+ res_data
603
+ )
604
+
605
+ return self.__class__((res_data, res_indices, res_indptr),
606
+ shape=new_shape, copy=False)
607
+
608
+ def _major_slice(self, idx, copy=False):
609
+ """Index along the major axis where idx is a slice object.
610
+ """
611
+ if idx == slice(None):
612
+ return self.copy() if copy else self
613
+
614
+ M, N = self._swap(self._shape_as_2d)
615
+ start, stop, step = idx.indices(M)
616
+ M = len(range(start, stop, step))
617
+ new_shape = self._swap((M, N)) if self.ndim == 2 else (M,)
618
+ if M == 0:
619
+ return self.__class__(new_shape, dtype=self.dtype)
620
+
621
+ # Work out what slices are needed for `row_nnz`
622
+ # start,stop can be -1, only if step is negative
623
+ start0, stop0 = start, stop
624
+ if stop == -1 and start >= 0:
625
+ stop0 = None
626
+ start1, stop1 = start + 1, stop + 1
627
+
628
+ row_nnz = self.indptr[start1:stop1:step] - \
629
+ self.indptr[start0:stop0:step]
630
+ idx_dtype = self.indices.dtype
631
+ res_indptr = np.zeros(M+1, dtype=idx_dtype)
632
+ np.cumsum(row_nnz, out=res_indptr[1:])
633
+
634
+ if step == 1:
635
+ all_idx = slice(self.indptr[start], self.indptr[stop])
636
+ res_indices = np.array(self.indices[all_idx], copy=copy)
637
+ res_data = np.array(self.data[all_idx], copy=copy)
638
+ else:
639
+ nnz = res_indptr[-1]
640
+ res_indices = np.empty(nnz, dtype=idx_dtype)
641
+ res_data = np.empty(nnz, dtype=self.dtype)
642
+ csr_row_slice(start, stop, step, self.indptr, self.indices,
643
+ self.data, res_indices, res_data)
644
+
645
+ return self.__class__((res_data, res_indices, res_indptr),
646
+ shape=new_shape, copy=False)
647
+
648
+ def _minor_index_fancy(self, idx):
649
+ """Index along the minor axis where idx is an array of ints.
650
+ """
651
+ idx_dtype = self._get_index_dtype((self.indices, self.indptr))
652
+ indices = self.indices.astype(idx_dtype, copy=False)
653
+ indptr = self.indptr.astype(idx_dtype, copy=False)
654
+
655
+ idx = np.asarray(idx, dtype=idx_dtype).ravel()
656
+
657
+ M, N = self._swap(self._shape_as_2d)
658
+ k = len(idx)
659
+ new_shape = self._swap((M, k)) if self.ndim == 2 else (k,)
660
+ if k == 0:
661
+ return self.__class__(new_shape, dtype=self.dtype)
662
+
663
+ # pass 1: count idx entries and compute new indptr
664
+ col_offsets = np.zeros(N, dtype=idx_dtype)
665
+ res_indptr = np.empty_like(self.indptr, dtype=idx_dtype)
666
+ csr_column_index1(
667
+ k,
668
+ idx,
669
+ M,
670
+ N,
671
+ indptr,
672
+ indices,
673
+ col_offsets,
674
+ res_indptr,
675
+ )
676
+
677
+ # pass 2: copy indices/data for selected idxs
678
+ col_order = np.argsort(idx).astype(idx_dtype, copy=False)
679
+ nnz = res_indptr[-1]
680
+ res_indices = np.empty(nnz, dtype=idx_dtype)
681
+ res_data = np.empty(nnz, dtype=self.dtype)
682
+ csr_column_index2(col_order, col_offsets, len(self.indices),
683
+ indices, self.data, res_indices, res_data)
684
+ return self.__class__((res_data, res_indices, res_indptr),
685
+ shape=new_shape, copy=False)
686
+
687
+ def _minor_slice(self, idx, copy=False):
688
+ """Index along the minor axis where idx is a slice object.
689
+ """
690
+ if idx == slice(None):
691
+ return self.copy() if copy else self
692
+
693
+ M, N = self._swap(self._shape_as_2d)
694
+ start, stop, step = idx.indices(N)
695
+ N = len(range(start, stop, step))
696
+ if N == 0:
697
+ return self.__class__(self._swap((M, N)), dtype=self.dtype)
698
+ if step == 1:
699
+ return self._get_submatrix(minor=idx, copy=copy)
700
+ # TODO: don't fall back to fancy indexing here
701
+ return self._minor_index_fancy(np.arange(start, stop, step))
702
+
703
+ def _get_submatrix(self, major=None, minor=None, copy=False):
704
+ """Return a submatrix of this matrix.
705
+
706
+ major, minor: None, int, or slice with step 1
707
+ """
708
+ M, N = self._swap(self._shape_as_2d)
709
+ i0, i1 = _process_slice(major, M)
710
+ j0, j1 = _process_slice(minor, N)
711
+
712
+ if i0 == 0 and j0 == 0 and i1 == M and j1 == N:
713
+ return self.copy() if copy else self
714
+
715
+ indptr, indices, data = get_csr_submatrix(
716
+ M, N, self.indptr, self.indices, self.data, i0, i1, j0, j1)
717
+
718
+ shape = self._swap((i1 - i0, j1 - j0))
719
+ if self.ndim == 1:
720
+ shape = (shape[1],)
721
+ return self.__class__((data, indices, indptr), shape=shape,
722
+ dtype=self.dtype, copy=False)
723
+
724
+ def _set_intXint(self, row, col, x):
725
+ i, j = self._swap((row, col))
726
+ self._set_many(i, j, x)
727
+
728
+ def _set_arrayXarray(self, row, col, x):
729
+ i, j = self._swap((row, col))
730
+ self._set_many(i, j, x)
731
+
732
+ def _set_arrayXarray_sparse(self, row, col, x):
733
+ # clear entries that will be overwritten
734
+ self._zero_many(*self._swap((row, col)))
735
+
736
+ M, N = row.shape # matches col.shape
737
+ broadcast_row = M != 1 and x.shape[0] == 1
738
+ broadcast_col = N != 1 and x.shape[1] == 1
739
+ r, c = x.row, x.col
740
+
741
+ x = np.asarray(x.data, dtype=self.dtype)
742
+ if x.size == 0:
743
+ return
744
+
745
+ if broadcast_row:
746
+ r = np.repeat(np.arange(M), len(r))
747
+ c = np.tile(c, M)
748
+ x = np.tile(x, M)
749
+ if broadcast_col:
750
+ r = np.repeat(r, N)
751
+ c = np.tile(np.arange(N), len(c))
752
+ x = np.repeat(x, N)
753
+ # only assign entries in the new sparsity structure
754
+ i, j = self._swap((row[r, c], col[r, c]))
755
+ self._set_many(i, j, x)
756
+
757
+ def _setdiag(self, values, k):
758
+ if 0 in self.shape:
759
+ return
760
+ if self.ndim == 1:
761
+ raise NotImplementedError('diagonals cant be set in 1d arrays')
762
+
763
+ M, N = self.shape
764
+ broadcast = (values.ndim == 0)
765
+
766
+ if k < 0:
767
+ if broadcast:
768
+ max_index = min(M + k, N)
769
+ else:
770
+ max_index = min(M + k, N, len(values))
771
+ i = np.arange(-k, max_index - k, dtype=self.indices.dtype)
772
+ j = np.arange(max_index, dtype=self.indices.dtype)
773
+
774
+ else:
775
+ if broadcast:
776
+ max_index = min(M, N - k)
777
+ else:
778
+ max_index = min(M, N - k, len(values))
779
+ i = np.arange(max_index, dtype=self.indices.dtype)
780
+ j = np.arange(k, k + max_index, dtype=self.indices.dtype)
781
+
782
+ if not broadcast:
783
+ values = values[:len(i)]
784
+
785
+ x = np.atleast_1d(np.asarray(values, dtype=self.dtype)).ravel()
786
+ if x.squeeze().shape != i.squeeze().shape:
787
+ x = np.broadcast_to(x, i.shape)
788
+ if x.size == 0:
789
+ return
790
+
791
+ M, N = self._swap((M, N))
792
+ i, j = self._swap((i, j))
793
+ n_samples = x.size
794
+ offsets = np.empty(n_samples, dtype=self.indices.dtype)
795
+ ret = csr_sample_offsets(M, N, self.indptr, self.indices, n_samples,
796
+ i, j, offsets)
797
+ if ret == 1:
798
+ # rinse and repeat
799
+ self.sum_duplicates()
800
+ csr_sample_offsets(M, N, self.indptr, self.indices, n_samples,
801
+ i, j, offsets)
802
+ if -1 not in offsets:
803
+ # only affects existing non-zero cells
804
+ self.data[offsets] = x
805
+ return
806
+
807
+ mask = (offsets >= 0)
808
+ # Boundary between csc and convert to coo
809
+ # The value 0.001 is justified in gh-19962#issuecomment-1920499678
810
+ if self.nnz - mask.sum() < self.nnz * 0.001:
811
+ # replace existing entries
812
+ self.data[offsets[mask]] = x[mask]
813
+ # create new entries
814
+ mask = ~mask
815
+ i = i[mask]
816
+ j = j[mask]
817
+ self._insert_many(i, j, x[mask])
818
+ else:
819
+ # convert to coo for _set_diag
820
+ coo = self.tocoo()
821
+ coo._setdiag(values, k)
822
+ arrays = coo._coo_to_compressed(self._swap)
823
+ self.indptr, self.indices, self.data, _ = arrays
824
+
825
+ def _prepare_indices(self, i, j):
826
+ M, N = self._swap(self._shape_as_2d)
827
+
828
+ def check_bounds(indices, bound):
829
+ idx = indices.max()
830
+ if idx >= bound:
831
+ raise IndexError(f'index ({idx}) out of range (>= {bound})')
832
+ idx = indices.min()
833
+ if idx < -bound:
834
+ raise IndexError(f'index ({idx}) out of range (< -{bound})')
835
+
836
+ i = np.atleast_1d(np.asarray(i, dtype=self.indices.dtype)).ravel()
837
+ j = np.atleast_1d(np.asarray(j, dtype=self.indices.dtype)).ravel()
838
+ check_bounds(i, M)
839
+ check_bounds(j, N)
840
+ return i, j, M, N
841
+
842
+ def _set_many(self, i, j, x):
843
+ """Sets value at each (i, j) to x
844
+
845
+ Here (i,j) index major and minor respectively, and must not contain
846
+ duplicate entries.
847
+ """
848
+ i, j, M, N = self._prepare_indices(i, j)
849
+ x = np.atleast_1d(np.asarray(x, dtype=self.dtype)).ravel()
850
+
851
+ n_samples = x.size
852
+ offsets = np.empty(n_samples, dtype=self.indices.dtype)
853
+ ret = csr_sample_offsets(M, N, self.indptr, self.indices, n_samples,
854
+ i, j, offsets)
855
+ if ret == 1:
856
+ # rinse and repeat
857
+ self.sum_duplicates()
858
+ csr_sample_offsets(M, N, self.indptr, self.indices, n_samples,
859
+ i, j, offsets)
860
+
861
+ if -1 not in offsets:
862
+ # only affects existing non-zero cells
863
+ self.data[offsets] = x
864
+ return
865
+
866
+ else:
867
+ warn(f"Changing the sparsity structure of a {self.__class__.__name__} is"
868
+ " expensive. lil and dok are more efficient.",
869
+ SparseEfficiencyWarning, stacklevel=3)
870
+ # replace where possible
871
+ mask = offsets > -1
872
+ self.data[offsets[mask]] = x[mask]
873
+ # only insertions remain
874
+ mask = ~mask
875
+ i = i[mask]
876
+ i[i < 0] += M
877
+ j = j[mask]
878
+ j[j < 0] += N
879
+ self._insert_many(i, j, x[mask])
880
+
881
+ def _zero_many(self, i, j):
882
+ """Sets value at each (i, j) to zero, preserving sparsity structure.
883
+
884
+ Here (i,j) index major and minor respectively.
885
+ """
886
+ i, j, M, N = self._prepare_indices(i, j)
887
+
888
+ n_samples = len(i)
889
+ offsets = np.empty(n_samples, dtype=self.indices.dtype)
890
+ ret = csr_sample_offsets(M, N, self.indptr, self.indices, n_samples,
891
+ i, j, offsets)
892
+ if ret == 1:
893
+ # rinse and repeat
894
+ self.sum_duplicates()
895
+ csr_sample_offsets(M, N, self.indptr, self.indices, n_samples,
896
+ i, j, offsets)
897
+
898
+ # only assign zeros to the existing sparsity structure
899
+ self.data[offsets[offsets > -1]] = 0
900
+
901
+ def _insert_many(self, i, j, x):
902
+ """Inserts new nonzero at each (i, j) with value x
903
+
904
+ Here (i,j) index major and minor respectively.
905
+ i, j and x must be non-empty, 1d arrays.
906
+ Inserts each major group (e.g. all entries per row) at a time.
907
+ Maintains has_sorted_indices property.
908
+ Modifies i, j, x in place.
909
+ """
910
+ order = np.argsort(i, kind='mergesort') # stable for duplicates
911
+ i = i.take(order, mode='clip')
912
+ j = j.take(order, mode='clip')
913
+ x = x.take(order, mode='clip')
914
+
915
+ do_sort = self.has_sorted_indices
916
+
917
+ # Update index data type
918
+ idx_dtype = self._get_index_dtype((self.indices, self.indptr),
919
+ maxval=(self.indptr[-1] + x.size))
920
+ self.indptr = np.asarray(self.indptr, dtype=idx_dtype)
921
+ self.indices = np.asarray(self.indices, dtype=idx_dtype)
922
+ i = np.asarray(i, dtype=idx_dtype)
923
+ j = np.asarray(j, dtype=idx_dtype)
924
+
925
+ # Collate old and new in chunks by major index
926
+ indices_parts = []
927
+ data_parts = []
928
+ ui, ui_indptr = np.unique(i, return_index=True)
929
+ ui_indptr = np.append(ui_indptr, len(j))
930
+ new_nnzs = np.diff(ui_indptr)
931
+ prev = 0
932
+ for c, (ii, js, je) in enumerate(zip(ui, ui_indptr, ui_indptr[1:])):
933
+ # old entries
934
+ start = self.indptr[prev]
935
+ stop = self.indptr[ii]
936
+ indices_parts.append(self.indices[start:stop])
937
+ data_parts.append(self.data[start:stop])
938
+
939
+ # handle duplicate j: keep last setting
940
+ uj, uj_indptr = np.unique(j[js:je][::-1], return_index=True)
941
+ if len(uj) == je - js:
942
+ indices_parts.append(j[js:je])
943
+ data_parts.append(x[js:je])
944
+ else:
945
+ indices_parts.append(j[js:je][::-1][uj_indptr])
946
+ data_parts.append(x[js:je][::-1][uj_indptr])
947
+ new_nnzs[c] = len(uj)
948
+
949
+ prev = ii
950
+
951
+ # remaining old entries
952
+ start = self.indptr[ii]
953
+ indices_parts.append(self.indices[start:])
954
+ data_parts.append(self.data[start:])
955
+
956
+ # update attributes
957
+ self.indices = np.concatenate(indices_parts)
958
+ self.data = np.concatenate(data_parts)
959
+ nnzs = np.empty(self.indptr.shape, dtype=idx_dtype)
960
+ nnzs[0] = idx_dtype(0)
961
+ indptr_diff = np.diff(self.indptr)
962
+ indptr_diff[ui] += new_nnzs
963
+ nnzs[1:] = indptr_diff
964
+ self.indptr = np.cumsum(nnzs, out=nnzs)
965
+
966
+ if do_sort:
967
+ # TODO: only sort where necessary
968
+ self.has_sorted_indices = False
969
+ self.sort_indices()
970
+
971
+ self.check_format(full_check=False)
972
+
973
+ ######################
974
+ # Conversion methods #
975
+ ######################
976
+
977
+ def tocoo(self, copy=True):
978
+ if self.ndim == 1:
979
+ csr = self.tocsr()
980
+ return self._coo_container((csr.data, (csr.indices,)), csr.shape, copy=copy)
981
+ major_dim, minor_dim = self._swap(self.shape)
982
+ minor_indices = self.indices
983
+ major_indices = np.empty(len(minor_indices), dtype=self.indices.dtype)
984
+ expandptr(major_dim, self.indptr, major_indices)
985
+ coords = self._swap((major_indices, minor_indices))
986
+
987
+ return self._coo_container(
988
+ (self.data, coords), self.shape, copy=copy, dtype=self.dtype
989
+ )
990
+
991
+ tocoo.__doc__ = _spbase.tocoo.__doc__
992
+
993
+ def toarray(self, order=None, out=None):
994
+ if out is None and order is None:
995
+ order = self._swap('cf')[0]
996
+ out = self._process_toarray_args(order, out)
997
+ if not (out.flags.c_contiguous or out.flags.f_contiguous):
998
+ raise ValueError('Output array must be C or F contiguous')
999
+ # align ideal order with output array order
1000
+ if out.flags.c_contiguous:
1001
+ x = self.tocsr()
1002
+ y = out
1003
+ else:
1004
+ x = self.tocsc()
1005
+ y = out.T
1006
+ M, N = x._swap(x._shape_as_2d)
1007
+ csr_todense(M, N, x.indptr, x.indices, x.data, y)
1008
+ return out
1009
+
1010
+ toarray.__doc__ = _spbase.toarray.__doc__
1011
+
1012
+ ##############################################################
1013
+ # methods that examine or modify the internal data structure #
1014
+ ##############################################################
1015
+
1016
+ def eliminate_zeros(self):
1017
+ """Remove zero entries from the array/matrix
1018
+
1019
+ This is an *in place* operation.
1020
+ """
1021
+ M, N = self._swap(self._shape_as_2d)
1022
+ csr_eliminate_zeros(M, N, self.indptr, self.indices, self.data)
1023
+ self.prune() # nnz may have changed
1024
+
1025
+ @property
1026
+ def has_canonical_format(self) -> bool:
1027
+ """Whether the array/matrix has sorted indices and no duplicates
1028
+
1029
+ Returns
1030
+ - True: if the above applies
1031
+ - False: otherwise
1032
+
1033
+ has_canonical_format implies has_sorted_indices, so if the latter flag
1034
+ is False, so will the former be; if the former is found True, the
1035
+ latter flag is also set.
1036
+ """
1037
+ # first check to see if result was cached
1038
+ if not getattr(self, '_has_sorted_indices', True):
1039
+ # not sorted => not canonical
1040
+ self._has_canonical_format = False
1041
+ elif not hasattr(self, '_has_canonical_format'):
1042
+ M = len(self.indptr) - 1
1043
+ self.has_canonical_format = bool(
1044
+ csr_has_canonical_format(M, self.indptr, self.indices)
1045
+ )
1046
+ return self._has_canonical_format
1047
+
1048
+ @has_canonical_format.setter
1049
+ def has_canonical_format(self, val: bool):
1050
+ self._has_canonical_format = bool(val)
1051
+ if val:
1052
+ self.has_sorted_indices = True
1053
+
1054
+ def sum_duplicates(self):
1055
+ """Eliminate duplicate entries by adding them together
1056
+
1057
+ This is an *in place* operation.
1058
+ """
1059
+ if self.has_canonical_format:
1060
+ return
1061
+ self.sort_indices()
1062
+
1063
+ M, N = self._swap(self._shape_as_2d)
1064
+ csr_sum_duplicates(M, N, self.indptr, self.indices, self.data)
1065
+
1066
+ self.prune() # nnz may have changed
1067
+ self.has_canonical_format = True
1068
+
1069
+ @property
1070
+ def has_sorted_indices(self) -> bool:
1071
+ """Whether the indices are sorted
1072
+
1073
+ Returns
1074
+ - True: if the indices of the array/matrix are in sorted order
1075
+ - False: otherwise
1076
+ """
1077
+ # first check to see if result was cached
1078
+ if not hasattr(self, '_has_sorted_indices'):
1079
+ M = len(self.indptr) - 1
1080
+ self._has_sorted_indices = bool(
1081
+ csr_has_sorted_indices(M, self.indptr, self.indices)
1082
+ )
1083
+ return self._has_sorted_indices
1084
+
1085
+ @has_sorted_indices.setter
1086
+ def has_sorted_indices(self, val: bool):
1087
+ self._has_sorted_indices = bool(val)
1088
+
1089
+
1090
+ def sorted_indices(self):
1091
+ """Return a copy of this array/matrix with sorted indices
1092
+ """
1093
+ A = self.copy()
1094
+ A.sort_indices()
1095
+ return A
1096
+
1097
+ # an alternative that has linear complexity is the following
1098
+ # although the previous option is typically faster
1099
+ # return self.toother().toother()
1100
+
1101
+ def sort_indices(self):
1102
+ """Sort the indices of this array/matrix *in place*
1103
+ """
1104
+ if not self.has_sorted_indices:
1105
+ M = len(self.indptr) - 1
1106
+ csr_sort_indices(M, self.indptr, self.indices, self.data)
1107
+ self.has_sorted_indices = True
1108
+
1109
+ def prune(self):
1110
+ """Remove empty space after all non-zero elements.
1111
+ """
1112
+ major_dim = self._swap(self._shape_as_2d)[0]
1113
+
1114
+ if len(self.indptr) != major_dim + 1:
1115
+ raise ValueError('index pointer has invalid length')
1116
+ if len(self.indices) < self.nnz:
1117
+ raise ValueError('indices array has fewer than nnz elements')
1118
+ if len(self.data) < self.nnz:
1119
+ raise ValueError('data array has fewer than nnz elements')
1120
+
1121
+ self.indices = _prune_array(self.indices[:self.nnz])
1122
+ self.data = _prune_array(self.data[:self.nnz])
1123
+
1124
+ def resize(self, *shape):
1125
+ shape = check_shape(shape, allow_nd=self._allow_nd)
1126
+
1127
+ if hasattr(self, 'blocksize'):
1128
+ bm, bn = self.blocksize
1129
+ new_M, rm = divmod(shape[0], bm)
1130
+ new_N, rn = divmod(shape[1], bn)
1131
+ if rm or rn:
1132
+ raise ValueError(f"shape must be divisible into {self.blocksize}"
1133
+ f" blocks. Got {shape}")
1134
+ M, N = self.shape[0] // bm, self.shape[1] // bn
1135
+ else:
1136
+ new_M, new_N = self._swap(shape if len(shape)>1 else (1, shape[0]))
1137
+ M, N = self._swap(self._shape_as_2d)
1138
+
1139
+ if new_M < M:
1140
+ self.indices = self.indices[:self.indptr[new_M]]
1141
+ self.data = self.data[:self.indptr[new_M]]
1142
+ self.indptr = self.indptr[:new_M + 1]
1143
+ elif new_M > M:
1144
+ self.indptr = np.resize(self.indptr, new_M + 1)
1145
+ self.indptr[M + 1:].fill(self.indptr[M])
1146
+
1147
+ if new_N < N:
1148
+ mask = self.indices < new_N
1149
+ if not np.all(mask):
1150
+ self.indices = self.indices[mask]
1151
+ self.data = self.data[mask]
1152
+ major_index, val = self._minor_reduce(np.add, mask)
1153
+ self.indptr.fill(0)
1154
+ self.indptr[1:][major_index] = val
1155
+ np.cumsum(self.indptr, out=self.indptr)
1156
+
1157
+ self._shape = shape
1158
+
1159
+ resize.__doc__ = _spbase.resize.__doc__
1160
+
1161
+ ###################
1162
+ # utility methods #
1163
+ ###################
1164
+
1165
+ # needed by _data_matrix
1166
+ def _with_data(self, data, copy=True):
1167
+ """Returns a matrix with the same sparsity structure as self,
1168
+ but with different data. By default the structure arrays
1169
+ (i.e. .indptr and .indices) are copied.
1170
+ """
1171
+ if copy:
1172
+ return self.__class__((data, self.indices.copy(),
1173
+ self.indptr.copy()),
1174
+ shape=self.shape,
1175
+ dtype=data.dtype)
1176
+ else:
1177
+ return self.__class__((data, self.indices, self.indptr),
1178
+ shape=self.shape, dtype=data.dtype)
1179
+
1180
+ def _binopt(self, other, op):
1181
+ """apply the binary operation fn to two sparse matrices."""
1182
+ other = self.__class__(other)
1183
+
1184
+ # e.g. csr_plus_csr, csr_minus_csr, etc.
1185
+ fn = getattr(_sparsetools, "csr" + op + "csr")
1186
+
1187
+ maxnnz = self.nnz + other.nnz
1188
+ idx_dtype = self._get_index_dtype((self.indptr, self.indices,
1189
+ other.indptr, other.indices),
1190
+ maxval=maxnnz)
1191
+ indptr = np.empty(self.indptr.shape, dtype=idx_dtype)
1192
+ indices = np.empty(maxnnz, dtype=idx_dtype)
1193
+
1194
+ bool_ops = ['_ne_', '_lt_', '_gt_', '_le_', '_ge_']
1195
+ if op in bool_ops:
1196
+ data = np.empty(maxnnz, dtype=np.bool_)
1197
+ else:
1198
+ data = np.empty(maxnnz, dtype=upcast(self.dtype, other.dtype))
1199
+
1200
+ M, N = self._swap(self._shape_as_2d)
1201
+ fn(M, N,
1202
+ np.asarray(self.indptr, dtype=idx_dtype),
1203
+ np.asarray(self.indices, dtype=idx_dtype),
1204
+ self.data,
1205
+ np.asarray(other.indptr, dtype=idx_dtype),
1206
+ np.asarray(other.indices, dtype=idx_dtype),
1207
+ other.data,
1208
+ indptr, indices, data)
1209
+
1210
+ A = self.__class__((data, indices, indptr), shape=self.shape)
1211
+ A.prune()
1212
+
1213
+ return A
1214
+
1215
+ def _divide_sparse(self, other):
1216
+ """
1217
+ Divide this matrix by a second sparse matrix.
1218
+ """
1219
+ if other.shape != self.shape:
1220
+ raise ValueError(f"inconsistent shapes {self.shape} and {other.shape}")
1221
+
1222
+ r = self._binopt(other, '_eldiv_')
1223
+
1224
+ if np.issubdtype(r.dtype, np.inexact):
1225
+ # Eldiv leaves entries outside the combined sparsity
1226
+ # pattern empty, so they must be filled manually.
1227
+ # Everything outside of other's sparsity is NaN, and everything
1228
+ # inside it is either zero or defined by eldiv.
1229
+ out = np.empty(self.shape, dtype=self.dtype)
1230
+ out.fill(np.nan)
1231
+ coords = other.nonzero()
1232
+ if self.ndim == 1:
1233
+ coords = (coords[-1],)
1234
+ out[coords] = 0
1235
+ r = r.tocoo()
1236
+ out[r.coords] = r.data
1237
+ return self._container(out)
1238
+ else:
1239
+ # integers types go with nan <-> 0
1240
+ out = r
1241
+ return out
1242
+
1243
+ def _broadcast_to(self, shape, copy=False):
1244
+ if self.shape == shape:
1245
+ return self.copy() if copy else self
1246
+
1247
+ shape = check_shape(shape, allow_nd=(self._allow_nd))
1248
+
1249
+ if broadcast_shapes(self.shape, shape) != shape:
1250
+ raise ValueError("cannot be broadcast")
1251
+
1252
+ if len(self.shape) == 1 and len(shape) == 1:
1253
+ self.sum_duplicates()
1254
+ if self.nnz == 0: # array has no non zero elements
1255
+ return self.__class__(shape, dtype=self.dtype, copy=False)
1256
+
1257
+ N = shape[0]
1258
+ data = np.full(N, self.data[0])
1259
+ indices = np.arange(0,N)
1260
+ indptr = np.array([0, N])
1261
+ return self._csr_container((data, indices, indptr), shape=shape, copy=False)
1262
+
1263
+ # treat 1D as a 2D row
1264
+ old_shape = self._shape_as_2d
1265
+
1266
+ if len(shape) != 2:
1267
+ ndim = len(shape)
1268
+ raise ValueError(f'CSR/CSC broadcast_to cannot have shape >2D. Got {ndim}D')
1269
+
1270
+ if self.nnz == 0: # array has no non zero elements
1271
+ return self.__class__(shape, dtype=self.dtype, copy=False)
1272
+
1273
+ self.sum_duplicates()
1274
+ M, N = self._swap(shape)
1275
+ oM, oN = self._swap(old_shape)
1276
+ if all(s == 1 for s in old_shape):
1277
+ # Broadcast a single element to the entire shape
1278
+ data = np.full(M * N, self.data[0])
1279
+ indices = np.tile(np.arange(N), M)
1280
+ indptr = np.arange(0, len(data) + 1, N)
1281
+ elif oM == 1 and oN == N:
1282
+ # Broadcast row-wise (columns for CSC)
1283
+ data = np.tile(self.data, M)
1284
+ indices = np.tile(self.indices, M)
1285
+ indptr = np.arange(0, len(data) + 1, len(self.data))
1286
+ elif oN == 1 and oM == M:
1287
+ # Broadcast column-wise (rows for CSC)
1288
+ data = np.repeat(self.data, N)
1289
+ indices = np.tile(np.arange(N), len(self.data))
1290
+ indptr = self.indptr * N
1291
+ return self.__class__((data, indices, indptr), shape=shape, copy=False)
1292
+
1293
+
1294
+ def _make_diagonal_csr(data, is_array=False):
1295
+ """build diagonal csc_array/csr_array => self._csr_container
1296
+
1297
+ Parameter `data` should be a raveled numpy array holding the
1298
+ values on the diagonal of the resulting sparse matrix.
1299
+ """
1300
+ from ._csr import csr_array, csr_matrix
1301
+ csr_array = csr_array if is_array else csr_matrix
1302
+
1303
+ N = len(data)
1304
+ idx_dtype = get_index_dtype(maxval=N)
1305
+ indptr = np.arange(N + 1, dtype=idx_dtype)
1306
+ indices = indptr[:-1]
1307
+
1308
+ return csr_array((data, indices, indptr), shape=(N, N))
1309
+
1310
+
1311
+ def _process_slice(sl, num):
1312
+ if sl is None:
1313
+ i0, i1 = 0, num
1314
+ elif isinstance(sl, slice):
1315
+ i0, i1, stride = sl.indices(num)
1316
+ if stride != 1:
1317
+ raise ValueError('slicing with step != 1 not supported')
1318
+ i0 = min(i0, i1) # give an empty slice when i0 > i1
1319
+ elif isintlike(sl):
1320
+ if sl < 0:
1321
+ sl += num
1322
+ i0, i1 = sl, sl + 1
1323
+ if i0 < 0 or i1 > num:
1324
+ raise IndexError(f'index out of bounds: 0 <= {i0} < {i1} <= {num}')
1325
+ else:
1326
+ raise TypeError('expected slice or scalar')
1327
+
1328
+ return i0, i1