scipy 1.16.2__cp311-cp311-win_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scipy/__config__.py +161 -0
- scipy/__init__.py +150 -0
- scipy/_cyutility.cp311-win_arm64.lib +0 -0
- scipy/_cyutility.cp311-win_arm64.pyd +0 -0
- scipy/_distributor_init.py +18 -0
- scipy/_lib/__init__.py +14 -0
- scipy/_lib/_array_api.py +931 -0
- scipy/_lib/_array_api_compat_vendor.py +9 -0
- scipy/_lib/_array_api_no_0d.py +103 -0
- scipy/_lib/_bunch.py +229 -0
- scipy/_lib/_ccallback.py +251 -0
- scipy/_lib/_ccallback_c.cp311-win_arm64.lib +0 -0
- scipy/_lib/_ccallback_c.cp311-win_arm64.pyd +0 -0
- scipy/_lib/_disjoint_set.py +254 -0
- scipy/_lib/_docscrape.py +761 -0
- scipy/_lib/_elementwise_iterative_method.py +346 -0
- scipy/_lib/_fpumode.cp311-win_arm64.lib +0 -0
- scipy/_lib/_fpumode.cp311-win_arm64.pyd +0 -0
- scipy/_lib/_gcutils.py +105 -0
- scipy/_lib/_pep440.py +487 -0
- scipy/_lib/_sparse.py +41 -0
- scipy/_lib/_test_ccallback.cp311-win_arm64.lib +0 -0
- scipy/_lib/_test_ccallback.cp311-win_arm64.pyd +0 -0
- scipy/_lib/_test_deprecation_call.cp311-win_arm64.lib +0 -0
- scipy/_lib/_test_deprecation_call.cp311-win_arm64.pyd +0 -0
- scipy/_lib/_test_deprecation_def.cp311-win_arm64.lib +0 -0
- scipy/_lib/_test_deprecation_def.cp311-win_arm64.pyd +0 -0
- scipy/_lib/_testutils.py +373 -0
- scipy/_lib/_threadsafety.py +58 -0
- scipy/_lib/_tmpdirs.py +86 -0
- scipy/_lib/_uarray/LICENSE +29 -0
- scipy/_lib/_uarray/__init__.py +116 -0
- scipy/_lib/_uarray/_backend.py +707 -0
- scipy/_lib/_uarray/_uarray.cp311-win_arm64.lib +0 -0
- scipy/_lib/_uarray/_uarray.cp311-win_arm64.pyd +0 -0
- scipy/_lib/_util.py +1283 -0
- scipy/_lib/array_api_compat/__init__.py +22 -0
- scipy/_lib/array_api_compat/_internal.py +59 -0
- scipy/_lib/array_api_compat/common/__init__.py +1 -0
- scipy/_lib/array_api_compat/common/_aliases.py +727 -0
- scipy/_lib/array_api_compat/common/_fft.py +213 -0
- scipy/_lib/array_api_compat/common/_helpers.py +1058 -0
- scipy/_lib/array_api_compat/common/_linalg.py +232 -0
- scipy/_lib/array_api_compat/common/_typing.py +192 -0
- scipy/_lib/array_api_compat/cupy/__init__.py +13 -0
- scipy/_lib/array_api_compat/cupy/_aliases.py +156 -0
- scipy/_lib/array_api_compat/cupy/_info.py +336 -0
- scipy/_lib/array_api_compat/cupy/_typing.py +31 -0
- scipy/_lib/array_api_compat/cupy/fft.py +36 -0
- scipy/_lib/array_api_compat/cupy/linalg.py +49 -0
- scipy/_lib/array_api_compat/dask/__init__.py +0 -0
- scipy/_lib/array_api_compat/dask/array/__init__.py +12 -0
- scipy/_lib/array_api_compat/dask/array/_aliases.py +376 -0
- scipy/_lib/array_api_compat/dask/array/_info.py +416 -0
- scipy/_lib/array_api_compat/dask/array/fft.py +21 -0
- scipy/_lib/array_api_compat/dask/array/linalg.py +72 -0
- scipy/_lib/array_api_compat/numpy/__init__.py +28 -0
- scipy/_lib/array_api_compat/numpy/_aliases.py +190 -0
- scipy/_lib/array_api_compat/numpy/_info.py +366 -0
- scipy/_lib/array_api_compat/numpy/_typing.py +30 -0
- scipy/_lib/array_api_compat/numpy/fft.py +35 -0
- scipy/_lib/array_api_compat/numpy/linalg.py +143 -0
- scipy/_lib/array_api_compat/torch/__init__.py +22 -0
- scipy/_lib/array_api_compat/torch/_aliases.py +855 -0
- scipy/_lib/array_api_compat/torch/_info.py +369 -0
- scipy/_lib/array_api_compat/torch/_typing.py +3 -0
- scipy/_lib/array_api_compat/torch/fft.py +85 -0
- scipy/_lib/array_api_compat/torch/linalg.py +121 -0
- scipy/_lib/array_api_extra/__init__.py +38 -0
- scipy/_lib/array_api_extra/_delegation.py +171 -0
- scipy/_lib/array_api_extra/_lib/__init__.py +1 -0
- scipy/_lib/array_api_extra/_lib/_at.py +463 -0
- scipy/_lib/array_api_extra/_lib/_backends.py +46 -0
- scipy/_lib/array_api_extra/_lib/_funcs.py +937 -0
- scipy/_lib/array_api_extra/_lib/_lazy.py +357 -0
- scipy/_lib/array_api_extra/_lib/_testing.py +278 -0
- scipy/_lib/array_api_extra/_lib/_utils/__init__.py +1 -0
- scipy/_lib/array_api_extra/_lib/_utils/_compat.py +74 -0
- scipy/_lib/array_api_extra/_lib/_utils/_compat.pyi +45 -0
- scipy/_lib/array_api_extra/_lib/_utils/_helpers.py +559 -0
- scipy/_lib/array_api_extra/_lib/_utils/_typing.py +10 -0
- scipy/_lib/array_api_extra/_lib/_utils/_typing.pyi +105 -0
- scipy/_lib/array_api_extra/testing.py +359 -0
- scipy/_lib/cobyqa/__init__.py +20 -0
- scipy/_lib/cobyqa/framework.py +1240 -0
- scipy/_lib/cobyqa/main.py +1506 -0
- scipy/_lib/cobyqa/models.py +1529 -0
- scipy/_lib/cobyqa/problem.py +1296 -0
- scipy/_lib/cobyqa/settings.py +132 -0
- scipy/_lib/cobyqa/subsolvers/__init__.py +14 -0
- scipy/_lib/cobyqa/subsolvers/geometry.py +387 -0
- scipy/_lib/cobyqa/subsolvers/optim.py +1203 -0
- scipy/_lib/cobyqa/utils/__init__.py +18 -0
- scipy/_lib/cobyqa/utils/exceptions.py +22 -0
- scipy/_lib/cobyqa/utils/math.py +77 -0
- scipy/_lib/cobyqa/utils/versions.py +67 -0
- scipy/_lib/decorator.py +399 -0
- scipy/_lib/deprecation.py +274 -0
- scipy/_lib/doccer.py +366 -0
- scipy/_lib/messagestream.cp311-win_arm64.lib +0 -0
- scipy/_lib/messagestream.cp311-win_arm64.pyd +0 -0
- scipy/_lib/pyprima/__init__.py +212 -0
- scipy/_lib/pyprima/cobyla/__init__.py +0 -0
- scipy/_lib/pyprima/cobyla/cobyla.py +559 -0
- scipy/_lib/pyprima/cobyla/cobylb.py +714 -0
- scipy/_lib/pyprima/cobyla/geometry.py +226 -0
- scipy/_lib/pyprima/cobyla/initialize.py +215 -0
- scipy/_lib/pyprima/cobyla/trustregion.py +492 -0
- scipy/_lib/pyprima/cobyla/update.py +289 -0
- scipy/_lib/pyprima/common/__init__.py +0 -0
- scipy/_lib/pyprima/common/_bounds.py +34 -0
- scipy/_lib/pyprima/common/_linear_constraints.py +46 -0
- scipy/_lib/pyprima/common/_nonlinear_constraints.py +54 -0
- scipy/_lib/pyprima/common/_project.py +173 -0
- scipy/_lib/pyprima/common/checkbreak.py +93 -0
- scipy/_lib/pyprima/common/consts.py +47 -0
- scipy/_lib/pyprima/common/evaluate.py +99 -0
- scipy/_lib/pyprima/common/history.py +38 -0
- scipy/_lib/pyprima/common/infos.py +30 -0
- scipy/_lib/pyprima/common/linalg.py +435 -0
- scipy/_lib/pyprima/common/message.py +290 -0
- scipy/_lib/pyprima/common/powalg.py +131 -0
- scipy/_lib/pyprima/common/preproc.py +277 -0
- scipy/_lib/pyprima/common/present.py +5 -0
- scipy/_lib/pyprima/common/ratio.py +54 -0
- scipy/_lib/pyprima/common/redrho.py +47 -0
- scipy/_lib/pyprima/common/selectx.py +296 -0
- scipy/_lib/tests/__init__.py +0 -0
- scipy/_lib/tests/test__gcutils.py +110 -0
- scipy/_lib/tests/test__pep440.py +67 -0
- scipy/_lib/tests/test__testutils.py +32 -0
- scipy/_lib/tests/test__threadsafety.py +51 -0
- scipy/_lib/tests/test__util.py +641 -0
- scipy/_lib/tests/test_array_api.py +322 -0
- scipy/_lib/tests/test_bunch.py +169 -0
- scipy/_lib/tests/test_ccallback.py +196 -0
- scipy/_lib/tests/test_config.py +45 -0
- scipy/_lib/tests/test_deprecation.py +10 -0
- scipy/_lib/tests/test_doccer.py +143 -0
- scipy/_lib/tests/test_import_cycles.py +18 -0
- scipy/_lib/tests/test_public_api.py +482 -0
- scipy/_lib/tests/test_scipy_version.py +28 -0
- scipy/_lib/tests/test_tmpdirs.py +48 -0
- scipy/_lib/tests/test_warnings.py +137 -0
- scipy/_lib/uarray.py +31 -0
- scipy/cluster/__init__.py +31 -0
- scipy/cluster/_hierarchy.cp311-win_arm64.lib +0 -0
- scipy/cluster/_hierarchy.cp311-win_arm64.pyd +0 -0
- scipy/cluster/_optimal_leaf_ordering.cp311-win_arm64.lib +0 -0
- scipy/cluster/_optimal_leaf_ordering.cp311-win_arm64.pyd +0 -0
- scipy/cluster/_vq.cp311-win_arm64.lib +0 -0
- scipy/cluster/_vq.cp311-win_arm64.pyd +0 -0
- scipy/cluster/hierarchy.py +4348 -0
- scipy/cluster/tests/__init__.py +0 -0
- scipy/cluster/tests/hierarchy_test_data.py +145 -0
- scipy/cluster/tests/test_disjoint_set.py +202 -0
- scipy/cluster/tests/test_hierarchy.py +1238 -0
- scipy/cluster/tests/test_vq.py +434 -0
- scipy/cluster/vq.py +832 -0
- scipy/conftest.py +683 -0
- scipy/constants/__init__.py +358 -0
- scipy/constants/_codata.py +2266 -0
- scipy/constants/_constants.py +369 -0
- scipy/constants/codata.py +21 -0
- scipy/constants/constants.py +53 -0
- scipy/constants/tests/__init__.py +0 -0
- scipy/constants/tests/test_codata.py +78 -0
- scipy/constants/tests/test_constants.py +83 -0
- scipy/datasets/__init__.py +90 -0
- scipy/datasets/_download_all.py +71 -0
- scipy/datasets/_fetchers.py +225 -0
- scipy/datasets/_registry.py +26 -0
- scipy/datasets/_utils.py +81 -0
- scipy/datasets/tests/__init__.py +0 -0
- scipy/datasets/tests/test_data.py +128 -0
- scipy/differentiate/__init__.py +27 -0
- scipy/differentiate/_differentiate.py +1129 -0
- scipy/differentiate/tests/__init__.py +0 -0
- scipy/differentiate/tests/test_differentiate.py +694 -0
- scipy/fft/__init__.py +114 -0
- scipy/fft/_backend.py +196 -0
- scipy/fft/_basic.py +1650 -0
- scipy/fft/_basic_backend.py +197 -0
- scipy/fft/_debug_backends.py +22 -0
- scipy/fft/_fftlog.py +223 -0
- scipy/fft/_fftlog_backend.py +200 -0
- scipy/fft/_helper.py +348 -0
- scipy/fft/_pocketfft/LICENSE.md +25 -0
- scipy/fft/_pocketfft/__init__.py +9 -0
- scipy/fft/_pocketfft/basic.py +251 -0
- scipy/fft/_pocketfft/helper.py +249 -0
- scipy/fft/_pocketfft/pypocketfft.cp311-win_arm64.lib +0 -0
- scipy/fft/_pocketfft/pypocketfft.cp311-win_arm64.pyd +0 -0
- scipy/fft/_pocketfft/realtransforms.py +109 -0
- scipy/fft/_pocketfft/tests/__init__.py +0 -0
- scipy/fft/_pocketfft/tests/test_basic.py +1011 -0
- scipy/fft/_pocketfft/tests/test_real_transforms.py +505 -0
- scipy/fft/_realtransforms.py +706 -0
- scipy/fft/_realtransforms_backend.py +63 -0
- scipy/fft/tests/__init__.py +0 -0
- scipy/fft/tests/mock_backend.py +96 -0
- scipy/fft/tests/test_backend.py +98 -0
- scipy/fft/tests/test_basic.py +504 -0
- scipy/fft/tests/test_fftlog.py +215 -0
- scipy/fft/tests/test_helper.py +558 -0
- scipy/fft/tests/test_multithreading.py +84 -0
- scipy/fft/tests/test_real_transforms.py +247 -0
- scipy/fftpack/__init__.py +103 -0
- scipy/fftpack/_basic.py +428 -0
- scipy/fftpack/_helper.py +115 -0
- scipy/fftpack/_pseudo_diffs.py +554 -0
- scipy/fftpack/_realtransforms.py +598 -0
- scipy/fftpack/basic.py +20 -0
- scipy/fftpack/convolve.cp311-win_arm64.lib +0 -0
- scipy/fftpack/convolve.cp311-win_arm64.pyd +0 -0
- scipy/fftpack/helper.py +19 -0
- scipy/fftpack/pseudo_diffs.py +22 -0
- scipy/fftpack/realtransforms.py +19 -0
- scipy/fftpack/tests/__init__.py +0 -0
- scipy/fftpack/tests/fftw_double_ref.npz +0 -0
- scipy/fftpack/tests/fftw_longdouble_ref.npz +0 -0
- scipy/fftpack/tests/fftw_single_ref.npz +0 -0
- scipy/fftpack/tests/test.npz +0 -0
- scipy/fftpack/tests/test_basic.py +877 -0
- scipy/fftpack/tests/test_helper.py +54 -0
- scipy/fftpack/tests/test_import.py +33 -0
- scipy/fftpack/tests/test_pseudo_diffs.py +388 -0
- scipy/fftpack/tests/test_real_transforms.py +836 -0
- scipy/integrate/__init__.py +122 -0
- scipy/integrate/_bvp.py +1160 -0
- scipy/integrate/_cubature.py +729 -0
- scipy/integrate/_dop.cp311-win_arm64.lib +0 -0
- scipy/integrate/_dop.cp311-win_arm64.pyd +0 -0
- scipy/integrate/_ivp/__init__.py +8 -0
- scipy/integrate/_ivp/base.py +290 -0
- scipy/integrate/_ivp/bdf.py +478 -0
- scipy/integrate/_ivp/common.py +451 -0
- scipy/integrate/_ivp/dop853_coefficients.py +193 -0
- scipy/integrate/_ivp/ivp.py +755 -0
- scipy/integrate/_ivp/lsoda.py +224 -0
- scipy/integrate/_ivp/radau.py +572 -0
- scipy/integrate/_ivp/rk.py +601 -0
- scipy/integrate/_ivp/tests/__init__.py +0 -0
- scipy/integrate/_ivp/tests/test_ivp.py +1287 -0
- scipy/integrate/_ivp/tests/test_rk.py +37 -0
- scipy/integrate/_lebedev.py +5450 -0
- scipy/integrate/_lsoda.cp311-win_arm64.lib +0 -0
- scipy/integrate/_lsoda.cp311-win_arm64.pyd +0 -0
- scipy/integrate/_ode.py +1395 -0
- scipy/integrate/_odepack.cp311-win_arm64.lib +0 -0
- scipy/integrate/_odepack.cp311-win_arm64.pyd +0 -0
- scipy/integrate/_odepack_py.py +273 -0
- scipy/integrate/_quad_vec.py +674 -0
- scipy/integrate/_quadpack.cp311-win_arm64.lib +0 -0
- scipy/integrate/_quadpack.cp311-win_arm64.pyd +0 -0
- scipy/integrate/_quadpack_py.py +1283 -0
- scipy/integrate/_quadrature.py +1336 -0
- scipy/integrate/_rules/__init__.py +12 -0
- scipy/integrate/_rules/_base.py +518 -0
- scipy/integrate/_rules/_gauss_kronrod.py +202 -0
- scipy/integrate/_rules/_gauss_legendre.py +62 -0
- scipy/integrate/_rules/_genz_malik.py +210 -0
- scipy/integrate/_tanhsinh.py +1385 -0
- scipy/integrate/_test_multivariate.cp311-win_arm64.lib +0 -0
- scipy/integrate/_test_multivariate.cp311-win_arm64.pyd +0 -0
- scipy/integrate/_test_odeint_banded.cp311-win_arm64.lib +0 -0
- scipy/integrate/_test_odeint_banded.cp311-win_arm64.pyd +0 -0
- scipy/integrate/_vode.cp311-win_arm64.lib +0 -0
- scipy/integrate/_vode.cp311-win_arm64.pyd +0 -0
- scipy/integrate/dop.py +15 -0
- scipy/integrate/lsoda.py +15 -0
- scipy/integrate/odepack.py +17 -0
- scipy/integrate/quadpack.py +23 -0
- scipy/integrate/tests/__init__.py +0 -0
- scipy/integrate/tests/test__quad_vec.py +211 -0
- scipy/integrate/tests/test_banded_ode_solvers.py +305 -0
- scipy/integrate/tests/test_bvp.py +714 -0
- scipy/integrate/tests/test_cubature.py +1375 -0
- scipy/integrate/tests/test_integrate.py +840 -0
- scipy/integrate/tests/test_odeint_jac.py +74 -0
- scipy/integrate/tests/test_quadpack.py +680 -0
- scipy/integrate/tests/test_quadrature.py +730 -0
- scipy/integrate/tests/test_tanhsinh.py +1171 -0
- scipy/integrate/vode.py +15 -0
- scipy/interpolate/__init__.py +228 -0
- scipy/interpolate/_bary_rational.py +715 -0
- scipy/interpolate/_bsplines.py +2469 -0
- scipy/interpolate/_cubic.py +973 -0
- scipy/interpolate/_dfitpack.cp311-win_arm64.lib +0 -0
- scipy/interpolate/_dfitpack.cp311-win_arm64.pyd +0 -0
- scipy/interpolate/_dierckx.cp311-win_arm64.lib +0 -0
- scipy/interpolate/_dierckx.cp311-win_arm64.pyd +0 -0
- scipy/interpolate/_fitpack.cp311-win_arm64.lib +0 -0
- scipy/interpolate/_fitpack.cp311-win_arm64.pyd +0 -0
- scipy/interpolate/_fitpack2.py +2397 -0
- scipy/interpolate/_fitpack_impl.py +811 -0
- scipy/interpolate/_fitpack_py.py +898 -0
- scipy/interpolate/_fitpack_repro.py +996 -0
- scipy/interpolate/_interpnd.cp311-win_arm64.lib +0 -0
- scipy/interpolate/_interpnd.cp311-win_arm64.pyd +0 -0
- scipy/interpolate/_interpolate.py +2266 -0
- scipy/interpolate/_ndbspline.py +415 -0
- scipy/interpolate/_ndgriddata.py +329 -0
- scipy/interpolate/_pade.py +67 -0
- scipy/interpolate/_polyint.py +1025 -0
- scipy/interpolate/_ppoly.cp311-win_arm64.lib +0 -0
- scipy/interpolate/_ppoly.cp311-win_arm64.pyd +0 -0
- scipy/interpolate/_rbf.py +290 -0
- scipy/interpolate/_rbfinterp.py +550 -0
- scipy/interpolate/_rbfinterp_pythran.cp311-win_arm64.lib +0 -0
- scipy/interpolate/_rbfinterp_pythran.cp311-win_arm64.pyd +0 -0
- scipy/interpolate/_rgi.py +764 -0
- scipy/interpolate/_rgi_cython.cp311-win_arm64.lib +0 -0
- scipy/interpolate/_rgi_cython.cp311-win_arm64.pyd +0 -0
- scipy/interpolate/dfitpack.py +24 -0
- scipy/interpolate/fitpack.py +31 -0
- scipy/interpolate/fitpack2.py +29 -0
- scipy/interpolate/interpnd.py +24 -0
- scipy/interpolate/interpolate.py +30 -0
- scipy/interpolate/ndgriddata.py +23 -0
- scipy/interpolate/polyint.py +24 -0
- scipy/interpolate/rbf.py +18 -0
- scipy/interpolate/tests/__init__.py +0 -0
- scipy/interpolate/tests/data/bug-1310.npz +0 -0
- scipy/interpolate/tests/data/estimate_gradients_hang.npy +0 -0
- scipy/interpolate/tests/data/gcvspl.npz +0 -0
- scipy/interpolate/tests/test_bary_rational.py +368 -0
- scipy/interpolate/tests/test_bsplines.py +3754 -0
- scipy/interpolate/tests/test_fitpack.py +519 -0
- scipy/interpolate/tests/test_fitpack2.py +1431 -0
- scipy/interpolate/tests/test_gil.py +64 -0
- scipy/interpolate/tests/test_interpnd.py +452 -0
- scipy/interpolate/tests/test_interpolate.py +2630 -0
- scipy/interpolate/tests/test_ndgriddata.py +308 -0
- scipy/interpolate/tests/test_pade.py +107 -0
- scipy/interpolate/tests/test_polyint.py +972 -0
- scipy/interpolate/tests/test_rbf.py +246 -0
- scipy/interpolate/tests/test_rbfinterp.py +534 -0
- scipy/interpolate/tests/test_rgi.py +1151 -0
- scipy/io/__init__.py +116 -0
- scipy/io/_fast_matrix_market/__init__.py +600 -0
- scipy/io/_fast_matrix_market/_fmm_core.cp311-win_arm64.lib +0 -0
- scipy/io/_fast_matrix_market/_fmm_core.cp311-win_arm64.pyd +0 -0
- scipy/io/_fortran.py +354 -0
- scipy/io/_harwell_boeing/__init__.py +7 -0
- scipy/io/_harwell_boeing/_fortran_format_parser.py +316 -0
- scipy/io/_harwell_boeing/hb.py +571 -0
- scipy/io/_harwell_boeing/tests/__init__.py +0 -0
- scipy/io/_harwell_boeing/tests/test_fortran_format.py +74 -0
- scipy/io/_harwell_boeing/tests/test_hb.py +70 -0
- scipy/io/_idl.py +917 -0
- scipy/io/_mmio.py +968 -0
- scipy/io/_netcdf.py +1104 -0
- scipy/io/_test_fortran.cp311-win_arm64.lib +0 -0
- scipy/io/_test_fortran.cp311-win_arm64.pyd +0 -0
- scipy/io/arff/__init__.py +28 -0
- scipy/io/arff/_arffread.py +873 -0
- scipy/io/arff/arffread.py +19 -0
- scipy/io/arff/tests/__init__.py +0 -0
- scipy/io/arff/tests/data/iris.arff +225 -0
- scipy/io/arff/tests/data/missing.arff +8 -0
- scipy/io/arff/tests/data/nodata.arff +11 -0
- scipy/io/arff/tests/data/quoted_nominal.arff +13 -0
- scipy/io/arff/tests/data/quoted_nominal_spaces.arff +13 -0
- scipy/io/arff/tests/data/test1.arff +10 -0
- scipy/io/arff/tests/data/test10.arff +8 -0
- scipy/io/arff/tests/data/test11.arff +11 -0
- scipy/io/arff/tests/data/test2.arff +15 -0
- scipy/io/arff/tests/data/test3.arff +6 -0
- scipy/io/arff/tests/data/test4.arff +11 -0
- scipy/io/arff/tests/data/test5.arff +26 -0
- scipy/io/arff/tests/data/test6.arff +12 -0
- scipy/io/arff/tests/data/test7.arff +15 -0
- scipy/io/arff/tests/data/test8.arff +12 -0
- scipy/io/arff/tests/data/test9.arff +14 -0
- scipy/io/arff/tests/test_arffread.py +421 -0
- scipy/io/harwell_boeing.py +17 -0
- scipy/io/idl.py +17 -0
- scipy/io/matlab/__init__.py +66 -0
- scipy/io/matlab/_byteordercodes.py +75 -0
- scipy/io/matlab/_mio.py +375 -0
- scipy/io/matlab/_mio4.py +632 -0
- scipy/io/matlab/_mio5.py +901 -0
- scipy/io/matlab/_mio5_params.py +281 -0
- scipy/io/matlab/_mio5_utils.cp311-win_arm64.lib +0 -0
- scipy/io/matlab/_mio5_utils.cp311-win_arm64.pyd +0 -0
- scipy/io/matlab/_mio_utils.cp311-win_arm64.lib +0 -0
- scipy/io/matlab/_mio_utils.cp311-win_arm64.pyd +0 -0
- scipy/io/matlab/_miobase.py +435 -0
- scipy/io/matlab/_streams.cp311-win_arm64.lib +0 -0
- scipy/io/matlab/_streams.cp311-win_arm64.pyd +0 -0
- scipy/io/matlab/byteordercodes.py +17 -0
- scipy/io/matlab/mio.py +16 -0
- scipy/io/matlab/mio4.py +17 -0
- scipy/io/matlab/mio5.py +19 -0
- scipy/io/matlab/mio5_params.py +18 -0
- scipy/io/matlab/mio5_utils.py +17 -0
- scipy/io/matlab/mio_utils.py +17 -0
- scipy/io/matlab/miobase.py +16 -0
- scipy/io/matlab/streams.py +16 -0
- scipy/io/matlab/tests/__init__.py +0 -0
- scipy/io/matlab/tests/data/bad_miuint32.mat +0 -0
- scipy/io/matlab/tests/data/bad_miutf8_array_name.mat +0 -0
- scipy/io/matlab/tests/data/big_endian.mat +0 -0
- scipy/io/matlab/tests/data/broken_utf8.mat +0 -0
- scipy/io/matlab/tests/data/corrupted_zlib_checksum.mat +0 -0
- scipy/io/matlab/tests/data/corrupted_zlib_data.mat +0 -0
- scipy/io/matlab/tests/data/debigged_m4.mat +0 -0
- scipy/io/matlab/tests/data/japanese_utf8.txt +5 -0
- scipy/io/matlab/tests/data/little_endian.mat +0 -0
- scipy/io/matlab/tests/data/logical_sparse.mat +0 -0
- scipy/io/matlab/tests/data/malformed1.mat +0 -0
- scipy/io/matlab/tests/data/miuint32_for_miint32.mat +0 -0
- scipy/io/matlab/tests/data/miutf8_array_name.mat +0 -0
- scipy/io/matlab/tests/data/nasty_duplicate_fieldnames.mat +0 -0
- scipy/io/matlab/tests/data/one_by_zero_char.mat +0 -0
- scipy/io/matlab/tests/data/parabola.mat +0 -0
- scipy/io/matlab/tests/data/single_empty_string.mat +0 -0
- scipy/io/matlab/tests/data/some_functions.mat +0 -0
- scipy/io/matlab/tests/data/sqr.mat +0 -0
- scipy/io/matlab/tests/data/test3dmatrix_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/test3dmatrix_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/test3dmatrix_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/test3dmatrix_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/test_empty_struct.mat +0 -0
- scipy/io/matlab/tests/data/test_mat4_le_floats.mat +0 -0
- scipy/io/matlab/tests/data/test_skip_variable.mat +0 -0
- scipy/io/matlab/tests/data/testbool_8_WIN64.mat +0 -0
- scipy/io/matlab/tests/data/testcell_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testcell_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testcell_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testcell_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testcellnest_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testcellnest_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testcellnest_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testcellnest_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testcomplex_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testcomplex_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testcomplex_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testcomplex_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testcomplex_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testdouble_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testdouble_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testdouble_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testdouble_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testdouble_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testemptycell_5.3_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testemptycell_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testemptycell_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testemptycell_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testfunc_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testhdf5_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testmatrix_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testmatrix_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testmatrix_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testmatrix_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testmatrix_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testminus_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testminus_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testminus_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testminus_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testminus_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testmulti_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testmulti_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testmulti_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testobject_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testobject_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testobject_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testobject_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testonechar_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testonechar_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testonechar_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testonechar_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testonechar_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testscalarcell_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testsimplecell.mat +0 -0
- scipy/io/matlab/tests/data/testsparse_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testsparse_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testsparse_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testsparse_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testsparse_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testsparsecomplex_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testsparsecomplex_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testsparsecomplex_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testsparsecomplex_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testsparsecomplex_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testsparsefloat_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststring_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/teststring_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/teststring_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststring_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststring_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststringarray_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/teststringarray_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/teststringarray_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststringarray_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststringarray_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststruct_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/teststruct_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststruct_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststruct_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststructarr_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/teststructarr_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststructarr_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststructarr_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststructnest_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/teststructnest_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststructnest_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststructnest_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testunicode_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testunicode_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testvec_4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/test_byteordercodes.py +29 -0
- scipy/io/matlab/tests/test_mio.py +1399 -0
- scipy/io/matlab/tests/test_mio5_utils.py +179 -0
- scipy/io/matlab/tests/test_mio_funcs.py +51 -0
- scipy/io/matlab/tests/test_mio_utils.py +45 -0
- scipy/io/matlab/tests/test_miobase.py +32 -0
- scipy/io/matlab/tests/test_pathological.py +33 -0
- scipy/io/matlab/tests/test_streams.py +241 -0
- scipy/io/mmio.py +17 -0
- scipy/io/netcdf.py +17 -0
- scipy/io/tests/__init__.py +0 -0
- scipy/io/tests/data/Transparent Busy.ani +0 -0
- scipy/io/tests/data/array_float32_1d.sav +0 -0
- scipy/io/tests/data/array_float32_2d.sav +0 -0
- scipy/io/tests/data/array_float32_3d.sav +0 -0
- scipy/io/tests/data/array_float32_4d.sav +0 -0
- scipy/io/tests/data/array_float32_5d.sav +0 -0
- scipy/io/tests/data/array_float32_6d.sav +0 -0
- scipy/io/tests/data/array_float32_7d.sav +0 -0
- scipy/io/tests/data/array_float32_8d.sav +0 -0
- scipy/io/tests/data/array_float32_pointer_1d.sav +0 -0
- scipy/io/tests/data/array_float32_pointer_2d.sav +0 -0
- scipy/io/tests/data/array_float32_pointer_3d.sav +0 -0
- scipy/io/tests/data/array_float32_pointer_4d.sav +0 -0
- scipy/io/tests/data/array_float32_pointer_5d.sav +0 -0
- scipy/io/tests/data/array_float32_pointer_6d.sav +0 -0
- scipy/io/tests/data/array_float32_pointer_7d.sav +0 -0
- scipy/io/tests/data/array_float32_pointer_8d.sav +0 -0
- scipy/io/tests/data/example_1.nc +0 -0
- scipy/io/tests/data/example_2.nc +0 -0
- scipy/io/tests/data/example_3_maskedvals.nc +0 -0
- scipy/io/tests/data/fortran-3x3d-2i.dat +0 -0
- scipy/io/tests/data/fortran-mixed.dat +0 -0
- scipy/io/tests/data/fortran-sf8-11x1x10.dat +0 -0
- scipy/io/tests/data/fortran-sf8-15x10x22.dat +0 -0
- scipy/io/tests/data/fortran-sf8-1x1x1.dat +0 -0
- scipy/io/tests/data/fortran-sf8-1x1x5.dat +0 -0
- scipy/io/tests/data/fortran-sf8-1x1x7.dat +0 -0
- scipy/io/tests/data/fortran-sf8-1x3x5.dat +0 -0
- scipy/io/tests/data/fortran-si4-11x1x10.dat +0 -0
- scipy/io/tests/data/fortran-si4-15x10x22.dat +0 -0
- scipy/io/tests/data/fortran-si4-1x1x1.dat +0 -0
- scipy/io/tests/data/fortran-si4-1x1x5.dat +0 -0
- scipy/io/tests/data/fortran-si4-1x1x7.dat +0 -0
- scipy/io/tests/data/fortran-si4-1x3x5.dat +0 -0
- scipy/io/tests/data/invalid_pointer.sav +0 -0
- scipy/io/tests/data/null_pointer.sav +0 -0
- scipy/io/tests/data/scalar_byte.sav +0 -0
- scipy/io/tests/data/scalar_byte_descr.sav +0 -0
- scipy/io/tests/data/scalar_complex32.sav +0 -0
- scipy/io/tests/data/scalar_complex64.sav +0 -0
- scipy/io/tests/data/scalar_float32.sav +0 -0
- scipy/io/tests/data/scalar_float64.sav +0 -0
- scipy/io/tests/data/scalar_heap_pointer.sav +0 -0
- scipy/io/tests/data/scalar_int16.sav +0 -0
- scipy/io/tests/data/scalar_int32.sav +0 -0
- scipy/io/tests/data/scalar_int64.sav +0 -0
- scipy/io/tests/data/scalar_string.sav +0 -0
- scipy/io/tests/data/scalar_uint16.sav +0 -0
- scipy/io/tests/data/scalar_uint32.sav +0 -0
- scipy/io/tests/data/scalar_uint64.sav +0 -0
- scipy/io/tests/data/struct_arrays.sav +0 -0
- scipy/io/tests/data/struct_arrays_byte_idl80.sav +0 -0
- scipy/io/tests/data/struct_arrays_replicated.sav +0 -0
- scipy/io/tests/data/struct_arrays_replicated_3d.sav +0 -0
- scipy/io/tests/data/struct_inherit.sav +0 -0
- scipy/io/tests/data/struct_pointer_arrays.sav +0 -0
- scipy/io/tests/data/struct_pointer_arrays_replicated.sav +0 -0
- scipy/io/tests/data/struct_pointer_arrays_replicated_3d.sav +0 -0
- scipy/io/tests/data/struct_pointers.sav +0 -0
- scipy/io/tests/data/struct_pointers_replicated.sav +0 -0
- scipy/io/tests/data/struct_pointers_replicated_3d.sav +0 -0
- scipy/io/tests/data/struct_scalars.sav +0 -0
- scipy/io/tests/data/struct_scalars_replicated.sav +0 -0
- scipy/io/tests/data/struct_scalars_replicated_3d.sav +0 -0
- scipy/io/tests/data/test-1234Hz-le-1ch-10S-20bit-extra.wav +0 -0
- scipy/io/tests/data/test-44100Hz-2ch-32bit-float-be.wav +0 -0
- scipy/io/tests/data/test-44100Hz-2ch-32bit-float-le.wav +0 -0
- scipy/io/tests/data/test-44100Hz-be-1ch-4bytes.wav +0 -0
- scipy/io/tests/data/test-44100Hz-le-1ch-4bytes-early-eof-no-data.wav +0 -0
- scipy/io/tests/data/test-44100Hz-le-1ch-4bytes-early-eof.wav +0 -0
- scipy/io/tests/data/test-44100Hz-le-1ch-4bytes-incomplete-chunk.wav +0 -0
- scipy/io/tests/data/test-44100Hz-le-1ch-4bytes-rf64.wav +0 -0
- scipy/io/tests/data/test-44100Hz-le-1ch-4bytes.wav +0 -0
- scipy/io/tests/data/test-48000Hz-2ch-64bit-float-le-wavex.wav +0 -0
- scipy/io/tests/data/test-8000Hz-be-3ch-5S-24bit.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-1ch-1byte-ulaw.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-2ch-1byteu.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-3ch-5S-24bit-inconsistent.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-3ch-5S-24bit-rf64.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-3ch-5S-24bit.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-3ch-5S-36bit.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-3ch-5S-45bit.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-3ch-5S-53bit.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-3ch-5S-64bit.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-4ch-9S-12bit.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-5ch-9S-5bit.wav +0 -0
- scipy/io/tests/data/various_compressed.sav +0 -0
- scipy/io/tests/test_fortran.py +264 -0
- scipy/io/tests/test_idl.py +483 -0
- scipy/io/tests/test_mmio.py +831 -0
- scipy/io/tests/test_netcdf.py +550 -0
- scipy/io/tests/test_paths.py +93 -0
- scipy/io/tests/test_wavfile.py +501 -0
- scipy/io/wavfile.py +938 -0
- scipy/linalg/__init__.pxd +1 -0
- scipy/linalg/__init__.py +236 -0
- scipy/linalg/_basic.py +2146 -0
- scipy/linalg/_blas_subroutines.h +164 -0
- scipy/linalg/_cythonized_array_utils.cp311-win_arm64.lib +0 -0
- scipy/linalg/_cythonized_array_utils.cp311-win_arm64.pyd +0 -0
- scipy/linalg/_cythonized_array_utils.pxd +40 -0
- scipy/linalg/_cythonized_array_utils.pyi +16 -0
- scipy/linalg/_decomp.py +1645 -0
- scipy/linalg/_decomp_cholesky.py +413 -0
- scipy/linalg/_decomp_cossin.py +236 -0
- scipy/linalg/_decomp_interpolative.cp311-win_arm64.lib +0 -0
- scipy/linalg/_decomp_interpolative.cp311-win_arm64.pyd +0 -0
- scipy/linalg/_decomp_ldl.py +356 -0
- scipy/linalg/_decomp_lu.py +401 -0
- scipy/linalg/_decomp_lu_cython.cp311-win_arm64.lib +0 -0
- scipy/linalg/_decomp_lu_cython.cp311-win_arm64.pyd +0 -0
- scipy/linalg/_decomp_lu_cython.pyi +6 -0
- scipy/linalg/_decomp_polar.py +113 -0
- scipy/linalg/_decomp_qr.py +494 -0
- scipy/linalg/_decomp_qz.py +452 -0
- scipy/linalg/_decomp_schur.py +336 -0
- scipy/linalg/_decomp_svd.py +545 -0
- scipy/linalg/_decomp_update.cp311-win_arm64.lib +0 -0
- scipy/linalg/_decomp_update.cp311-win_arm64.pyd +0 -0
- scipy/linalg/_expm_frechet.py +417 -0
- scipy/linalg/_fblas.cp311-win_arm64.lib +0 -0
- scipy/linalg/_fblas.cp311-win_arm64.pyd +0 -0
- scipy/linalg/_flapack.cp311-win_arm64.lib +0 -0
- scipy/linalg/_flapack.cp311-win_arm64.pyd +0 -0
- scipy/linalg/_lapack_subroutines.h +1521 -0
- scipy/linalg/_linalg_pythran.cp311-win_arm64.lib +0 -0
- scipy/linalg/_linalg_pythran.cp311-win_arm64.pyd +0 -0
- scipy/linalg/_matfuncs.py +1050 -0
- scipy/linalg/_matfuncs_expm.cp311-win_arm64.lib +0 -0
- scipy/linalg/_matfuncs_expm.cp311-win_arm64.pyd +0 -0
- scipy/linalg/_matfuncs_expm.pyi +6 -0
- scipy/linalg/_matfuncs_inv_ssq.py +886 -0
- scipy/linalg/_matfuncs_schur_sqrtm.cp311-win_arm64.lib +0 -0
- scipy/linalg/_matfuncs_schur_sqrtm.cp311-win_arm64.pyd +0 -0
- scipy/linalg/_matfuncs_sqrtm.py +107 -0
- scipy/linalg/_matfuncs_sqrtm_triu.cp311-win_arm64.lib +0 -0
- scipy/linalg/_matfuncs_sqrtm_triu.cp311-win_arm64.pyd +0 -0
- scipy/linalg/_misc.py +191 -0
- scipy/linalg/_procrustes.py +113 -0
- scipy/linalg/_sketches.py +189 -0
- scipy/linalg/_solve_toeplitz.cp311-win_arm64.lib +0 -0
- scipy/linalg/_solve_toeplitz.cp311-win_arm64.pyd +0 -0
- scipy/linalg/_solvers.py +862 -0
- scipy/linalg/_special_matrices.py +1322 -0
- scipy/linalg/_testutils.py +65 -0
- scipy/linalg/basic.py +23 -0
- scipy/linalg/blas.py +495 -0
- scipy/linalg/cython_blas.cp311-win_arm64.lib +0 -0
- scipy/linalg/cython_blas.cp311-win_arm64.pyd +0 -0
- scipy/linalg/cython_blas.pxd +169 -0
- scipy/linalg/cython_blas.pyx +1432 -0
- scipy/linalg/cython_lapack.cp311-win_arm64.lib +0 -0
- scipy/linalg/cython_lapack.cp311-win_arm64.pyd +0 -0
- scipy/linalg/cython_lapack.pxd +1528 -0
- scipy/linalg/cython_lapack.pyx +12045 -0
- scipy/linalg/decomp.py +23 -0
- scipy/linalg/decomp_cholesky.py +21 -0
- scipy/linalg/decomp_lu.py +21 -0
- scipy/linalg/decomp_qr.py +20 -0
- scipy/linalg/decomp_schur.py +21 -0
- scipy/linalg/decomp_svd.py +21 -0
- scipy/linalg/interpolative.py +989 -0
- scipy/linalg/lapack.py +1081 -0
- scipy/linalg/matfuncs.py +23 -0
- scipy/linalg/misc.py +21 -0
- scipy/linalg/special_matrices.py +22 -0
- scipy/linalg/tests/__init__.py +0 -0
- scipy/linalg/tests/_cython_examples/extending.pyx +23 -0
- scipy/linalg/tests/_cython_examples/meson.build +34 -0
- scipy/linalg/tests/data/carex_15_data.npz +0 -0
- scipy/linalg/tests/data/carex_18_data.npz +0 -0
- scipy/linalg/tests/data/carex_19_data.npz +0 -0
- scipy/linalg/tests/data/carex_20_data.npz +0 -0
- scipy/linalg/tests/data/carex_6_data.npz +0 -0
- scipy/linalg/tests/data/gendare_20170120_data.npz +0 -0
- scipy/linalg/tests/test_basic.py +2074 -0
- scipy/linalg/tests/test_batch.py +588 -0
- scipy/linalg/tests/test_blas.py +1127 -0
- scipy/linalg/tests/test_cython_blas.py +118 -0
- scipy/linalg/tests/test_cython_lapack.py +22 -0
- scipy/linalg/tests/test_cythonized_array_utils.py +130 -0
- scipy/linalg/tests/test_decomp.py +3189 -0
- scipy/linalg/tests/test_decomp_cholesky.py +268 -0
- scipy/linalg/tests/test_decomp_cossin.py +314 -0
- scipy/linalg/tests/test_decomp_ldl.py +137 -0
- scipy/linalg/tests/test_decomp_lu.py +308 -0
- scipy/linalg/tests/test_decomp_polar.py +110 -0
- scipy/linalg/tests/test_decomp_update.py +1701 -0
- scipy/linalg/tests/test_extending.py +46 -0
- scipy/linalg/tests/test_fblas.py +607 -0
- scipy/linalg/tests/test_interpolative.py +232 -0
- scipy/linalg/tests/test_lapack.py +3620 -0
- scipy/linalg/tests/test_matfuncs.py +1125 -0
- scipy/linalg/tests/test_matmul_toeplitz.py +136 -0
- scipy/linalg/tests/test_procrustes.py +214 -0
- scipy/linalg/tests/test_sketches.py +118 -0
- scipy/linalg/tests/test_solve_toeplitz.py +150 -0
- scipy/linalg/tests/test_solvers.py +844 -0
- scipy/linalg/tests/test_special_matrices.py +636 -0
- scipy/misc/__init__.py +6 -0
- scipy/misc/common.py +6 -0
- scipy/misc/doccer.py +6 -0
- scipy/ndimage/__init__.py +174 -0
- scipy/ndimage/_ctest.cp311-win_arm64.lib +0 -0
- scipy/ndimage/_ctest.cp311-win_arm64.pyd +0 -0
- scipy/ndimage/_cytest.cp311-win_arm64.lib +0 -0
- scipy/ndimage/_cytest.cp311-win_arm64.pyd +0 -0
- scipy/ndimage/_delegators.py +303 -0
- scipy/ndimage/_filters.py +2422 -0
- scipy/ndimage/_fourier.py +306 -0
- scipy/ndimage/_interpolation.py +1033 -0
- scipy/ndimage/_measurements.py +1689 -0
- scipy/ndimage/_morphology.py +2634 -0
- scipy/ndimage/_nd_image.cp311-win_arm64.lib +0 -0
- scipy/ndimage/_nd_image.cp311-win_arm64.pyd +0 -0
- scipy/ndimage/_ndimage_api.py +16 -0
- scipy/ndimage/_ni_docstrings.py +214 -0
- scipy/ndimage/_ni_label.cp311-win_arm64.lib +0 -0
- scipy/ndimage/_ni_label.cp311-win_arm64.pyd +0 -0
- scipy/ndimage/_ni_support.py +139 -0
- scipy/ndimage/_rank_filter_1d.cp311-win_arm64.lib +0 -0
- scipy/ndimage/_rank_filter_1d.cp311-win_arm64.pyd +0 -0
- scipy/ndimage/_support_alternative_backends.py +84 -0
- scipy/ndimage/filters.py +27 -0
- scipy/ndimage/fourier.py +21 -0
- scipy/ndimage/interpolation.py +22 -0
- scipy/ndimage/measurements.py +24 -0
- scipy/ndimage/morphology.py +27 -0
- scipy/ndimage/tests/__init__.py +12 -0
- scipy/ndimage/tests/data/label_inputs.txt +21 -0
- scipy/ndimage/tests/data/label_results.txt +294 -0
- scipy/ndimage/tests/data/label_strels.txt +42 -0
- scipy/ndimage/tests/dots.png +0 -0
- scipy/ndimage/tests/test_c_api.py +102 -0
- scipy/ndimage/tests/test_datatypes.py +67 -0
- scipy/ndimage/tests/test_filters.py +3083 -0
- scipy/ndimage/tests/test_fourier.py +187 -0
- scipy/ndimage/tests/test_interpolation.py +1491 -0
- scipy/ndimage/tests/test_measurements.py +1592 -0
- scipy/ndimage/tests/test_morphology.py +2950 -0
- scipy/ndimage/tests/test_ni_support.py +78 -0
- scipy/ndimage/tests/test_splines.py +70 -0
- scipy/odr/__init__.py +131 -0
- scipy/odr/__odrpack.cp311-win_arm64.lib +0 -0
- scipy/odr/__odrpack.cp311-win_arm64.pyd +0 -0
- scipy/odr/_add_newdocs.py +34 -0
- scipy/odr/_models.py +315 -0
- scipy/odr/_odrpack.py +1154 -0
- scipy/odr/models.py +20 -0
- scipy/odr/odrpack.py +21 -0
- scipy/odr/tests/__init__.py +0 -0
- scipy/odr/tests/test_odr.py +607 -0
- scipy/optimize/__init__.pxd +1 -0
- scipy/optimize/__init__.py +460 -0
- scipy/optimize/_basinhopping.py +741 -0
- scipy/optimize/_bglu_dense.cp311-win_arm64.lib +0 -0
- scipy/optimize/_bglu_dense.cp311-win_arm64.pyd +0 -0
- scipy/optimize/_bracket.py +706 -0
- scipy/optimize/_chandrupatla.py +551 -0
- scipy/optimize/_cobyla_py.py +297 -0
- scipy/optimize/_cobyqa_py.py +72 -0
- scipy/optimize/_constraints.py +598 -0
- scipy/optimize/_dcsrch.py +728 -0
- scipy/optimize/_differentiable_functions.py +835 -0
- scipy/optimize/_differentialevolution.py +1970 -0
- scipy/optimize/_direct.cp311-win_arm64.lib +0 -0
- scipy/optimize/_direct.cp311-win_arm64.pyd +0 -0
- scipy/optimize/_direct_py.py +280 -0
- scipy/optimize/_dual_annealing.py +732 -0
- scipy/optimize/_elementwise.py +798 -0
- scipy/optimize/_group_columns.cp311-win_arm64.lib +0 -0
- scipy/optimize/_group_columns.cp311-win_arm64.pyd +0 -0
- scipy/optimize/_hessian_update_strategy.py +479 -0
- scipy/optimize/_highspy/__init__.py +0 -0
- scipy/optimize/_highspy/_core.cp311-win_arm64.lib +0 -0
- scipy/optimize/_highspy/_core.cp311-win_arm64.pyd +0 -0
- scipy/optimize/_highspy/_highs_options.cp311-win_arm64.lib +0 -0
- scipy/optimize/_highspy/_highs_options.cp311-win_arm64.pyd +0 -0
- scipy/optimize/_highspy/_highs_wrapper.py +338 -0
- scipy/optimize/_isotonic.py +157 -0
- scipy/optimize/_lbfgsb.cp311-win_arm64.lib +0 -0
- scipy/optimize/_lbfgsb.cp311-win_arm64.pyd +0 -0
- scipy/optimize/_lbfgsb_py.py +634 -0
- scipy/optimize/_linesearch.py +896 -0
- scipy/optimize/_linprog.py +733 -0
- scipy/optimize/_linprog_doc.py +1434 -0
- scipy/optimize/_linprog_highs.py +422 -0
- scipy/optimize/_linprog_ip.py +1141 -0
- scipy/optimize/_linprog_rs.py +572 -0
- scipy/optimize/_linprog_simplex.py +663 -0
- scipy/optimize/_linprog_util.py +1521 -0
- scipy/optimize/_lsap.cp311-win_arm64.lib +0 -0
- scipy/optimize/_lsap.cp311-win_arm64.pyd +0 -0
- scipy/optimize/_lsq/__init__.py +5 -0
- scipy/optimize/_lsq/bvls.py +183 -0
- scipy/optimize/_lsq/common.py +731 -0
- scipy/optimize/_lsq/dogbox.py +345 -0
- scipy/optimize/_lsq/givens_elimination.cp311-win_arm64.lib +0 -0
- scipy/optimize/_lsq/givens_elimination.cp311-win_arm64.pyd +0 -0
- scipy/optimize/_lsq/least_squares.py +1044 -0
- scipy/optimize/_lsq/lsq_linear.py +361 -0
- scipy/optimize/_lsq/trf.py +587 -0
- scipy/optimize/_lsq/trf_linear.py +249 -0
- scipy/optimize/_milp.py +394 -0
- scipy/optimize/_minimize.py +1199 -0
- scipy/optimize/_minpack.cp311-win_arm64.lib +0 -0
- scipy/optimize/_minpack.cp311-win_arm64.pyd +0 -0
- scipy/optimize/_minpack_py.py +1178 -0
- scipy/optimize/_moduleTNC.cp311-win_arm64.lib +0 -0
- scipy/optimize/_moduleTNC.cp311-win_arm64.pyd +0 -0
- scipy/optimize/_nnls.py +96 -0
- scipy/optimize/_nonlin.py +1634 -0
- scipy/optimize/_numdiff.py +963 -0
- scipy/optimize/_optimize.py +4169 -0
- scipy/optimize/_pava_pybind.cp311-win_arm64.lib +0 -0
- scipy/optimize/_pava_pybind.cp311-win_arm64.pyd +0 -0
- scipy/optimize/_qap.py +760 -0
- scipy/optimize/_remove_redundancy.py +522 -0
- scipy/optimize/_root.py +732 -0
- scipy/optimize/_root_scalar.py +538 -0
- scipy/optimize/_shgo.py +1606 -0
- scipy/optimize/_shgo_lib/__init__.py +0 -0
- scipy/optimize/_shgo_lib/_complex.py +1225 -0
- scipy/optimize/_shgo_lib/_vertex.py +460 -0
- scipy/optimize/_slsqp_py.py +603 -0
- scipy/optimize/_slsqplib.cp311-win_arm64.lib +0 -0
- scipy/optimize/_slsqplib.cp311-win_arm64.pyd +0 -0
- scipy/optimize/_spectral.py +260 -0
- scipy/optimize/_tnc.py +438 -0
- scipy/optimize/_trlib/__init__.py +12 -0
- scipy/optimize/_trlib/_trlib.cp311-win_arm64.lib +0 -0
- scipy/optimize/_trlib/_trlib.cp311-win_arm64.pyd +0 -0
- scipy/optimize/_trustregion.py +318 -0
- scipy/optimize/_trustregion_constr/__init__.py +6 -0
- scipy/optimize/_trustregion_constr/canonical_constraint.py +390 -0
- scipy/optimize/_trustregion_constr/equality_constrained_sqp.py +231 -0
- scipy/optimize/_trustregion_constr/minimize_trustregion_constr.py +584 -0
- scipy/optimize/_trustregion_constr/projections.py +411 -0
- scipy/optimize/_trustregion_constr/qp_subproblem.py +637 -0
- scipy/optimize/_trustregion_constr/report.py +49 -0
- scipy/optimize/_trustregion_constr/tests/__init__.py +0 -0
- scipy/optimize/_trustregion_constr/tests/test_canonical_constraint.py +296 -0
- scipy/optimize/_trustregion_constr/tests/test_nested_minimize.py +39 -0
- scipy/optimize/_trustregion_constr/tests/test_projections.py +214 -0
- scipy/optimize/_trustregion_constr/tests/test_qp_subproblem.py +645 -0
- scipy/optimize/_trustregion_constr/tests/test_report.py +34 -0
- scipy/optimize/_trustregion_constr/tr_interior_point.py +361 -0
- scipy/optimize/_trustregion_dogleg.py +122 -0
- scipy/optimize/_trustregion_exact.py +437 -0
- scipy/optimize/_trustregion_krylov.py +65 -0
- scipy/optimize/_trustregion_ncg.py +126 -0
- scipy/optimize/_tstutils.py +972 -0
- scipy/optimize/_zeros.cp311-win_arm64.lib +0 -0
- scipy/optimize/_zeros.cp311-win_arm64.pyd +0 -0
- scipy/optimize/_zeros_py.py +1475 -0
- scipy/optimize/cobyla.py +19 -0
- scipy/optimize/cython_optimize/__init__.py +133 -0
- scipy/optimize/cython_optimize/_zeros.cp311-win_arm64.lib +0 -0
- scipy/optimize/cython_optimize/_zeros.cp311-win_arm64.pyd +0 -0
- scipy/optimize/cython_optimize/_zeros.pxd +33 -0
- scipy/optimize/cython_optimize/c_zeros.pxd +26 -0
- scipy/optimize/cython_optimize.pxd +11 -0
- scipy/optimize/elementwise.py +38 -0
- scipy/optimize/lbfgsb.py +23 -0
- scipy/optimize/linesearch.py +18 -0
- scipy/optimize/minpack.py +27 -0
- scipy/optimize/minpack2.py +17 -0
- scipy/optimize/moduleTNC.py +19 -0
- scipy/optimize/nonlin.py +29 -0
- scipy/optimize/optimize.py +40 -0
- scipy/optimize/slsqp.py +22 -0
- scipy/optimize/tests/__init__.py +0 -0
- scipy/optimize/tests/_cython_examples/extending.pyx +43 -0
- scipy/optimize/tests/_cython_examples/meson.build +32 -0
- scipy/optimize/tests/test__basinhopping.py +535 -0
- scipy/optimize/tests/test__differential_evolution.py +1703 -0
- scipy/optimize/tests/test__dual_annealing.py +416 -0
- scipy/optimize/tests/test__linprog_clean_inputs.py +312 -0
- scipy/optimize/tests/test__numdiff.py +885 -0
- scipy/optimize/tests/test__remove_redundancy.py +228 -0
- scipy/optimize/tests/test__root.py +124 -0
- scipy/optimize/tests/test__shgo.py +1164 -0
- scipy/optimize/tests/test__spectral.py +226 -0
- scipy/optimize/tests/test_bracket.py +896 -0
- scipy/optimize/tests/test_chandrupatla.py +982 -0
- scipy/optimize/tests/test_cobyla.py +195 -0
- scipy/optimize/tests/test_cobyqa.py +252 -0
- scipy/optimize/tests/test_constraint_conversion.py +286 -0
- scipy/optimize/tests/test_constraints.py +255 -0
- scipy/optimize/tests/test_cython_optimize.py +92 -0
- scipy/optimize/tests/test_differentiable_functions.py +1025 -0
- scipy/optimize/tests/test_direct.py +321 -0
- scipy/optimize/tests/test_extending.py +28 -0
- scipy/optimize/tests/test_hessian_update_strategy.py +300 -0
- scipy/optimize/tests/test_isotonic_regression.py +167 -0
- scipy/optimize/tests/test_lbfgsb_hessinv.py +65 -0
- scipy/optimize/tests/test_lbfgsb_setulb.py +122 -0
- scipy/optimize/tests/test_least_squares.py +986 -0
- scipy/optimize/tests/test_linear_assignment.py +116 -0
- scipy/optimize/tests/test_linesearch.py +328 -0
- scipy/optimize/tests/test_linprog.py +2577 -0
- scipy/optimize/tests/test_lsq_common.py +297 -0
- scipy/optimize/tests/test_lsq_linear.py +287 -0
- scipy/optimize/tests/test_milp.py +459 -0
- scipy/optimize/tests/test_minimize_constrained.py +845 -0
- scipy/optimize/tests/test_minpack.py +1194 -0
- scipy/optimize/tests/test_nnls.py +469 -0
- scipy/optimize/tests/test_nonlin.py +572 -0
- scipy/optimize/tests/test_optimize.py +3344 -0
- scipy/optimize/tests/test_quadratic_assignment.py +455 -0
- scipy/optimize/tests/test_regression.py +40 -0
- scipy/optimize/tests/test_slsqp.py +645 -0
- scipy/optimize/tests/test_tnc.py +345 -0
- scipy/optimize/tests/test_trustregion.py +110 -0
- scipy/optimize/tests/test_trustregion_exact.py +351 -0
- scipy/optimize/tests/test_trustregion_krylov.py +170 -0
- scipy/optimize/tests/test_zeros.py +998 -0
- scipy/optimize/tnc.py +22 -0
- scipy/optimize/zeros.py +26 -0
- scipy/signal/__init__.py +316 -0
- scipy/signal/_arraytools.py +264 -0
- scipy/signal/_czt.py +575 -0
- scipy/signal/_delegators.py +568 -0
- scipy/signal/_filter_design.py +5893 -0
- scipy/signal/_fir_filter_design.py +1458 -0
- scipy/signal/_lti_conversion.py +534 -0
- scipy/signal/_ltisys.py +3546 -0
- scipy/signal/_max_len_seq.py +139 -0
- scipy/signal/_max_len_seq_inner.cp311-win_arm64.lib +0 -0
- scipy/signal/_max_len_seq_inner.cp311-win_arm64.pyd +0 -0
- scipy/signal/_peak_finding.py +1310 -0
- scipy/signal/_peak_finding_utils.cp311-win_arm64.lib +0 -0
- scipy/signal/_peak_finding_utils.cp311-win_arm64.pyd +0 -0
- scipy/signal/_polyutils.py +172 -0
- scipy/signal/_savitzky_golay.py +357 -0
- scipy/signal/_short_time_fft.py +2228 -0
- scipy/signal/_signal_api.py +30 -0
- scipy/signal/_signaltools.py +5309 -0
- scipy/signal/_sigtools.cp311-win_arm64.lib +0 -0
- scipy/signal/_sigtools.cp311-win_arm64.pyd +0 -0
- scipy/signal/_sosfilt.cp311-win_arm64.lib +0 -0
- scipy/signal/_sosfilt.cp311-win_arm64.pyd +0 -0
- scipy/signal/_spectral_py.py +2471 -0
- scipy/signal/_spline.cp311-win_arm64.lib +0 -0
- scipy/signal/_spline.cp311-win_arm64.pyd +0 -0
- scipy/signal/_spline.pyi +34 -0
- scipy/signal/_spline_filters.py +848 -0
- scipy/signal/_support_alternative_backends.py +73 -0
- scipy/signal/_upfirdn.py +219 -0
- scipy/signal/_upfirdn_apply.cp311-win_arm64.lib +0 -0
- scipy/signal/_upfirdn_apply.cp311-win_arm64.pyd +0 -0
- scipy/signal/_waveforms.py +687 -0
- scipy/signal/_wavelets.py +29 -0
- scipy/signal/bsplines.py +21 -0
- scipy/signal/filter_design.py +28 -0
- scipy/signal/fir_filter_design.py +21 -0
- scipy/signal/lti_conversion.py +20 -0
- scipy/signal/ltisys.py +25 -0
- scipy/signal/signaltools.py +27 -0
- scipy/signal/spectral.py +21 -0
- scipy/signal/spline.py +18 -0
- scipy/signal/tests/__init__.py +0 -0
- scipy/signal/tests/_scipy_spectral_test_shim.py +311 -0
- scipy/signal/tests/mpsig.py +122 -0
- scipy/signal/tests/test_array_tools.py +111 -0
- scipy/signal/tests/test_bsplines.py +365 -0
- scipy/signal/tests/test_cont2discrete.py +424 -0
- scipy/signal/tests/test_czt.py +221 -0
- scipy/signal/tests/test_dltisys.py +599 -0
- scipy/signal/tests/test_filter_design.py +4744 -0
- scipy/signal/tests/test_fir_filter_design.py +851 -0
- scipy/signal/tests/test_ltisys.py +1225 -0
- scipy/signal/tests/test_max_len_seq.py +71 -0
- scipy/signal/tests/test_peak_finding.py +915 -0
- scipy/signal/tests/test_result_type.py +51 -0
- scipy/signal/tests/test_savitzky_golay.py +363 -0
- scipy/signal/tests/test_short_time_fft.py +1107 -0
- scipy/signal/tests/test_signaltools.py +4735 -0
- scipy/signal/tests/test_spectral.py +2141 -0
- scipy/signal/tests/test_splines.py +427 -0
- scipy/signal/tests/test_upfirdn.py +322 -0
- scipy/signal/tests/test_waveforms.py +400 -0
- scipy/signal/tests/test_wavelets.py +59 -0
- scipy/signal/tests/test_windows.py +987 -0
- scipy/signal/waveforms.py +20 -0
- scipy/signal/wavelets.py +17 -0
- scipy/signal/windows/__init__.py +52 -0
- scipy/signal/windows/_windows.py +2513 -0
- scipy/signal/windows/windows.py +23 -0
- scipy/sparse/__init__.py +350 -0
- scipy/sparse/_base.py +1613 -0
- scipy/sparse/_bsr.py +880 -0
- scipy/sparse/_compressed.py +1328 -0
- scipy/sparse/_construct.py +1454 -0
- scipy/sparse/_coo.py +1581 -0
- scipy/sparse/_csc.py +367 -0
- scipy/sparse/_csparsetools.cp311-win_arm64.lib +0 -0
- scipy/sparse/_csparsetools.cp311-win_arm64.pyd +0 -0
- scipy/sparse/_csr.py +558 -0
- scipy/sparse/_data.py +569 -0
- scipy/sparse/_dia.py +677 -0
- scipy/sparse/_dok.py +669 -0
- scipy/sparse/_extract.py +178 -0
- scipy/sparse/_index.py +444 -0
- scipy/sparse/_lil.py +632 -0
- scipy/sparse/_matrix.py +169 -0
- scipy/sparse/_matrix_io.py +167 -0
- scipy/sparse/_sparsetools.cp311-win_arm64.lib +0 -0
- scipy/sparse/_sparsetools.cp311-win_arm64.pyd +0 -0
- scipy/sparse/_spfuncs.py +76 -0
- scipy/sparse/_sputils.py +632 -0
- scipy/sparse/base.py +24 -0
- scipy/sparse/bsr.py +22 -0
- scipy/sparse/compressed.py +20 -0
- scipy/sparse/construct.py +38 -0
- scipy/sparse/coo.py +23 -0
- scipy/sparse/csc.py +22 -0
- scipy/sparse/csgraph/__init__.py +210 -0
- scipy/sparse/csgraph/_flow.cp311-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_flow.cp311-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_laplacian.py +563 -0
- scipy/sparse/csgraph/_matching.cp311-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_matching.cp311-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_min_spanning_tree.cp311-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_min_spanning_tree.cp311-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_reordering.cp311-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_reordering.cp311-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_shortest_path.cp311-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_shortest_path.cp311-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_tools.cp311-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_tools.cp311-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_traversal.cp311-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_traversal.cp311-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_validation.py +66 -0
- scipy/sparse/csgraph/tests/__init__.py +0 -0
- scipy/sparse/csgraph/tests/test_connected_components.py +119 -0
- scipy/sparse/csgraph/tests/test_conversions.py +61 -0
- scipy/sparse/csgraph/tests/test_flow.py +209 -0
- scipy/sparse/csgraph/tests/test_graph_laplacian.py +368 -0
- scipy/sparse/csgraph/tests/test_matching.py +307 -0
- scipy/sparse/csgraph/tests/test_pydata_sparse.py +197 -0
- scipy/sparse/csgraph/tests/test_reordering.py +70 -0
- scipy/sparse/csgraph/tests/test_shortest_path.py +540 -0
- scipy/sparse/csgraph/tests/test_spanning_tree.py +66 -0
- scipy/sparse/csgraph/tests/test_traversal.py +148 -0
- scipy/sparse/csr.py +22 -0
- scipy/sparse/data.py +18 -0
- scipy/sparse/dia.py +22 -0
- scipy/sparse/dok.py +22 -0
- scipy/sparse/extract.py +23 -0
- scipy/sparse/lil.py +22 -0
- scipy/sparse/linalg/__init__.py +148 -0
- scipy/sparse/linalg/_dsolve/__init__.py +71 -0
- scipy/sparse/linalg/_dsolve/_add_newdocs.py +147 -0
- scipy/sparse/linalg/_dsolve/_superlu.cp311-win_arm64.lib +0 -0
- scipy/sparse/linalg/_dsolve/_superlu.cp311-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_dsolve/linsolve.py +882 -0
- scipy/sparse/linalg/_dsolve/tests/__init__.py +0 -0
- scipy/sparse/linalg/_dsolve/tests/test_linsolve.py +928 -0
- scipy/sparse/linalg/_eigen/__init__.py +22 -0
- scipy/sparse/linalg/_eigen/_svds.py +540 -0
- scipy/sparse/linalg/_eigen/_svds_doc.py +382 -0
- scipy/sparse/linalg/_eigen/arpack/COPYING +45 -0
- scipy/sparse/linalg/_eigen/arpack/__init__.py +20 -0
- scipy/sparse/linalg/_eigen/arpack/_arpack.cp311-win_arm64.lib +0 -0
- scipy/sparse/linalg/_eigen/arpack/_arpack.cp311-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_eigen/arpack/arpack.py +1706 -0
- scipy/sparse/linalg/_eigen/arpack/tests/__init__.py +0 -0
- scipy/sparse/linalg/_eigen/arpack/tests/test_arpack.py +717 -0
- scipy/sparse/linalg/_eigen/lobpcg/__init__.py +16 -0
- scipy/sparse/linalg/_eigen/lobpcg/lobpcg.py +1110 -0
- scipy/sparse/linalg/_eigen/lobpcg/tests/__init__.py +0 -0
- scipy/sparse/linalg/_eigen/lobpcg/tests/test_lobpcg.py +725 -0
- scipy/sparse/linalg/_eigen/tests/__init__.py +0 -0
- scipy/sparse/linalg/_eigen/tests/test_svds.py +886 -0
- scipy/sparse/linalg/_expm_multiply.py +816 -0
- scipy/sparse/linalg/_interface.py +920 -0
- scipy/sparse/linalg/_isolve/__init__.py +20 -0
- scipy/sparse/linalg/_isolve/_gcrotmk.py +503 -0
- scipy/sparse/linalg/_isolve/iterative.py +1051 -0
- scipy/sparse/linalg/_isolve/lgmres.py +230 -0
- scipy/sparse/linalg/_isolve/lsmr.py +486 -0
- scipy/sparse/linalg/_isolve/lsqr.py +589 -0
- scipy/sparse/linalg/_isolve/minres.py +372 -0
- scipy/sparse/linalg/_isolve/tests/__init__.py +0 -0
- scipy/sparse/linalg/_isolve/tests/test_gcrotmk.py +183 -0
- scipy/sparse/linalg/_isolve/tests/test_iterative.py +809 -0
- scipy/sparse/linalg/_isolve/tests/test_lgmres.py +225 -0
- scipy/sparse/linalg/_isolve/tests/test_lsmr.py +185 -0
- scipy/sparse/linalg/_isolve/tests/test_lsqr.py +120 -0
- scipy/sparse/linalg/_isolve/tests/test_minres.py +97 -0
- scipy/sparse/linalg/_isolve/tests/test_utils.py +9 -0
- scipy/sparse/linalg/_isolve/tfqmr.py +179 -0
- scipy/sparse/linalg/_isolve/utils.py +121 -0
- scipy/sparse/linalg/_matfuncs.py +940 -0
- scipy/sparse/linalg/_norm.py +195 -0
- scipy/sparse/linalg/_onenormest.py +467 -0
- scipy/sparse/linalg/_propack/_cpropack.cp311-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_cpropack.cp311-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_propack/_dpropack.cp311-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_dpropack.cp311-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_propack/_spropack.cp311-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_spropack.cp311-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_propack/_zpropack.cp311-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_zpropack.cp311-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_special_sparse_arrays.py +949 -0
- scipy/sparse/linalg/_svdp.py +309 -0
- scipy/sparse/linalg/dsolve.py +22 -0
- scipy/sparse/linalg/eigen.py +21 -0
- scipy/sparse/linalg/interface.py +20 -0
- scipy/sparse/linalg/isolve.py +22 -0
- scipy/sparse/linalg/matfuncs.py +18 -0
- scipy/sparse/linalg/tests/__init__.py +0 -0
- scipy/sparse/linalg/tests/propack_test_data.npz +0 -0
- scipy/sparse/linalg/tests/test_expm_multiply.py +367 -0
- scipy/sparse/linalg/tests/test_interface.py +561 -0
- scipy/sparse/linalg/tests/test_matfuncs.py +592 -0
- scipy/sparse/linalg/tests/test_norm.py +154 -0
- scipy/sparse/linalg/tests/test_onenormest.py +252 -0
- scipy/sparse/linalg/tests/test_propack.py +165 -0
- scipy/sparse/linalg/tests/test_pydata_sparse.py +272 -0
- scipy/sparse/linalg/tests/test_special_sparse_arrays.py +337 -0
- scipy/sparse/sparsetools.py +17 -0
- scipy/sparse/spfuncs.py +17 -0
- scipy/sparse/sputils.py +17 -0
- scipy/sparse/tests/__init__.py +0 -0
- scipy/sparse/tests/data/csc_py2.npz +0 -0
- scipy/sparse/tests/data/csc_py3.npz +0 -0
- scipy/sparse/tests/test_arithmetic1d.py +341 -0
- scipy/sparse/tests/test_array_api.py +561 -0
- scipy/sparse/tests/test_base.py +5870 -0
- scipy/sparse/tests/test_common1d.py +447 -0
- scipy/sparse/tests/test_construct.py +872 -0
- scipy/sparse/tests/test_coo.py +1119 -0
- scipy/sparse/tests/test_csc.py +98 -0
- scipy/sparse/tests/test_csr.py +214 -0
- scipy/sparse/tests/test_dok.py +209 -0
- scipy/sparse/tests/test_extract.py +51 -0
- scipy/sparse/tests/test_indexing1d.py +603 -0
- scipy/sparse/tests/test_matrix_io.py +109 -0
- scipy/sparse/tests/test_minmax1d.py +128 -0
- scipy/sparse/tests/test_sparsetools.py +344 -0
- scipy/sparse/tests/test_spfuncs.py +97 -0
- scipy/sparse/tests/test_sputils.py +424 -0
- scipy/spatial/__init__.py +129 -0
- scipy/spatial/_ckdtree.cp311-win_arm64.lib +0 -0
- scipy/spatial/_ckdtree.cp311-win_arm64.pyd +0 -0
- scipy/spatial/_distance_pybind.cp311-win_arm64.lib +0 -0
- scipy/spatial/_distance_pybind.cp311-win_arm64.pyd +0 -0
- scipy/spatial/_distance_wrap.cp311-win_arm64.lib +0 -0
- scipy/spatial/_distance_wrap.cp311-win_arm64.pyd +0 -0
- scipy/spatial/_geometric_slerp.py +238 -0
- scipy/spatial/_hausdorff.cp311-win_arm64.lib +0 -0
- scipy/spatial/_hausdorff.cp311-win_arm64.pyd +0 -0
- scipy/spatial/_kdtree.py +920 -0
- scipy/spatial/_plotutils.py +274 -0
- scipy/spatial/_procrustes.py +132 -0
- scipy/spatial/_qhull.cp311-win_arm64.lib +0 -0
- scipy/spatial/_qhull.cp311-win_arm64.pyd +0 -0
- scipy/spatial/_qhull.pyi +213 -0
- scipy/spatial/_spherical_voronoi.py +341 -0
- scipy/spatial/_voronoi.cp311-win_arm64.lib +0 -0
- scipy/spatial/_voronoi.cp311-win_arm64.pyd +0 -0
- scipy/spatial/_voronoi.pyi +4 -0
- scipy/spatial/ckdtree.py +18 -0
- scipy/spatial/distance.py +3147 -0
- scipy/spatial/distance.pyi +210 -0
- scipy/spatial/kdtree.py +25 -0
- scipy/spatial/qhull.py +25 -0
- scipy/spatial/qhull_src/COPYING_QHULL.txt +39 -0
- scipy/spatial/tests/__init__.py +0 -0
- scipy/spatial/tests/data/cdist-X1.txt +10 -0
- scipy/spatial/tests/data/cdist-X2.txt +20 -0
- scipy/spatial/tests/data/degenerate_pointset.npz +0 -0
- scipy/spatial/tests/data/iris.txt +150 -0
- scipy/spatial/tests/data/pdist-boolean-inp.txt +20 -0
- scipy/spatial/tests/data/pdist-chebyshev-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-chebyshev-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-cityblock-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-cityblock-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-correlation-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-correlation-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-cosine-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-cosine-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-double-inp.txt +20 -0
- scipy/spatial/tests/data/pdist-euclidean-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-euclidean-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-hamming-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-jaccard-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-jensenshannon-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-jensenshannon-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-minkowski-3.2-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-minkowski-3.2-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-minkowski-5.8-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-seuclidean-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-seuclidean-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-spearman-ml.txt +1 -0
- scipy/spatial/tests/data/random-bool-data.txt +100 -0
- scipy/spatial/tests/data/random-double-data.txt +100 -0
- scipy/spatial/tests/data/random-int-data.txt +100 -0
- scipy/spatial/tests/data/random-uint-data.txt +100 -0
- scipy/spatial/tests/data/selfdual-4d-polytope.txt +27 -0
- scipy/spatial/tests/test__plotutils.py +91 -0
- scipy/spatial/tests/test__procrustes.py +116 -0
- scipy/spatial/tests/test_distance.py +2389 -0
- scipy/spatial/tests/test_hausdorff.py +199 -0
- scipy/spatial/tests/test_kdtree.py +1536 -0
- scipy/spatial/tests/test_qhull.py +1313 -0
- scipy/spatial/tests/test_slerp.py +417 -0
- scipy/spatial/tests/test_spherical_voronoi.py +358 -0
- scipy/spatial/transform/__init__.py +31 -0
- scipy/spatial/transform/_rigid_transform.cp311-win_arm64.lib +0 -0
- scipy/spatial/transform/_rigid_transform.cp311-win_arm64.pyd +0 -0
- scipy/spatial/transform/_rotation.cp311-win_arm64.lib +0 -0
- scipy/spatial/transform/_rotation.cp311-win_arm64.pyd +0 -0
- scipy/spatial/transform/_rotation_groups.py +140 -0
- scipy/spatial/transform/_rotation_spline.py +460 -0
- scipy/spatial/transform/rotation.py +21 -0
- scipy/spatial/transform/tests/__init__.py +0 -0
- scipy/spatial/transform/tests/test_rigid_transform.py +1221 -0
- scipy/spatial/transform/tests/test_rotation.py +2569 -0
- scipy/spatial/transform/tests/test_rotation_groups.py +169 -0
- scipy/spatial/transform/tests/test_rotation_spline.py +183 -0
- scipy/special/__init__.pxd +1 -0
- scipy/special/__init__.py +841 -0
- scipy/special/_add_newdocs.py +9961 -0
- scipy/special/_basic.py +3576 -0
- scipy/special/_comb.cp311-win_arm64.lib +0 -0
- scipy/special/_comb.cp311-win_arm64.pyd +0 -0
- scipy/special/_ellip_harm.py +214 -0
- scipy/special/_ellip_harm_2.cp311-win_arm64.lib +0 -0
- scipy/special/_ellip_harm_2.cp311-win_arm64.pyd +0 -0
- scipy/special/_gufuncs.cp311-win_arm64.lib +0 -0
- scipy/special/_gufuncs.cp311-win_arm64.pyd +0 -0
- scipy/special/_input_validation.py +17 -0
- scipy/special/_lambertw.py +149 -0
- scipy/special/_logsumexp.py +426 -0
- scipy/special/_mptestutils.py +453 -0
- scipy/special/_multiufuncs.py +610 -0
- scipy/special/_orthogonal.py +2592 -0
- scipy/special/_orthogonal.pyi +330 -0
- scipy/special/_precompute/__init__.py +0 -0
- scipy/special/_precompute/cosine_cdf.py +17 -0
- scipy/special/_precompute/expn_asy.py +54 -0
- scipy/special/_precompute/gammainc_asy.py +116 -0
- scipy/special/_precompute/gammainc_data.py +124 -0
- scipy/special/_precompute/hyp2f1_data.py +484 -0
- scipy/special/_precompute/lambertw.py +68 -0
- scipy/special/_precompute/loggamma.py +43 -0
- scipy/special/_precompute/struve_convergence.py +131 -0
- scipy/special/_precompute/utils.py +38 -0
- scipy/special/_precompute/wright_bessel.py +342 -0
- scipy/special/_precompute/wright_bessel_data.py +152 -0
- scipy/special/_precompute/wrightomega.py +41 -0
- scipy/special/_precompute/zetac.py +27 -0
- scipy/special/_sf_error.py +15 -0
- scipy/special/_specfun.cp311-win_arm64.lib +0 -0
- scipy/special/_specfun.cp311-win_arm64.pyd +0 -0
- scipy/special/_special_ufuncs.cp311-win_arm64.lib +0 -0
- scipy/special/_special_ufuncs.cp311-win_arm64.pyd +0 -0
- scipy/special/_spfun_stats.py +106 -0
- scipy/special/_spherical_bessel.py +397 -0
- scipy/special/_support_alternative_backends.py +295 -0
- scipy/special/_test_internal.cp311-win_arm64.lib +0 -0
- scipy/special/_test_internal.cp311-win_arm64.pyd +0 -0
- scipy/special/_test_internal.pyi +9 -0
- scipy/special/_testutils.py +321 -0
- scipy/special/_ufuncs.cp311-win_arm64.lib +0 -0
- scipy/special/_ufuncs.cp311-win_arm64.pyd +0 -0
- scipy/special/_ufuncs.pyi +522 -0
- scipy/special/_ufuncs.pyx +13173 -0
- scipy/special/_ufuncs_cxx.cp311-win_arm64.lib +0 -0
- scipy/special/_ufuncs_cxx.cp311-win_arm64.pyd +0 -0
- scipy/special/_ufuncs_cxx.pxd +142 -0
- scipy/special/_ufuncs_cxx.pyx +427 -0
- scipy/special/_ufuncs_cxx_defs.h +147 -0
- scipy/special/_ufuncs_defs.h +57 -0
- scipy/special/add_newdocs.py +15 -0
- scipy/special/basic.py +87 -0
- scipy/special/cython_special.cp311-win_arm64.lib +0 -0
- scipy/special/cython_special.cp311-win_arm64.pyd +0 -0
- scipy/special/cython_special.pxd +259 -0
- scipy/special/cython_special.pyi +3 -0
- scipy/special/orthogonal.py +45 -0
- scipy/special/sf_error.py +20 -0
- scipy/special/specfun.py +24 -0
- scipy/special/spfun_stats.py +17 -0
- scipy/special/tests/__init__.py +0 -0
- scipy/special/tests/_cython_examples/extending.pyx +12 -0
- scipy/special/tests/_cython_examples/meson.build +34 -0
- scipy/special/tests/data/__init__.py +0 -0
- scipy/special/tests/data/boost.npz +0 -0
- scipy/special/tests/data/gsl.npz +0 -0
- scipy/special/tests/data/local.npz +0 -0
- scipy/special/tests/test_basic.py +4815 -0
- scipy/special/tests/test_bdtr.py +112 -0
- scipy/special/tests/test_boost_ufuncs.py +64 -0
- scipy/special/tests/test_boxcox.py +125 -0
- scipy/special/tests/test_cdflib.py +712 -0
- scipy/special/tests/test_cdft_asymptotic.py +49 -0
- scipy/special/tests/test_cephes_intp_cast.py +29 -0
- scipy/special/tests/test_cosine_distr.py +83 -0
- scipy/special/tests/test_cython_special.py +363 -0
- scipy/special/tests/test_data.py +719 -0
- scipy/special/tests/test_dd.py +42 -0
- scipy/special/tests/test_digamma.py +45 -0
- scipy/special/tests/test_ellip_harm.py +278 -0
- scipy/special/tests/test_erfinv.py +89 -0
- scipy/special/tests/test_exponential_integrals.py +118 -0
- scipy/special/tests/test_extending.py +28 -0
- scipy/special/tests/test_faddeeva.py +85 -0
- scipy/special/tests/test_gamma.py +12 -0
- scipy/special/tests/test_gammainc.py +152 -0
- scipy/special/tests/test_hyp2f1.py +2566 -0
- scipy/special/tests/test_hypergeometric.py +234 -0
- scipy/special/tests/test_iv_ratio.py +249 -0
- scipy/special/tests/test_kolmogorov.py +491 -0
- scipy/special/tests/test_lambertw.py +109 -0
- scipy/special/tests/test_legendre.py +1518 -0
- scipy/special/tests/test_log1mexp.py +85 -0
- scipy/special/tests/test_loggamma.py +70 -0
- scipy/special/tests/test_logit.py +162 -0
- scipy/special/tests/test_logsumexp.py +469 -0
- scipy/special/tests/test_mpmath.py +2293 -0
- scipy/special/tests/test_nan_inputs.py +65 -0
- scipy/special/tests/test_ndtr.py +77 -0
- scipy/special/tests/test_ndtri_exp.py +94 -0
- scipy/special/tests/test_orthogonal.py +821 -0
- scipy/special/tests/test_orthogonal_eval.py +275 -0
- scipy/special/tests/test_owens_t.py +53 -0
- scipy/special/tests/test_pcf.py +24 -0
- scipy/special/tests/test_pdtr.py +48 -0
- scipy/special/tests/test_powm1.py +65 -0
- scipy/special/tests/test_precompute_expn_asy.py +24 -0
- scipy/special/tests/test_precompute_gammainc.py +108 -0
- scipy/special/tests/test_precompute_utils.py +36 -0
- scipy/special/tests/test_round.py +18 -0
- scipy/special/tests/test_sf_error.py +146 -0
- scipy/special/tests/test_sici.py +36 -0
- scipy/special/tests/test_specfun.py +48 -0
- scipy/special/tests/test_spence.py +32 -0
- scipy/special/tests/test_spfun_stats.py +61 -0
- scipy/special/tests/test_sph_harm.py +85 -0
- scipy/special/tests/test_spherical_bessel.py +400 -0
- scipy/special/tests/test_support_alternative_backends.py +248 -0
- scipy/special/tests/test_trig.py +72 -0
- scipy/special/tests/test_ufunc_signatures.py +46 -0
- scipy/special/tests/test_wright_bessel.py +205 -0
- scipy/special/tests/test_wrightomega.py +117 -0
- scipy/special/tests/test_zeta.py +301 -0
- scipy/stats/__init__.py +670 -0
- scipy/stats/_ansari_swilk_statistics.cp311-win_arm64.lib +0 -0
- scipy/stats/_ansari_swilk_statistics.cp311-win_arm64.pyd +0 -0
- scipy/stats/_axis_nan_policy.py +692 -0
- scipy/stats/_biasedurn.cp311-win_arm64.lib +0 -0
- scipy/stats/_biasedurn.cp311-win_arm64.pyd +0 -0
- scipy/stats/_biasedurn.pxd +27 -0
- scipy/stats/_binned_statistic.py +795 -0
- scipy/stats/_binomtest.py +375 -0
- scipy/stats/_bws_test.py +177 -0
- scipy/stats/_censored_data.py +459 -0
- scipy/stats/_common.py +5 -0
- scipy/stats/_constants.py +42 -0
- scipy/stats/_continued_fraction.py +387 -0
- scipy/stats/_continuous_distns.py +12486 -0
- scipy/stats/_correlation.py +210 -0
- scipy/stats/_covariance.py +636 -0
- scipy/stats/_crosstab.py +204 -0
- scipy/stats/_discrete_distns.py +2098 -0
- scipy/stats/_distn_infrastructure.py +4201 -0
- scipy/stats/_distr_params.py +299 -0
- scipy/stats/_distribution_infrastructure.py +5750 -0
- scipy/stats/_entropy.py +428 -0
- scipy/stats/_finite_differences.py +145 -0
- scipy/stats/_fit.py +1351 -0
- scipy/stats/_hypotests.py +2060 -0
- scipy/stats/_kde.py +732 -0
- scipy/stats/_ksstats.py +600 -0
- scipy/stats/_levy_stable/__init__.py +1231 -0
- scipy/stats/_levy_stable/levyst.cp311-win_arm64.lib +0 -0
- scipy/stats/_levy_stable/levyst.cp311-win_arm64.pyd +0 -0
- scipy/stats/_mannwhitneyu.py +492 -0
- scipy/stats/_mgc.py +550 -0
- scipy/stats/_morestats.py +4626 -0
- scipy/stats/_mstats_basic.py +3658 -0
- scipy/stats/_mstats_extras.py +521 -0
- scipy/stats/_multicomp.py +449 -0
- scipy/stats/_multivariate.py +7281 -0
- scipy/stats/_new_distributions.py +452 -0
- scipy/stats/_odds_ratio.py +466 -0
- scipy/stats/_page_trend_test.py +486 -0
- scipy/stats/_probability_distribution.py +1964 -0
- scipy/stats/_qmc.py +2956 -0
- scipy/stats/_qmc_cy.cp311-win_arm64.lib +0 -0
- scipy/stats/_qmc_cy.cp311-win_arm64.pyd +0 -0
- scipy/stats/_qmc_cy.pyi +54 -0
- scipy/stats/_qmvnt.py +454 -0
- scipy/stats/_qmvnt_cy.cp311-win_arm64.lib +0 -0
- scipy/stats/_qmvnt_cy.cp311-win_arm64.pyd +0 -0
- scipy/stats/_quantile.py +335 -0
- scipy/stats/_rcont/__init__.py +4 -0
- scipy/stats/_rcont/rcont.cp311-win_arm64.lib +0 -0
- scipy/stats/_rcont/rcont.cp311-win_arm64.pyd +0 -0
- scipy/stats/_relative_risk.py +263 -0
- scipy/stats/_resampling.py +2352 -0
- scipy/stats/_result_classes.py +40 -0
- scipy/stats/_sampling.py +1314 -0
- scipy/stats/_sensitivity_analysis.py +713 -0
- scipy/stats/_sobol.cp311-win_arm64.lib +0 -0
- scipy/stats/_sobol.cp311-win_arm64.pyd +0 -0
- scipy/stats/_sobol.pyi +54 -0
- scipy/stats/_sobol_direction_numbers.npz +0 -0
- scipy/stats/_stats.cp311-win_arm64.lib +0 -0
- scipy/stats/_stats.cp311-win_arm64.pyd +0 -0
- scipy/stats/_stats.pxd +10 -0
- scipy/stats/_stats_mstats_common.py +322 -0
- scipy/stats/_stats_py.py +11089 -0
- scipy/stats/_stats_pythran.cp311-win_arm64.lib +0 -0
- scipy/stats/_stats_pythran.cp311-win_arm64.pyd +0 -0
- scipy/stats/_survival.py +683 -0
- scipy/stats/_tukeylambda_stats.py +199 -0
- scipy/stats/_unuran/__init__.py +0 -0
- scipy/stats/_unuran/unuran_wrapper.cp311-win_arm64.lib +0 -0
- scipy/stats/_unuran/unuran_wrapper.cp311-win_arm64.pyd +0 -0
- scipy/stats/_unuran/unuran_wrapper.pyi +179 -0
- scipy/stats/_variation.py +126 -0
- scipy/stats/_warnings_errors.py +38 -0
- scipy/stats/_wilcoxon.py +265 -0
- scipy/stats/biasedurn.py +16 -0
- scipy/stats/contingency.py +521 -0
- scipy/stats/distributions.py +24 -0
- scipy/stats/kde.py +18 -0
- scipy/stats/morestats.py +27 -0
- scipy/stats/mstats.py +140 -0
- scipy/stats/mstats_basic.py +42 -0
- scipy/stats/mstats_extras.py +25 -0
- scipy/stats/mvn.py +17 -0
- scipy/stats/qmc.py +236 -0
- scipy/stats/sampling.py +73 -0
- scipy/stats/stats.py +41 -0
- scipy/stats/tests/__init__.py +0 -0
- scipy/stats/tests/common_tests.py +356 -0
- scipy/stats/tests/data/_mvt.py +171 -0
- scipy/stats/tests/data/fisher_exact_results_from_r.py +607 -0
- scipy/stats/tests/data/jf_skew_t_gamlss_pdf_data.npy +0 -0
- scipy/stats/tests/data/levy_stable/stable-Z1-cdf-sample-data.npy +0 -0
- scipy/stats/tests/data/levy_stable/stable-Z1-pdf-sample-data.npy +0 -0
- scipy/stats/tests/data/levy_stable/stable-loc-scale-sample-data.npy +0 -0
- scipy/stats/tests/data/nist_anova/AtmWtAg.dat +108 -0
- scipy/stats/tests/data/nist_anova/SiRstv.dat +85 -0
- scipy/stats/tests/data/nist_anova/SmLs01.dat +249 -0
- scipy/stats/tests/data/nist_anova/SmLs02.dat +1869 -0
- scipy/stats/tests/data/nist_anova/SmLs03.dat +18069 -0
- scipy/stats/tests/data/nist_anova/SmLs04.dat +249 -0
- scipy/stats/tests/data/nist_anova/SmLs05.dat +1869 -0
- scipy/stats/tests/data/nist_anova/SmLs06.dat +18069 -0
- scipy/stats/tests/data/nist_anova/SmLs07.dat +249 -0
- scipy/stats/tests/data/nist_anova/SmLs08.dat +1869 -0
- scipy/stats/tests/data/nist_anova/SmLs09.dat +18069 -0
- scipy/stats/tests/data/nist_linregress/Norris.dat +97 -0
- scipy/stats/tests/data/rel_breitwigner_pdf_sample_data_ROOT.npy +0 -0
- scipy/stats/tests/data/studentized_range_mpmath_ref.json +1499 -0
- scipy/stats/tests/test_axis_nan_policy.py +1388 -0
- scipy/stats/tests/test_binned_statistic.py +568 -0
- scipy/stats/tests/test_censored_data.py +152 -0
- scipy/stats/tests/test_contingency.py +294 -0
- scipy/stats/tests/test_continued_fraction.py +173 -0
- scipy/stats/tests/test_continuous.py +2198 -0
- scipy/stats/tests/test_continuous_basic.py +1053 -0
- scipy/stats/tests/test_continuous_fit_censored.py +683 -0
- scipy/stats/tests/test_correlation.py +80 -0
- scipy/stats/tests/test_crosstab.py +115 -0
- scipy/stats/tests/test_discrete_basic.py +580 -0
- scipy/stats/tests/test_discrete_distns.py +700 -0
- scipy/stats/tests/test_distributions.py +10413 -0
- scipy/stats/tests/test_entropy.py +322 -0
- scipy/stats/tests/test_fast_gen_inversion.py +435 -0
- scipy/stats/tests/test_fit.py +1090 -0
- scipy/stats/tests/test_hypotests.py +1991 -0
- scipy/stats/tests/test_kdeoth.py +676 -0
- scipy/stats/tests/test_marray.py +289 -0
- scipy/stats/tests/test_mgc.py +217 -0
- scipy/stats/tests/test_morestats.py +3259 -0
- scipy/stats/tests/test_mstats_basic.py +2071 -0
- scipy/stats/tests/test_mstats_extras.py +172 -0
- scipy/stats/tests/test_multicomp.py +405 -0
- scipy/stats/tests/test_multivariate.py +4381 -0
- scipy/stats/tests/test_odds_ratio.py +148 -0
- scipy/stats/tests/test_qmc.py +1492 -0
- scipy/stats/tests/test_quantile.py +199 -0
- scipy/stats/tests/test_rank.py +345 -0
- scipy/stats/tests/test_relative_risk.py +95 -0
- scipy/stats/tests/test_resampling.py +2000 -0
- scipy/stats/tests/test_sampling.py +1450 -0
- scipy/stats/tests/test_sensitivity_analysis.py +310 -0
- scipy/stats/tests/test_stats.py +9707 -0
- scipy/stats/tests/test_survival.py +466 -0
- scipy/stats/tests/test_tukeylambda_stats.py +85 -0
- scipy/stats/tests/test_variation.py +216 -0
- scipy/version.py +12 -0
- scipy-1.16.2.dist-info/DELVEWHEEL +2 -0
- scipy-1.16.2.dist-info/LICENSE.txt +912 -0
- scipy-1.16.2.dist-info/METADATA +1061 -0
- scipy-1.16.2.dist-info/RECORD +1530 -0
- scipy-1.16.2.dist-info/WHEEL +4 -0
- scipy.libs/msvcp140-5f1c5dd31916990d94181e07bc3afb32.dll +0 -0
- scipy.libs/scipy_openblas-f3ac85b1f412f7e86514c923dc4058d1.dll +0 -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
|