scipy 1.16.2__cp313-cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/_cyutility.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/_lib/_ccallback_c.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/_lib/_fpumode.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/_lib/_test_ccallback.cp313t-win_arm64.pyd +0 -0
- scipy/_lib/_test_deprecation_call.cp313t-win_arm64.lib +0 -0
- scipy/_lib/_test_deprecation_call.cp313t-win_arm64.pyd +0 -0
- scipy/_lib/_test_deprecation_def.cp313t-win_arm64.lib +0 -0
- scipy/_lib/_test_deprecation_def.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/_lib/_uarray/_uarray.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/_lib/messagestream.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/cluster/_hierarchy.cp313t-win_arm64.pyd +0 -0
- scipy/cluster/_optimal_leaf_ordering.cp313t-win_arm64.lib +0 -0
- scipy/cluster/_optimal_leaf_ordering.cp313t-win_arm64.pyd +0 -0
- scipy/cluster/_vq.cp313t-win_arm64.lib +0 -0
- scipy/cluster/_vq.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/fft/_pocketfft/pypocketfft.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/fftpack/convolve.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/integrate/_dop.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/integrate/_lsoda.cp313t-win_arm64.pyd +0 -0
- scipy/integrate/_ode.py +1395 -0
- scipy/integrate/_odepack.cp313t-win_arm64.lib +0 -0
- scipy/integrate/_odepack.cp313t-win_arm64.pyd +0 -0
- scipy/integrate/_odepack_py.py +273 -0
- scipy/integrate/_quad_vec.py +674 -0
- scipy/integrate/_quadpack.cp313t-win_arm64.lib +0 -0
- scipy/integrate/_quadpack.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/integrate/_test_multivariate.cp313t-win_arm64.pyd +0 -0
- scipy/integrate/_test_odeint_banded.cp313t-win_arm64.lib +0 -0
- scipy/integrate/_test_odeint_banded.cp313t-win_arm64.pyd +0 -0
- scipy/integrate/_vode.cp313t-win_arm64.lib +0 -0
- scipy/integrate/_vode.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/interpolate/_dfitpack.cp313t-win_arm64.pyd +0 -0
- scipy/interpolate/_dierckx.cp313t-win_arm64.lib +0 -0
- scipy/interpolate/_dierckx.cp313t-win_arm64.pyd +0 -0
- scipy/interpolate/_fitpack.cp313t-win_arm64.lib +0 -0
- scipy/interpolate/_fitpack.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/interpolate/_interpnd.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/interpolate/_ppoly.cp313t-win_arm64.pyd +0 -0
- scipy/interpolate/_rbf.py +290 -0
- scipy/interpolate/_rbfinterp.py +550 -0
- scipy/interpolate/_rbfinterp_pythran.cp313t-win_arm64.lib +0 -0
- scipy/interpolate/_rbfinterp_pythran.cp313t-win_arm64.pyd +0 -0
- scipy/interpolate/_rgi.py +764 -0
- scipy/interpolate/_rgi_cython.cp313t-win_arm64.lib +0 -0
- scipy/interpolate/_rgi_cython.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/io/_fast_matrix_market/_fmm_core.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/io/_test_fortran.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/io/matlab/_mio5_utils.cp313t-win_arm64.pyd +0 -0
- scipy/io/matlab/_mio_utils.cp313t-win_arm64.lib +0 -0
- scipy/io/matlab/_mio_utils.cp313t-win_arm64.pyd +0 -0
- scipy/io/matlab/_miobase.py +435 -0
- scipy/io/matlab/_streams.cp313t-win_arm64.lib +0 -0
- scipy/io/matlab/_streams.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/linalg/_cythonized_array_utils.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/linalg/_decomp_interpolative.cp313t-win_arm64.pyd +0 -0
- scipy/linalg/_decomp_ldl.py +356 -0
- scipy/linalg/_decomp_lu.py +401 -0
- scipy/linalg/_decomp_lu_cython.cp313t-win_arm64.lib +0 -0
- scipy/linalg/_decomp_lu_cython.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/linalg/_decomp_update.cp313t-win_arm64.pyd +0 -0
- scipy/linalg/_expm_frechet.py +417 -0
- scipy/linalg/_fblas.cp313t-win_arm64.lib +0 -0
- scipy/linalg/_fblas.cp313t-win_arm64.pyd +0 -0
- scipy/linalg/_flapack.cp313t-win_arm64.lib +0 -0
- scipy/linalg/_flapack.cp313t-win_arm64.pyd +0 -0
- scipy/linalg/_lapack_subroutines.h +1521 -0
- scipy/linalg/_linalg_pythran.cp313t-win_arm64.lib +0 -0
- scipy/linalg/_linalg_pythran.cp313t-win_arm64.pyd +0 -0
- scipy/linalg/_matfuncs.py +1050 -0
- scipy/linalg/_matfuncs_expm.cp313t-win_arm64.lib +0 -0
- scipy/linalg/_matfuncs_expm.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/linalg/_matfuncs_schur_sqrtm.cp313t-win_arm64.pyd +0 -0
- scipy/linalg/_matfuncs_sqrtm.py +107 -0
- scipy/linalg/_matfuncs_sqrtm_triu.cp313t-win_arm64.lib +0 -0
- scipy/linalg/_matfuncs_sqrtm_triu.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/linalg/_solve_toeplitz.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/linalg/cython_blas.cp313t-win_arm64.pyd +0 -0
- scipy/linalg/cython_blas.pxd +169 -0
- scipy/linalg/cython_blas.pyx +1432 -0
- scipy/linalg/cython_lapack.cp313t-win_arm64.lib +0 -0
- scipy/linalg/cython_lapack.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/ndimage/_ctest.cp313t-win_arm64.pyd +0 -0
- scipy/ndimage/_cytest.cp313t-win_arm64.lib +0 -0
- scipy/ndimage/_cytest.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/ndimage/_nd_image.cp313t-win_arm64.pyd +0 -0
- scipy/ndimage/_ndimage_api.py +16 -0
- scipy/ndimage/_ni_docstrings.py +214 -0
- scipy/ndimage/_ni_label.cp313t-win_arm64.lib +0 -0
- scipy/ndimage/_ni_label.cp313t-win_arm64.pyd +0 -0
- scipy/ndimage/_ni_support.py +139 -0
- scipy/ndimage/_rank_filter_1d.cp313t-win_arm64.lib +0 -0
- scipy/ndimage/_rank_filter_1d.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/odr/__odrpack.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/optimize/_bglu_dense.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/optimize/_direct.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/optimize/_group_columns.cp313t-win_arm64.pyd +0 -0
- scipy/optimize/_hessian_update_strategy.py +479 -0
- scipy/optimize/_highspy/__init__.py +0 -0
- scipy/optimize/_highspy/_core.cp313t-win_arm64.lib +0 -0
- scipy/optimize/_highspy/_core.cp313t-win_arm64.pyd +0 -0
- scipy/optimize/_highspy/_highs_options.cp313t-win_arm64.lib +0 -0
- scipy/optimize/_highspy/_highs_options.cp313t-win_arm64.pyd +0 -0
- scipy/optimize/_highspy/_highs_wrapper.py +338 -0
- scipy/optimize/_isotonic.py +157 -0
- scipy/optimize/_lbfgsb.cp313t-win_arm64.lib +0 -0
- scipy/optimize/_lbfgsb.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/optimize/_lsap.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/optimize/_lsq/givens_elimination.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/optimize/_minpack.cp313t-win_arm64.pyd +0 -0
- scipy/optimize/_minpack_py.py +1178 -0
- scipy/optimize/_moduleTNC.cp313t-win_arm64.lib +0 -0
- scipy/optimize/_moduleTNC.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/optimize/_pava_pybind.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/optimize/_slsqplib.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/optimize/_trlib/_trlib.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/optimize/_zeros.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/optimize/cython_optimize/_zeros.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/signal/_max_len_seq_inner.cp313t-win_arm64.pyd +0 -0
- scipy/signal/_peak_finding.py +1310 -0
- scipy/signal/_peak_finding_utils.cp313t-win_arm64.lib +0 -0
- scipy/signal/_peak_finding_utils.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/signal/_sigtools.cp313t-win_arm64.pyd +0 -0
- scipy/signal/_sosfilt.cp313t-win_arm64.lib +0 -0
- scipy/signal/_sosfilt.cp313t-win_arm64.pyd +0 -0
- scipy/signal/_spectral_py.py +2471 -0
- scipy/signal/_spline.cp313t-win_arm64.lib +0 -0
- scipy/signal/_spline.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/signal/_upfirdn_apply.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/sparse/_csparsetools.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/sparse/_sparsetools.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_flow.cp313t-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_laplacian.py +563 -0
- scipy/sparse/csgraph/_matching.cp313t-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_matching.cp313t-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_min_spanning_tree.cp313t-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_min_spanning_tree.cp313t-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_reordering.cp313t-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_reordering.cp313t-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_shortest_path.cp313t-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_shortest_path.cp313t-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_tools.cp313t-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_tools.cp313t-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_traversal.cp313t-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_traversal.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/sparse/linalg/_dsolve/_superlu.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/sparse/linalg/_eigen/arpack/_arpack.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_cpropack.cp313t-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_propack/_dpropack.cp313t-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_dpropack.cp313t-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_propack/_spropack.cp313t-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_spropack.cp313t-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_propack/_zpropack.cp313t-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_zpropack.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/spatial/_ckdtree.cp313t-win_arm64.pyd +0 -0
- scipy/spatial/_distance_pybind.cp313t-win_arm64.lib +0 -0
- scipy/spatial/_distance_pybind.cp313t-win_arm64.pyd +0 -0
- scipy/spatial/_distance_wrap.cp313t-win_arm64.lib +0 -0
- scipy/spatial/_distance_wrap.cp313t-win_arm64.pyd +0 -0
- scipy/spatial/_geometric_slerp.py +238 -0
- scipy/spatial/_hausdorff.cp313t-win_arm64.lib +0 -0
- scipy/spatial/_hausdorff.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/spatial/_qhull.cp313t-win_arm64.pyd +0 -0
- scipy/spatial/_qhull.pyi +213 -0
- scipy/spatial/_spherical_voronoi.py +341 -0
- scipy/spatial/_voronoi.cp313t-win_arm64.lib +0 -0
- scipy/spatial/_voronoi.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/spatial/transform/_rigid_transform.cp313t-win_arm64.pyd +0 -0
- scipy/spatial/transform/_rotation.cp313t-win_arm64.lib +0 -0
- scipy/spatial/transform/_rotation.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/special/_comb.cp313t-win_arm64.pyd +0 -0
- scipy/special/_ellip_harm.py +214 -0
- scipy/special/_ellip_harm_2.cp313t-win_arm64.lib +0 -0
- scipy/special/_ellip_harm_2.cp313t-win_arm64.pyd +0 -0
- scipy/special/_gufuncs.cp313t-win_arm64.lib +0 -0
- scipy/special/_gufuncs.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/special/_specfun.cp313t-win_arm64.pyd +0 -0
- scipy/special/_special_ufuncs.cp313t-win_arm64.lib +0 -0
- scipy/special/_special_ufuncs.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/special/_test_internal.cp313t-win_arm64.pyd +0 -0
- scipy/special/_test_internal.pyi +9 -0
- scipy/special/_testutils.py +321 -0
- scipy/special/_ufuncs.cp313t-win_arm64.lib +0 -0
- scipy/special/_ufuncs.cp313t-win_arm64.pyd +0 -0
- scipy/special/_ufuncs.pyi +522 -0
- scipy/special/_ufuncs.pyx +13173 -0
- scipy/special/_ufuncs_cxx.cp313t-win_arm64.lib +0 -0
- scipy/special/_ufuncs_cxx.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/special/cython_special.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/stats/_ansari_swilk_statistics.cp313t-win_arm64.pyd +0 -0
- scipy/stats/_axis_nan_policy.py +692 -0
- scipy/stats/_biasedurn.cp313t-win_arm64.lib +0 -0
- scipy/stats/_biasedurn.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/stats/_levy_stable/levyst.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/stats/_qmc_cy.cp313t-win_arm64.pyd +0 -0
- scipy/stats/_qmc_cy.pyi +54 -0
- scipy/stats/_qmvnt.py +454 -0
- scipy/stats/_qmvnt_cy.cp313t-win_arm64.lib +0 -0
- scipy/stats/_qmvnt_cy.cp313t-win_arm64.pyd +0 -0
- scipy/stats/_quantile.py +335 -0
- scipy/stats/_rcont/__init__.py +4 -0
- scipy/stats/_rcont/rcont.cp313t-win_arm64.lib +0 -0
- scipy/stats/_rcont/rcont.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/stats/_sobol.cp313t-win_arm64.pyd +0 -0
- scipy/stats/_sobol.pyi +54 -0
- scipy/stats/_sobol_direction_numbers.npz +0 -0
- scipy/stats/_stats.cp313t-win_arm64.lib +0 -0
- scipy/stats/_stats.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/stats/_stats_pythran.cp313t-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.cp313t-win_arm64.lib +0 -0
- scipy/stats/_unuran/unuran_wrapper.cp313t-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,1178 @@
|
|
1
|
+
import warnings
|
2
|
+
from . import _minpack
|
3
|
+
|
4
|
+
import numpy as np
|
5
|
+
from numpy import (atleast_1d, triu, shape, transpose, zeros, prod, greater,
|
6
|
+
asarray, inf,
|
7
|
+
finfo, inexact, issubdtype, dtype)
|
8
|
+
from scipy import linalg
|
9
|
+
from scipy.linalg import svd, cholesky, solve_triangular, LinAlgError
|
10
|
+
from scipy._lib._util import _asarray_validated, _contains_nan
|
11
|
+
from scipy._lib._util import getfullargspec_no_self as _getfullargspec
|
12
|
+
import scipy._lib.array_api_extra as xpx
|
13
|
+
from ._optimize import OptimizeResult, _check_unknown_options, OptimizeWarning
|
14
|
+
from ._lsq import least_squares
|
15
|
+
# from ._lsq.common import make_strictly_feasible
|
16
|
+
from ._lsq.least_squares import prepare_bounds
|
17
|
+
from scipy.optimize._minimize import Bounds
|
18
|
+
|
19
|
+
__all__ = ['fsolve', 'leastsq', 'fixed_point', 'curve_fit']
|
20
|
+
|
21
|
+
|
22
|
+
def _check_func(checker, argname, thefunc, x0, args, numinputs,
|
23
|
+
output_shape=None):
|
24
|
+
res = atleast_1d(thefunc(*((x0[:numinputs],) + args)))
|
25
|
+
if (output_shape is not None) and (shape(res) != output_shape):
|
26
|
+
if (output_shape[0] != 1):
|
27
|
+
if len(output_shape) > 1:
|
28
|
+
if output_shape[1] == 1:
|
29
|
+
return shape(res)
|
30
|
+
msg = f"{checker}: there is a mismatch between the input and output " \
|
31
|
+
f"shape of the '{argname}' argument"
|
32
|
+
func_name = getattr(thefunc, '__name__', None)
|
33
|
+
if func_name:
|
34
|
+
msg += f" '{func_name}'."
|
35
|
+
else:
|
36
|
+
msg += "."
|
37
|
+
msg += f'Shape should be {output_shape} but it is {shape(res)}.'
|
38
|
+
raise TypeError(msg)
|
39
|
+
if issubdtype(res.dtype, inexact):
|
40
|
+
dt = res.dtype
|
41
|
+
else:
|
42
|
+
dt = dtype(float)
|
43
|
+
return shape(res), dt
|
44
|
+
|
45
|
+
|
46
|
+
def fsolve(func, x0, args=(), fprime=None, full_output=0,
|
47
|
+
col_deriv=0, xtol=1.49012e-8, maxfev=0, band=None,
|
48
|
+
epsfcn=None, factor=100, diag=None):
|
49
|
+
"""
|
50
|
+
Find the roots of a function.
|
51
|
+
|
52
|
+
Return the roots of the (non-linear) equations defined by
|
53
|
+
``func(x) = 0`` given a starting estimate.
|
54
|
+
|
55
|
+
Parameters
|
56
|
+
----------
|
57
|
+
func : callable ``f(x, *args)``
|
58
|
+
A function that takes at least one (possibly vector) argument,
|
59
|
+
and returns a value of the same length.
|
60
|
+
x0 : ndarray
|
61
|
+
The starting estimate for the roots of ``func(x) = 0``.
|
62
|
+
args : tuple, optional
|
63
|
+
Any extra arguments to `func`.
|
64
|
+
fprime : callable ``f(x, *args)``, optional
|
65
|
+
A function to compute the Jacobian of `func` with derivatives
|
66
|
+
across the rows. By default, the Jacobian will be estimated.
|
67
|
+
full_output : bool, optional
|
68
|
+
If True, return optional outputs.
|
69
|
+
col_deriv : bool, optional
|
70
|
+
Specify whether the Jacobian function computes derivatives down
|
71
|
+
the columns (faster, because there is no transpose operation).
|
72
|
+
xtol : float, optional
|
73
|
+
The calculation will terminate if the relative error between two
|
74
|
+
consecutive iterates is at most `xtol`.
|
75
|
+
maxfev : int, optional
|
76
|
+
The maximum number of calls to the function. If zero, then
|
77
|
+
``100*(N+1)`` is the maximum where N is the number of elements
|
78
|
+
in `x0`.
|
79
|
+
band : tuple, optional
|
80
|
+
If set to a two-sequence containing the number of sub- and
|
81
|
+
super-diagonals within the band of the Jacobi matrix, the
|
82
|
+
Jacobi matrix is considered banded (only for ``fprime=None``).
|
83
|
+
epsfcn : float, optional
|
84
|
+
A suitable step length for the forward-difference
|
85
|
+
approximation of the Jacobian (for ``fprime=None``). If
|
86
|
+
`epsfcn` is less than the machine precision, it is assumed
|
87
|
+
that the relative errors in the functions are of the order of
|
88
|
+
the machine precision.
|
89
|
+
factor : float, optional
|
90
|
+
A parameter determining the initial step bound
|
91
|
+
(``factor * || diag * x||``). Should be in the interval
|
92
|
+
``(0.1, 100)``.
|
93
|
+
diag : sequence, optional
|
94
|
+
N positive entries that serve as a scale factors for the
|
95
|
+
variables.
|
96
|
+
|
97
|
+
Returns
|
98
|
+
-------
|
99
|
+
x : ndarray
|
100
|
+
The solution (or the result of the last iteration for
|
101
|
+
an unsuccessful call).
|
102
|
+
infodict : dict
|
103
|
+
A dictionary of optional outputs with the keys:
|
104
|
+
|
105
|
+
``nfev``
|
106
|
+
number of function calls
|
107
|
+
``njev``
|
108
|
+
number of Jacobian calls
|
109
|
+
``fvec``
|
110
|
+
function evaluated at the output
|
111
|
+
``fjac``
|
112
|
+
the orthogonal matrix, q, produced by the QR
|
113
|
+
factorization of the final approximate Jacobian
|
114
|
+
matrix, stored column wise
|
115
|
+
``r``
|
116
|
+
upper triangular matrix produced by QR factorization
|
117
|
+
of the same matrix
|
118
|
+
``qtf``
|
119
|
+
the vector ``(transpose(q) * fvec)``
|
120
|
+
|
121
|
+
ier : int
|
122
|
+
An integer flag. Set to 1 if a solution was found, otherwise refer
|
123
|
+
to `mesg` for more information.
|
124
|
+
mesg : str
|
125
|
+
If no solution is found, `mesg` details the cause of failure.
|
126
|
+
|
127
|
+
See Also
|
128
|
+
--------
|
129
|
+
root : Interface to root finding algorithms for multivariate
|
130
|
+
functions. See the ``method='hybr'`` in particular.
|
131
|
+
|
132
|
+
Notes
|
133
|
+
-----
|
134
|
+
``fsolve`` is a wrapper around MINPACK's hybrd and hybrj algorithms.
|
135
|
+
|
136
|
+
Examples
|
137
|
+
--------
|
138
|
+
Find a solution to the system of equations:
|
139
|
+
``x0*cos(x1) = 4, x1*x0 - x1 = 5``.
|
140
|
+
|
141
|
+
>>> import numpy as np
|
142
|
+
>>> from scipy.optimize import fsolve
|
143
|
+
>>> def func(x):
|
144
|
+
... return [x[0] * np.cos(x[1]) - 4,
|
145
|
+
... x[1] * x[0] - x[1] - 5]
|
146
|
+
>>> root = fsolve(func, [1, 1])
|
147
|
+
>>> root
|
148
|
+
array([6.50409711, 0.90841421])
|
149
|
+
>>> np.isclose(func(root), [0.0, 0.0]) # func(root) should be almost 0.0.
|
150
|
+
array([ True, True])
|
151
|
+
|
152
|
+
"""
|
153
|
+
def _wrapped_func(*fargs):
|
154
|
+
"""
|
155
|
+
Wrapped `func` to track the number of times
|
156
|
+
the function has been called.
|
157
|
+
"""
|
158
|
+
_wrapped_func.nfev += 1
|
159
|
+
return func(*fargs)
|
160
|
+
|
161
|
+
_wrapped_func.nfev = 0
|
162
|
+
|
163
|
+
options = {'col_deriv': col_deriv,
|
164
|
+
'xtol': xtol,
|
165
|
+
'maxfev': maxfev,
|
166
|
+
'band': band,
|
167
|
+
'eps': epsfcn,
|
168
|
+
'factor': factor,
|
169
|
+
'diag': diag}
|
170
|
+
|
171
|
+
res = _root_hybr(_wrapped_func, x0, args, jac=fprime, **options)
|
172
|
+
res.nfev = _wrapped_func.nfev
|
173
|
+
|
174
|
+
if full_output:
|
175
|
+
x = res['x']
|
176
|
+
info = {k: res.get(k)
|
177
|
+
for k in ('nfev', 'njev', 'fjac', 'r', 'qtf') if k in res}
|
178
|
+
info['fvec'] = res['fun']
|
179
|
+
return x, info, res['status'], res['message']
|
180
|
+
else:
|
181
|
+
status = res['status']
|
182
|
+
msg = res['message']
|
183
|
+
if status == 0:
|
184
|
+
raise TypeError(msg)
|
185
|
+
elif status == 1:
|
186
|
+
pass
|
187
|
+
elif status in [2, 3, 4, 5]:
|
188
|
+
warnings.warn(msg, RuntimeWarning, stacklevel=2)
|
189
|
+
else:
|
190
|
+
raise TypeError(msg)
|
191
|
+
return res['x']
|
192
|
+
|
193
|
+
|
194
|
+
def _root_hybr(func, x0, args=(), jac=None,
|
195
|
+
col_deriv=0, xtol=1.49012e-08, maxfev=0, band=None, eps=None,
|
196
|
+
factor=100, diag=None, **unknown_options):
|
197
|
+
"""
|
198
|
+
Find the roots of a multivariate function using MINPACK's hybrd and
|
199
|
+
hybrj routines (modified Powell method).
|
200
|
+
|
201
|
+
Options
|
202
|
+
-------
|
203
|
+
col_deriv : bool
|
204
|
+
Specify whether the Jacobian function computes derivatives down
|
205
|
+
the columns (faster, because there is no transpose operation).
|
206
|
+
xtol : float
|
207
|
+
The calculation will terminate if the relative error between two
|
208
|
+
consecutive iterates is at most `xtol`.
|
209
|
+
maxfev : int
|
210
|
+
The maximum number of calls to the function. If zero, then
|
211
|
+
``100*(N+1)`` is the maximum where N is the number of elements
|
212
|
+
in `x0`.
|
213
|
+
band : tuple
|
214
|
+
If set to a two-sequence containing the number of sub- and
|
215
|
+
super-diagonals within the band of the Jacobi matrix, the
|
216
|
+
Jacobi matrix is considered banded (only for ``jac=None``).
|
217
|
+
eps : float
|
218
|
+
A suitable step length for the forward-difference
|
219
|
+
approximation of the Jacobian (for ``jac=None``). If
|
220
|
+
`eps` is less than the machine precision, it is assumed
|
221
|
+
that the relative errors in the functions are of the order of
|
222
|
+
the machine precision.
|
223
|
+
factor : float
|
224
|
+
A parameter determining the initial step bound
|
225
|
+
(``factor * || diag * x||``). Should be in the interval
|
226
|
+
``(0.1, 100)``.
|
227
|
+
diag : sequence
|
228
|
+
N positive entries that serve as a scale factors for the
|
229
|
+
variables.
|
230
|
+
|
231
|
+
"""
|
232
|
+
_check_unknown_options(unknown_options)
|
233
|
+
epsfcn = eps
|
234
|
+
|
235
|
+
x0 = asarray(x0).flatten()
|
236
|
+
n = len(x0)
|
237
|
+
if not isinstance(args, tuple):
|
238
|
+
args = (args,)
|
239
|
+
shape, dtype = _check_func('fsolve', 'func', func, x0, args, n, (n,))
|
240
|
+
if epsfcn is None:
|
241
|
+
epsfcn = finfo(dtype).eps
|
242
|
+
Dfun = jac
|
243
|
+
if Dfun is None:
|
244
|
+
if band is None:
|
245
|
+
ml, mu = -10, -10
|
246
|
+
else:
|
247
|
+
ml, mu = band[:2]
|
248
|
+
if maxfev == 0:
|
249
|
+
maxfev = 200 * (n + 1)
|
250
|
+
retval = _minpack._hybrd(func, x0, args, 1, xtol, maxfev,
|
251
|
+
ml, mu, epsfcn, factor, diag)
|
252
|
+
else:
|
253
|
+
_check_func('fsolve', 'fprime', Dfun, x0, args, n, (n, n))
|
254
|
+
if (maxfev == 0):
|
255
|
+
maxfev = 100 * (n + 1)
|
256
|
+
retval = _minpack._hybrj(func, Dfun, x0, args, 1,
|
257
|
+
col_deriv, xtol, maxfev, factor, diag)
|
258
|
+
|
259
|
+
x, status = retval[0], retval[-1]
|
260
|
+
|
261
|
+
errors = {0: "Improper input parameters were entered.",
|
262
|
+
1: "The solution converged.",
|
263
|
+
2: "The number of calls to function has "
|
264
|
+
f"reached maxfev = {maxfev}.",
|
265
|
+
3: f"xtol={xtol:f} is too small, no further improvement "
|
266
|
+
"in the approximate\n solution is possible.",
|
267
|
+
4: "The iteration is not making good progress, as measured "
|
268
|
+
"by the \n improvement from the last five "
|
269
|
+
"Jacobian evaluations.",
|
270
|
+
5: "The iteration is not making good progress, "
|
271
|
+
"as measured by the \n improvement from the last "
|
272
|
+
"ten iterations.",
|
273
|
+
'unknown': "An error occurred."}
|
274
|
+
|
275
|
+
info = retval[1]
|
276
|
+
info['fun'] = info.pop('fvec')
|
277
|
+
sol = OptimizeResult(x=x, success=(status == 1), status=status,
|
278
|
+
method="hybr")
|
279
|
+
sol.update(info)
|
280
|
+
try:
|
281
|
+
sol['message'] = errors[status]
|
282
|
+
except KeyError:
|
283
|
+
sol['message'] = errors['unknown']
|
284
|
+
|
285
|
+
return sol
|
286
|
+
|
287
|
+
|
288
|
+
LEASTSQ_SUCCESS = [1, 2, 3, 4]
|
289
|
+
LEASTSQ_FAILURE = [5, 6, 7, 8]
|
290
|
+
|
291
|
+
|
292
|
+
def leastsq(func, x0, args=(), Dfun=None, full_output=False,
|
293
|
+
col_deriv=False, ftol=1.49012e-8, xtol=1.49012e-8,
|
294
|
+
gtol=0.0, maxfev=0, epsfcn=None, factor=100, diag=None):
|
295
|
+
"""
|
296
|
+
Minimize the sum of squares of a set of equations.
|
297
|
+
|
298
|
+
::
|
299
|
+
|
300
|
+
x = arg min(sum(func(y)**2,axis=0))
|
301
|
+
y
|
302
|
+
|
303
|
+
Parameters
|
304
|
+
----------
|
305
|
+
func : callable
|
306
|
+
Should take at least one (possibly length ``N`` vector) argument and
|
307
|
+
returns ``M`` floating point numbers. It must not return NaNs or
|
308
|
+
fitting might fail. ``M`` must be greater than or equal to ``N``.
|
309
|
+
x0 : ndarray
|
310
|
+
The starting estimate for the minimization.
|
311
|
+
args : tuple, optional
|
312
|
+
Any extra arguments to func are placed in this tuple.
|
313
|
+
Dfun : callable, optional
|
314
|
+
A function or method to compute the Jacobian of func with derivatives
|
315
|
+
across the rows. If this is None, the Jacobian will be estimated.
|
316
|
+
full_output : bool, optional
|
317
|
+
If ``True``, return all optional outputs (not just `x` and `ier`).
|
318
|
+
col_deriv : bool, optional
|
319
|
+
If ``True``, specify that the Jacobian function computes derivatives
|
320
|
+
down the columns (faster, because there is no transpose operation).
|
321
|
+
ftol : float, optional
|
322
|
+
Relative error desired in the sum of squares.
|
323
|
+
xtol : float, optional
|
324
|
+
Relative error desired in the approximate solution.
|
325
|
+
gtol : float, optional
|
326
|
+
Orthogonality desired between the function vector and the columns of
|
327
|
+
the Jacobian.
|
328
|
+
maxfev : int, optional
|
329
|
+
The maximum number of calls to the function. If `Dfun` is provided,
|
330
|
+
then the default `maxfev` is 100*(N+1) where N is the number of elements
|
331
|
+
in x0, otherwise the default `maxfev` is 200*(N+1).
|
332
|
+
epsfcn : float, optional
|
333
|
+
A variable used in determining a suitable step length for the forward-
|
334
|
+
difference approximation of the Jacobian (for Dfun=None).
|
335
|
+
Normally the actual step length will be sqrt(epsfcn)*x
|
336
|
+
If epsfcn is less than the machine precision, it is assumed that the
|
337
|
+
relative errors are of the order of the machine precision.
|
338
|
+
factor : float, optional
|
339
|
+
A parameter determining the initial step bound
|
340
|
+
(``factor * || diag * x||``). Should be in interval ``(0.1, 100)``.
|
341
|
+
diag : sequence, optional
|
342
|
+
N positive entries that serve as a scale factors for the variables.
|
343
|
+
|
344
|
+
Returns
|
345
|
+
-------
|
346
|
+
x : ndarray
|
347
|
+
The solution (or the result of the last iteration for an unsuccessful
|
348
|
+
call).
|
349
|
+
cov_x : ndarray
|
350
|
+
The inverse of the Hessian. `fjac` and `ipvt` are used to construct an
|
351
|
+
estimate of the Hessian. A value of None indicates a singular matrix,
|
352
|
+
which means the curvature in parameters `x` is numerically flat. To
|
353
|
+
obtain the covariance matrix of the parameters `x`, `cov_x` must be
|
354
|
+
multiplied by the variance of the residuals -- see curve_fit. Only
|
355
|
+
returned if `full_output` is ``True``.
|
356
|
+
infodict : dict
|
357
|
+
a dictionary of optional outputs with the keys:
|
358
|
+
|
359
|
+
``nfev``
|
360
|
+
The number of function calls
|
361
|
+
``fvec``
|
362
|
+
The function evaluated at the output
|
363
|
+
``fjac``
|
364
|
+
A permutation of the R matrix of a QR
|
365
|
+
factorization of the final approximate
|
366
|
+
Jacobian matrix, stored column wise.
|
367
|
+
Together with ipvt, the covariance of the
|
368
|
+
estimate can be approximated.
|
369
|
+
``ipvt``
|
370
|
+
An integer array of length N which defines
|
371
|
+
a permutation matrix, p, such that
|
372
|
+
fjac*p = q*r, where r is upper triangular
|
373
|
+
with diagonal elements of nonincreasing
|
374
|
+
magnitude. Column j of p is column ipvt(j)
|
375
|
+
of the identity matrix.
|
376
|
+
``qtf``
|
377
|
+
The vector (transpose(q) * fvec).
|
378
|
+
|
379
|
+
Only returned if `full_output` is ``True``.
|
380
|
+
mesg : str
|
381
|
+
A string message giving information about the cause of failure.
|
382
|
+
Only returned if `full_output` is ``True``.
|
383
|
+
ier : int
|
384
|
+
An integer flag. If it is equal to 1, 2, 3 or 4, the solution was
|
385
|
+
found. Otherwise, the solution was not found. In either case, the
|
386
|
+
optional output variable 'mesg' gives more information.
|
387
|
+
|
388
|
+
See Also
|
389
|
+
--------
|
390
|
+
least_squares : Newer interface to solve nonlinear least-squares problems
|
391
|
+
with bounds on the variables. See ``method='lm'`` in particular.
|
392
|
+
|
393
|
+
Notes
|
394
|
+
-----
|
395
|
+
"leastsq" is a wrapper around MINPACK's lmdif and lmder algorithms.
|
396
|
+
|
397
|
+
cov_x is a Jacobian approximation to the Hessian of the least squares
|
398
|
+
objective function.
|
399
|
+
This approximation assumes that the objective function is based on the
|
400
|
+
difference between some observed target data (ydata) and a (non-linear)
|
401
|
+
function of the parameters `f(xdata, params)` ::
|
402
|
+
|
403
|
+
func(params) = ydata - f(xdata, params)
|
404
|
+
|
405
|
+
so that the objective function is ::
|
406
|
+
|
407
|
+
min sum((ydata - f(xdata, params))**2, axis=0)
|
408
|
+
params
|
409
|
+
|
410
|
+
The solution, `x`, is always a 1-D array, regardless of the shape of `x0`,
|
411
|
+
or whether `x0` is a scalar.
|
412
|
+
|
413
|
+
Examples
|
414
|
+
--------
|
415
|
+
>>> from scipy.optimize import leastsq
|
416
|
+
>>> def func(x):
|
417
|
+
... return 2*(x-3)**2+1
|
418
|
+
>>> leastsq(func, 0)
|
419
|
+
(array([2.99999999]), 1)
|
420
|
+
|
421
|
+
"""
|
422
|
+
x0 = asarray(x0).flatten()
|
423
|
+
n = len(x0)
|
424
|
+
if not isinstance(args, tuple):
|
425
|
+
args = (args,)
|
426
|
+
shape, dtype = _check_func('leastsq', 'func', func, x0, args, n)
|
427
|
+
m = shape[0]
|
428
|
+
|
429
|
+
if n > m:
|
430
|
+
raise TypeError(f"Improper input: func input vector length N={n} must"
|
431
|
+
f" not exceed func output vector length M={m}")
|
432
|
+
|
433
|
+
if epsfcn is None:
|
434
|
+
epsfcn = finfo(dtype).eps
|
435
|
+
|
436
|
+
if Dfun is None:
|
437
|
+
if maxfev == 0:
|
438
|
+
maxfev = 200*(n + 1)
|
439
|
+
retval = _minpack._lmdif(func, x0, args, full_output, ftol, xtol,
|
440
|
+
gtol, maxfev, epsfcn, factor, diag)
|
441
|
+
else:
|
442
|
+
if col_deriv:
|
443
|
+
_check_func('leastsq', 'Dfun', Dfun, x0, args, n, (n, m))
|
444
|
+
else:
|
445
|
+
_check_func('leastsq', 'Dfun', Dfun, x0, args, n, (m, n))
|
446
|
+
if maxfev == 0:
|
447
|
+
maxfev = 100 * (n + 1)
|
448
|
+
retval = _minpack._lmder(func, Dfun, x0, args, full_output,
|
449
|
+
col_deriv, ftol, xtol, gtol, maxfev,
|
450
|
+
factor, diag)
|
451
|
+
|
452
|
+
errors = {0: ["Improper input parameters.", TypeError],
|
453
|
+
1: ["Both actual and predicted relative reductions "
|
454
|
+
f"in the sum of squares\n are at most {ftol:f}", None],
|
455
|
+
2: ["The relative error between two consecutive "
|
456
|
+
f"iterates is at most {xtol:f}", None],
|
457
|
+
3: ["Both actual and predicted relative reductions in "
|
458
|
+
f"the sum of squares\n are at most {ftol:f} and the "
|
459
|
+
"relative error between two consecutive "
|
460
|
+
f"iterates is at \n most {xtol:f}", None],
|
461
|
+
4: ["The cosine of the angle between func(x) and any "
|
462
|
+
f"column of the\n Jacobian is at most {gtol:f} in "
|
463
|
+
"absolute value", None],
|
464
|
+
5: ["Number of calls to function has reached "
|
465
|
+
f"maxfev = {maxfev}.", ValueError],
|
466
|
+
6: [f"ftol={ftol:f} is too small, no further reduction "
|
467
|
+
"in the sum of squares\n is possible.",
|
468
|
+
ValueError],
|
469
|
+
7: [f"xtol={xtol:f} is too small, no further improvement in "
|
470
|
+
"the approximate\n solution is possible.",
|
471
|
+
ValueError],
|
472
|
+
8: [f"gtol={gtol:f} is too small, func(x) is orthogonal to the "
|
473
|
+
"columns of\n the Jacobian to machine precision.", ValueError]}
|
474
|
+
|
475
|
+
# The FORTRAN return value (possible return values are >= 0 and <= 8)
|
476
|
+
info = retval[-1]
|
477
|
+
|
478
|
+
if full_output:
|
479
|
+
cov_x = None
|
480
|
+
if info in LEASTSQ_SUCCESS:
|
481
|
+
# This was
|
482
|
+
# perm = take(eye(n), retval[1]['ipvt'] - 1, 0)
|
483
|
+
# r = triu(transpose(retval[1]['fjac'])[:n, :])
|
484
|
+
# R = dot(r, perm)
|
485
|
+
# cov_x = inv(dot(transpose(R), R))
|
486
|
+
# but the explicit dot product was not necessary and sometimes
|
487
|
+
# the result was not symmetric positive definite. See gh-4555.
|
488
|
+
perm = retval[1]['ipvt']
|
489
|
+
n = len(perm)
|
490
|
+
r = triu(transpose(retval[1]['fjac'])[:n, :])
|
491
|
+
inv_triu = linalg.get_lapack_funcs('trtri', (r,))
|
492
|
+
try:
|
493
|
+
# inverse of permuted matrix is a permutation of matrix inverse
|
494
|
+
invR, trtri_info = inv_triu(r) # default: upper, non-unit diag
|
495
|
+
if trtri_info != 0: # explicit comparison for readability
|
496
|
+
raise LinAlgError(f'trtri returned info {trtri_info}')
|
497
|
+
invR[perm] = invR.copy()
|
498
|
+
cov_x = invR @ invR.T
|
499
|
+
except (LinAlgError, ValueError):
|
500
|
+
pass
|
501
|
+
return (retval[0], cov_x) + retval[1:-1] + (errors[info][0], info)
|
502
|
+
else:
|
503
|
+
if info in LEASTSQ_FAILURE:
|
504
|
+
warnings.warn(errors[info][0], RuntimeWarning, stacklevel=2)
|
505
|
+
elif info == 0:
|
506
|
+
raise errors[info][1](errors[info][0])
|
507
|
+
return retval[0], info
|
508
|
+
|
509
|
+
|
510
|
+
def _lightweight_memoizer(f):
|
511
|
+
# very shallow memoization to address gh-13670: only remember the first set
|
512
|
+
# of parameters and corresponding function value, and only attempt to use
|
513
|
+
# them twice (the number of times the function is evaluated at x0).
|
514
|
+
def _memoized_func(params):
|
515
|
+
if _memoized_func.skip_lookup:
|
516
|
+
return f(params)
|
517
|
+
|
518
|
+
if np.all(_memoized_func.last_params == params):
|
519
|
+
return _memoized_func.last_val
|
520
|
+
elif _memoized_func.last_params is not None:
|
521
|
+
_memoized_func.skip_lookup = True
|
522
|
+
|
523
|
+
val = f(params)
|
524
|
+
|
525
|
+
if _memoized_func.last_params is None:
|
526
|
+
_memoized_func.last_params = np.copy(params)
|
527
|
+
_memoized_func.last_val = val
|
528
|
+
|
529
|
+
return val
|
530
|
+
|
531
|
+
_memoized_func.last_params = None
|
532
|
+
_memoized_func.last_val = None
|
533
|
+
_memoized_func.skip_lookup = False
|
534
|
+
return _memoized_func
|
535
|
+
|
536
|
+
|
537
|
+
def _wrap_func(func, xdata, ydata, transform):
|
538
|
+
if transform is None:
|
539
|
+
def func_wrapped(params):
|
540
|
+
return func(xdata, *params) - ydata
|
541
|
+
elif transform.size == 1 or transform.ndim == 1:
|
542
|
+
def func_wrapped(params):
|
543
|
+
return transform * (func(xdata, *params) - ydata)
|
544
|
+
else:
|
545
|
+
# Chisq = (y - yd)^T C^{-1} (y-yd)
|
546
|
+
# transform = L such that C = L L^T
|
547
|
+
# C^{-1} = L^{-T} L^{-1}
|
548
|
+
# Chisq = (y - yd)^T L^{-T} L^{-1} (y-yd)
|
549
|
+
# Define (y-yd)' = L^{-1} (y-yd)
|
550
|
+
# by solving
|
551
|
+
# L (y-yd)' = (y-yd)
|
552
|
+
# and minimize (y-yd)'^T (y-yd)'
|
553
|
+
def func_wrapped(params):
|
554
|
+
return solve_triangular(transform, func(xdata, *params) - ydata, lower=True)
|
555
|
+
return func_wrapped
|
556
|
+
|
557
|
+
|
558
|
+
def _wrap_jac(jac, xdata, transform):
|
559
|
+
if transform is None:
|
560
|
+
def jac_wrapped(params):
|
561
|
+
return jac(xdata, *params)
|
562
|
+
elif transform.ndim == 1:
|
563
|
+
def jac_wrapped(params):
|
564
|
+
return transform[:, np.newaxis] * np.asarray(jac(xdata, *params))
|
565
|
+
else:
|
566
|
+
def jac_wrapped(params):
|
567
|
+
return solve_triangular(transform,
|
568
|
+
np.asarray(jac(xdata, *params)),
|
569
|
+
lower=True)
|
570
|
+
return jac_wrapped
|
571
|
+
|
572
|
+
|
573
|
+
def _initialize_feasible(lb, ub):
|
574
|
+
p0 = np.ones_like(lb)
|
575
|
+
lb_finite = np.isfinite(lb)
|
576
|
+
ub_finite = np.isfinite(ub)
|
577
|
+
|
578
|
+
mask = lb_finite & ub_finite
|
579
|
+
p0[mask] = 0.5 * (lb[mask] + ub[mask])
|
580
|
+
|
581
|
+
mask = lb_finite & ~ub_finite
|
582
|
+
p0[mask] = lb[mask] + 1
|
583
|
+
|
584
|
+
mask = ~lb_finite & ub_finite
|
585
|
+
p0[mask] = ub[mask] - 1
|
586
|
+
|
587
|
+
return p0
|
588
|
+
|
589
|
+
|
590
|
+
def curve_fit(f, xdata, ydata, p0=None, sigma=None, absolute_sigma=False,
|
591
|
+
check_finite=None, bounds=(-np.inf, np.inf), method=None,
|
592
|
+
jac=None, *, full_output=False, nan_policy=None,
|
593
|
+
**kwargs):
|
594
|
+
"""
|
595
|
+
Use non-linear least squares to fit a function, f, to data.
|
596
|
+
|
597
|
+
Assumes ``ydata = f(xdata, *params) + eps``.
|
598
|
+
|
599
|
+
Parameters
|
600
|
+
----------
|
601
|
+
f : callable
|
602
|
+
The model function, f(x, ...). It must take the independent
|
603
|
+
variable as the first argument and the parameters to fit as
|
604
|
+
separate remaining arguments.
|
605
|
+
xdata : array_like
|
606
|
+
The independent variable where the data is measured.
|
607
|
+
Should usually be an M-length sequence or an (k,M)-shaped array for
|
608
|
+
functions with k predictors, and each element should be float
|
609
|
+
convertible if it is an array like object.
|
610
|
+
ydata : array_like
|
611
|
+
The dependent data, a length M array - nominally ``f(xdata, ...)``.
|
612
|
+
p0 : array_like, optional
|
613
|
+
Initial guess for the parameters (length N). If None, then the
|
614
|
+
initial values will all be 1 (if the number of parameters for the
|
615
|
+
function can be determined using introspection, otherwise a
|
616
|
+
ValueError is raised).
|
617
|
+
sigma : None or scalar or M-length sequence or MxM array, optional
|
618
|
+
Determines the uncertainty in `ydata`. If we define residuals as
|
619
|
+
``r = ydata - f(xdata, *popt)``, then the interpretation of `sigma`
|
620
|
+
depends on its number of dimensions:
|
621
|
+
|
622
|
+
- A scalar or 1-D `sigma` should contain values of standard deviations of
|
623
|
+
errors in `ydata`. In this case, the optimized function is
|
624
|
+
``chisq = sum((r / sigma) ** 2)``.
|
625
|
+
|
626
|
+
- A 2-D `sigma` should contain the covariance matrix of
|
627
|
+
errors in `ydata`. In this case, the optimized function is
|
628
|
+
``chisq = r.T @ inv(sigma) @ r``.
|
629
|
+
|
630
|
+
.. versionadded:: 0.19
|
631
|
+
|
632
|
+
None (default) is equivalent of 1-D `sigma` filled with ones.
|
633
|
+
absolute_sigma : bool, optional
|
634
|
+
If True, `sigma` is used in an absolute sense and the estimated parameter
|
635
|
+
covariance `pcov` reflects these absolute values.
|
636
|
+
|
637
|
+
If False (default), only the relative magnitudes of the `sigma` values matter.
|
638
|
+
The returned parameter covariance matrix `pcov` is based on scaling
|
639
|
+
`sigma` by a constant factor. This constant is set by demanding that the
|
640
|
+
reduced `chisq` for the optimal parameters `popt` when using the
|
641
|
+
*scaled* `sigma` equals unity. In other words, `sigma` is scaled to
|
642
|
+
match the sample variance of the residuals after the fit. Default is False.
|
643
|
+
Mathematically,
|
644
|
+
``pcov(absolute_sigma=False) = pcov(absolute_sigma=True) * chisq(popt)/(M-N)``
|
645
|
+
check_finite : bool, optional
|
646
|
+
If True, check that the input arrays do not contain nans of infs,
|
647
|
+
and raise a ValueError if they do. Setting this parameter to
|
648
|
+
False may silently produce nonsensical results if the input arrays
|
649
|
+
do contain nans. Default is True if `nan_policy` is not specified
|
650
|
+
explicitly and False otherwise.
|
651
|
+
bounds : 2-tuple of array_like or `Bounds`, optional
|
652
|
+
Lower and upper bounds on parameters. Defaults to no bounds.
|
653
|
+
There are two ways to specify the bounds:
|
654
|
+
|
655
|
+
- Instance of `Bounds` class.
|
656
|
+
|
657
|
+
- 2-tuple of array_like: Each element of the tuple must be either
|
658
|
+
an array with the length equal to the number of parameters, or a
|
659
|
+
scalar (in which case the bound is taken to be the same for all
|
660
|
+
parameters). Use ``np.inf`` with an appropriate sign to disable
|
661
|
+
bounds on all or some parameters.
|
662
|
+
|
663
|
+
method : {'lm', 'trf', 'dogbox'}, optional
|
664
|
+
Method to use for optimization. See `least_squares` for more details.
|
665
|
+
Default is 'lm' for unconstrained problems and 'trf' if `bounds` are
|
666
|
+
provided. The method 'lm' won't work when the number of observations
|
667
|
+
is less than the number of variables, use 'trf' or 'dogbox' in this
|
668
|
+
case.
|
669
|
+
|
670
|
+
.. versionadded:: 0.17
|
671
|
+
jac : callable, string or None, optional
|
672
|
+
Function with signature ``jac(x, ...)`` which computes the Jacobian
|
673
|
+
matrix of the model function with respect to parameters as a dense
|
674
|
+
array_like structure. It will be scaled according to provided `sigma`.
|
675
|
+
If None (default), the Jacobian will be estimated numerically.
|
676
|
+
String keywords for 'trf' and 'dogbox' methods can be used to select
|
677
|
+
a finite difference scheme, see `least_squares`.
|
678
|
+
|
679
|
+
.. versionadded:: 0.18
|
680
|
+
full_output : boolean, optional
|
681
|
+
If True, this function returns additional information: `infodict`,
|
682
|
+
`mesg`, and `ier`.
|
683
|
+
|
684
|
+
.. versionadded:: 1.9
|
685
|
+
nan_policy : {'raise', 'omit', None}, optional
|
686
|
+
Defines how to handle when input contains nan.
|
687
|
+
The following options are available (default is None):
|
688
|
+
|
689
|
+
* 'raise': throws an error
|
690
|
+
* 'omit': performs the calculations ignoring nan values
|
691
|
+
* None: no special handling of NaNs is performed
|
692
|
+
(except what is done by check_finite); the behavior when NaNs
|
693
|
+
are present is implementation-dependent and may change.
|
694
|
+
|
695
|
+
Note that if this value is specified explicitly (not None),
|
696
|
+
`check_finite` will be set as False.
|
697
|
+
|
698
|
+
.. versionadded:: 1.11
|
699
|
+
**kwargs
|
700
|
+
Keyword arguments passed to `leastsq` for ``method='lm'`` or
|
701
|
+
`least_squares` otherwise.
|
702
|
+
|
703
|
+
Returns
|
704
|
+
-------
|
705
|
+
popt : array
|
706
|
+
Optimal values for the parameters so that the sum of the squared
|
707
|
+
residuals of ``f(xdata, *popt) - ydata`` is minimized.
|
708
|
+
pcov : 2-D array
|
709
|
+
The estimated approximate covariance of popt. The diagonals provide
|
710
|
+
the variance of the parameter estimate. To compute one standard
|
711
|
+
deviation errors on the parameters, use
|
712
|
+
``perr = np.sqrt(np.diag(pcov))``. Note that the relationship between
|
713
|
+
`cov` and parameter error estimates is derived based on a linear
|
714
|
+
approximation to the model function around the optimum [1]_.
|
715
|
+
When this approximation becomes inaccurate, `cov` may not provide an
|
716
|
+
accurate measure of uncertainty.
|
717
|
+
|
718
|
+
How the `sigma` parameter affects the estimated covariance
|
719
|
+
depends on `absolute_sigma` argument, as described above.
|
720
|
+
|
721
|
+
If the Jacobian matrix at the solution doesn't have a full rank, then
|
722
|
+
'lm' method returns a matrix filled with ``np.inf``, on the other hand
|
723
|
+
'trf' and 'dogbox' methods use Moore-Penrose pseudoinverse to compute
|
724
|
+
the covariance matrix. Covariance matrices with large condition numbers
|
725
|
+
(e.g. computed with `numpy.linalg.cond`) may indicate that results are
|
726
|
+
unreliable.
|
727
|
+
infodict : dict (returned only if `full_output` is True)
|
728
|
+
a dictionary of optional outputs with the keys:
|
729
|
+
|
730
|
+
``nfev``
|
731
|
+
The number of function calls. Methods 'trf' and 'dogbox' do not
|
732
|
+
count function calls for numerical Jacobian approximation,
|
733
|
+
as opposed to 'lm' method.
|
734
|
+
``fvec``
|
735
|
+
The residual values evaluated at the solution, for a 1-D `sigma`
|
736
|
+
this is ``(f(x, *popt) - ydata)/sigma``.
|
737
|
+
``fjac``
|
738
|
+
A permutation of the R matrix of a QR
|
739
|
+
factorization of the final approximate
|
740
|
+
Jacobian matrix, stored column wise.
|
741
|
+
Together with ipvt, the covariance of the
|
742
|
+
estimate can be approximated.
|
743
|
+
Method 'lm' only provides this information.
|
744
|
+
``ipvt``
|
745
|
+
An integer array of length N which defines
|
746
|
+
a permutation matrix, p, such that
|
747
|
+
fjac*p = q*r, where r is upper triangular
|
748
|
+
with diagonal elements of nonincreasing
|
749
|
+
magnitude. Column j of p is column ipvt(j)
|
750
|
+
of the identity matrix.
|
751
|
+
Method 'lm' only provides this information.
|
752
|
+
``qtf``
|
753
|
+
The vector (transpose(q) * fvec).
|
754
|
+
Method 'lm' only provides this information.
|
755
|
+
|
756
|
+
.. versionadded:: 1.9
|
757
|
+
mesg : str (returned only if `full_output` is True)
|
758
|
+
A string message giving information about the solution.
|
759
|
+
|
760
|
+
.. versionadded:: 1.9
|
761
|
+
ier : int (returned only if `full_output` is True)
|
762
|
+
An integer flag. If it is equal to 1, 2, 3 or 4, the solution was
|
763
|
+
found. Otherwise, the solution was not found. In either case, the
|
764
|
+
optional output variable `mesg` gives more information.
|
765
|
+
|
766
|
+
.. versionadded:: 1.9
|
767
|
+
|
768
|
+
Raises
|
769
|
+
------
|
770
|
+
ValueError
|
771
|
+
if either `ydata` or `xdata` contain NaNs, or if incompatible options
|
772
|
+
are used.
|
773
|
+
|
774
|
+
RuntimeError
|
775
|
+
if the least-squares minimization fails.
|
776
|
+
|
777
|
+
OptimizeWarning
|
778
|
+
if covariance of the parameters can not be estimated.
|
779
|
+
|
780
|
+
See Also
|
781
|
+
--------
|
782
|
+
least_squares : Minimize the sum of squares of nonlinear functions.
|
783
|
+
scipy.stats.linregress : Calculate a linear least squares regression for
|
784
|
+
two sets of measurements.
|
785
|
+
|
786
|
+
Notes
|
787
|
+
-----
|
788
|
+
Users should ensure that inputs `xdata`, `ydata`, and the output of `f`
|
789
|
+
are ``float64``, or else the optimization may return incorrect results.
|
790
|
+
|
791
|
+
With ``method='lm'``, the algorithm uses the Levenberg-Marquardt algorithm
|
792
|
+
through `leastsq`. Note that this algorithm can only deal with
|
793
|
+
unconstrained problems.
|
794
|
+
|
795
|
+
Box constraints can be handled by methods 'trf' and 'dogbox'. Refer to
|
796
|
+
the docstring of `least_squares` for more information.
|
797
|
+
|
798
|
+
Parameters to be fitted must have similar scale. Differences of multiple
|
799
|
+
orders of magnitude can lead to incorrect results. For the 'trf' and
|
800
|
+
'dogbox' methods, the `x_scale` keyword argument can be used to scale
|
801
|
+
the parameters.
|
802
|
+
|
803
|
+
`curve_fit` is for local optimization of parameters to minimize the sum of squares
|
804
|
+
of residuals. For global optimization, other choices of objective function, and
|
805
|
+
other advanced features, consider using SciPy's :ref:`tutorial_optimize_global`
|
806
|
+
tools or the `LMFIT <https://lmfit.github.io/lmfit-py/index.html>`_ package.
|
807
|
+
|
808
|
+
References
|
809
|
+
----------
|
810
|
+
.. [1] K. Vugrin et al. Confidence region estimation techniques for nonlinear
|
811
|
+
regression in groundwater flow: Three case studies. Water Resources
|
812
|
+
Research, Vol. 43, W03423, :doi:`10.1029/2005WR004804`
|
813
|
+
|
814
|
+
Examples
|
815
|
+
--------
|
816
|
+
>>> import numpy as np
|
817
|
+
>>> import matplotlib.pyplot as plt
|
818
|
+
>>> from scipy.optimize import curve_fit
|
819
|
+
|
820
|
+
>>> def func(x, a, b, c):
|
821
|
+
... return a * np.exp(-b * x) + c
|
822
|
+
|
823
|
+
Define the data to be fit with some noise:
|
824
|
+
|
825
|
+
>>> xdata = np.linspace(0, 4, 50)
|
826
|
+
>>> y = func(xdata, 2.5, 1.3, 0.5)
|
827
|
+
>>> rng = np.random.default_rng()
|
828
|
+
>>> y_noise = 0.2 * rng.normal(size=xdata.size)
|
829
|
+
>>> ydata = y + y_noise
|
830
|
+
>>> plt.plot(xdata, ydata, 'b-', label='data')
|
831
|
+
|
832
|
+
Fit for the parameters a, b, c of the function `func`:
|
833
|
+
|
834
|
+
>>> popt, pcov = curve_fit(func, xdata, ydata)
|
835
|
+
>>> popt
|
836
|
+
array([2.56274217, 1.37268521, 0.47427475])
|
837
|
+
>>> plt.plot(xdata, func(xdata, *popt), 'r-',
|
838
|
+
... label='fit: a=%5.3f, b=%5.3f, c=%5.3f' % tuple(popt))
|
839
|
+
|
840
|
+
Constrain the optimization to the region of ``0 <= a <= 3``,
|
841
|
+
``0 <= b <= 1`` and ``0 <= c <= 0.5``:
|
842
|
+
|
843
|
+
>>> popt, pcov = curve_fit(func, xdata, ydata, bounds=(0, [3., 1., 0.5]))
|
844
|
+
>>> popt
|
845
|
+
array([2.43736712, 1. , 0.34463856])
|
846
|
+
>>> plt.plot(xdata, func(xdata, *popt), 'g--',
|
847
|
+
... label='fit: a=%5.3f, b=%5.3f, c=%5.3f' % tuple(popt))
|
848
|
+
|
849
|
+
>>> plt.xlabel('x')
|
850
|
+
>>> plt.ylabel('y')
|
851
|
+
>>> plt.legend()
|
852
|
+
>>> plt.show()
|
853
|
+
|
854
|
+
For reliable results, the model `func` should not be overparametrized;
|
855
|
+
redundant parameters can cause unreliable covariance matrices and, in some
|
856
|
+
cases, poorer quality fits. As a quick check of whether the model may be
|
857
|
+
overparameterized, calculate the condition number of the covariance matrix:
|
858
|
+
|
859
|
+
>>> np.linalg.cond(pcov)
|
860
|
+
34.571092161547405 # may vary
|
861
|
+
|
862
|
+
The value is small, so it does not raise much concern. If, however, we were
|
863
|
+
to add a fourth parameter ``d`` to `func` with the same effect as ``a``:
|
864
|
+
|
865
|
+
>>> def func2(x, a, b, c, d):
|
866
|
+
... return a * d * np.exp(-b * x) + c # a and d are redundant
|
867
|
+
>>> popt, pcov = curve_fit(func2, xdata, ydata)
|
868
|
+
>>> np.linalg.cond(pcov)
|
869
|
+
1.13250718925596e+32 # may vary
|
870
|
+
|
871
|
+
Such a large value is cause for concern. The diagonal elements of the
|
872
|
+
covariance matrix, which is related to uncertainty of the fit, gives more
|
873
|
+
information:
|
874
|
+
|
875
|
+
>>> np.diag(pcov)
|
876
|
+
array([1.48814742e+29, 3.78596560e-02, 5.39253738e-03, 2.76417220e+28]) # may vary
|
877
|
+
|
878
|
+
Note that the first and last terms are much larger than the other elements,
|
879
|
+
suggesting that the optimal values of these parameters are ambiguous and
|
880
|
+
that only one of these parameters is needed in the model.
|
881
|
+
|
882
|
+
If the optimal parameters of `f` differ by multiple orders of magnitude, the
|
883
|
+
resulting fit can be inaccurate. Sometimes, `curve_fit` can fail to find any
|
884
|
+
results:
|
885
|
+
|
886
|
+
>>> ydata = func(xdata, 500000, 0.01, 15)
|
887
|
+
>>> try:
|
888
|
+
... popt, pcov = curve_fit(func, xdata, ydata, method = 'trf')
|
889
|
+
... except RuntimeError as e:
|
890
|
+
... print(e)
|
891
|
+
Optimal parameters not found: The maximum number of function evaluations is
|
892
|
+
exceeded.
|
893
|
+
|
894
|
+
If parameter scale is roughly known beforehand, it can be defined in
|
895
|
+
`x_scale` argument:
|
896
|
+
|
897
|
+
>>> popt, pcov = curve_fit(func, xdata, ydata, method = 'trf',
|
898
|
+
... x_scale = [1000, 1, 1])
|
899
|
+
>>> popt
|
900
|
+
array([5.00000000e+05, 1.00000000e-02, 1.49999999e+01])
|
901
|
+
"""
|
902
|
+
if p0 is None:
|
903
|
+
# determine number of parameters by inspecting the function
|
904
|
+
sig = _getfullargspec(f)
|
905
|
+
args = sig.args
|
906
|
+
if len(args) < 2:
|
907
|
+
raise ValueError("Unable to determine number of fit parameters.")
|
908
|
+
n = len(args) - 1
|
909
|
+
else:
|
910
|
+
p0 = np.atleast_1d(p0)
|
911
|
+
n = p0.size
|
912
|
+
|
913
|
+
if isinstance(bounds, Bounds):
|
914
|
+
lb, ub = bounds.lb, bounds.ub
|
915
|
+
else:
|
916
|
+
lb, ub = prepare_bounds(bounds, n)
|
917
|
+
if p0 is None:
|
918
|
+
p0 = _initialize_feasible(lb, ub)
|
919
|
+
|
920
|
+
bounded_problem = np.any((lb > -np.inf) | (ub < np.inf))
|
921
|
+
if method is None:
|
922
|
+
if bounded_problem:
|
923
|
+
method = 'trf'
|
924
|
+
else:
|
925
|
+
method = 'lm'
|
926
|
+
|
927
|
+
if method == 'lm' and bounded_problem:
|
928
|
+
raise ValueError("Method 'lm' only works for unconstrained problems. "
|
929
|
+
"Use 'trf' or 'dogbox' instead.")
|
930
|
+
|
931
|
+
if check_finite is None:
|
932
|
+
check_finite = True if nan_policy is None else False
|
933
|
+
|
934
|
+
# optimization may produce garbage for float32 inputs, cast them to float64
|
935
|
+
if check_finite:
|
936
|
+
ydata = np.asarray_chkfinite(ydata, float)
|
937
|
+
else:
|
938
|
+
ydata = np.asarray(ydata, float)
|
939
|
+
|
940
|
+
if isinstance(xdata, list | tuple | np.ndarray):
|
941
|
+
# `xdata` is passed straight to the user-defined `f`, so allow
|
942
|
+
# non-array_like `xdata`.
|
943
|
+
if check_finite:
|
944
|
+
xdata = np.asarray_chkfinite(xdata, float)
|
945
|
+
else:
|
946
|
+
xdata = np.asarray(xdata, float)
|
947
|
+
|
948
|
+
if ydata.size == 0:
|
949
|
+
raise ValueError("`ydata` must not be empty!")
|
950
|
+
|
951
|
+
# nan handling is needed only if check_finite is False because if True,
|
952
|
+
# the x-y data are already checked, and they don't contain nans.
|
953
|
+
if not check_finite and nan_policy is not None:
|
954
|
+
if nan_policy == "propagate":
|
955
|
+
msg = "`nan_policy='propagate'` is not supported by this function."
|
956
|
+
raise ValueError(msg)
|
957
|
+
if nan_policy not in ("raise", "omit"):
|
958
|
+
# Override error message raised by _contains_nan
|
959
|
+
msg = "nan_policy must be one of {None, 'raise', 'omit'}"
|
960
|
+
raise ValueError(msg)
|
961
|
+
|
962
|
+
x_contains_nan = _contains_nan(xdata, nan_policy)
|
963
|
+
y_contains_nan = _contains_nan(ydata, nan_policy)
|
964
|
+
|
965
|
+
if (x_contains_nan or y_contains_nan) and nan_policy == 'omit':
|
966
|
+
# ignore NaNs for N dimensional arrays
|
967
|
+
has_nan = np.isnan(xdata)
|
968
|
+
has_nan = has_nan.any(axis=tuple(range(has_nan.ndim-1)))
|
969
|
+
has_nan |= np.isnan(ydata)
|
970
|
+
|
971
|
+
xdata = xdata[..., ~has_nan]
|
972
|
+
ydata = ydata[~has_nan]
|
973
|
+
|
974
|
+
# Also omit the corresponding entries from sigma
|
975
|
+
if sigma is not None:
|
976
|
+
sigma = np.asarray(sigma)
|
977
|
+
if sigma.ndim == 1:
|
978
|
+
sigma = sigma[~has_nan]
|
979
|
+
elif sigma.ndim == 2:
|
980
|
+
sigma = sigma[~has_nan, :]
|
981
|
+
sigma = sigma[:, ~has_nan]
|
982
|
+
|
983
|
+
# Determine type of sigma
|
984
|
+
if sigma is not None:
|
985
|
+
sigma = np.asarray(sigma)
|
986
|
+
|
987
|
+
# if 1-D or a scalar, sigma are errors, define transform = 1/sigma
|
988
|
+
if sigma.size == 1 or sigma.shape == (ydata.size,):
|
989
|
+
transform = 1.0 / sigma
|
990
|
+
# if 2-D, sigma is the covariance matrix,
|
991
|
+
# define transform = L such that L L^T = C
|
992
|
+
elif sigma.shape == (ydata.size, ydata.size):
|
993
|
+
try:
|
994
|
+
# scipy.linalg.cholesky requires lower=True to return L L^T = A
|
995
|
+
transform = cholesky(sigma, lower=True)
|
996
|
+
except LinAlgError as e:
|
997
|
+
raise ValueError("`sigma` must be positive definite.") from e
|
998
|
+
else:
|
999
|
+
raise ValueError("`sigma` has incorrect shape.")
|
1000
|
+
else:
|
1001
|
+
transform = None
|
1002
|
+
|
1003
|
+
func = _lightweight_memoizer(_wrap_func(f, xdata, ydata, transform))
|
1004
|
+
|
1005
|
+
if callable(jac):
|
1006
|
+
jac = _lightweight_memoizer(_wrap_jac(jac, xdata, transform))
|
1007
|
+
elif jac is None and method != 'lm':
|
1008
|
+
jac = '2-point'
|
1009
|
+
|
1010
|
+
if 'args' in kwargs:
|
1011
|
+
# The specification for the model function `f` does not support
|
1012
|
+
# additional arguments. Refer to the `curve_fit` docstring for
|
1013
|
+
# acceptable call signatures of `f`.
|
1014
|
+
raise ValueError("'args' is not a supported keyword argument.")
|
1015
|
+
|
1016
|
+
if method == 'lm':
|
1017
|
+
# if ydata.size == 1, this might be used for broadcast.
|
1018
|
+
if ydata.size != 1 and n > ydata.size:
|
1019
|
+
raise TypeError(f"The number of func parameters={n} must not"
|
1020
|
+
f" exceed the number of data points={ydata.size}")
|
1021
|
+
res = leastsq(func, p0, Dfun=jac, full_output=1, **kwargs)
|
1022
|
+
popt, pcov, infodict, errmsg, ier = res
|
1023
|
+
ysize = len(infodict['fvec'])
|
1024
|
+
cost = np.sum(infodict['fvec'] ** 2)
|
1025
|
+
if ier not in [1, 2, 3, 4]:
|
1026
|
+
raise RuntimeError("Optimal parameters not found: " + errmsg)
|
1027
|
+
else:
|
1028
|
+
# Rename maxfev (leastsq) to max_nfev (least_squares), if specified.
|
1029
|
+
if 'max_nfev' not in kwargs:
|
1030
|
+
kwargs['max_nfev'] = kwargs.pop('maxfev', None)
|
1031
|
+
|
1032
|
+
res = least_squares(func, p0, jac=jac, bounds=bounds, method=method,
|
1033
|
+
**kwargs)
|
1034
|
+
|
1035
|
+
if not res.success:
|
1036
|
+
raise RuntimeError("Optimal parameters not found: " + res.message)
|
1037
|
+
|
1038
|
+
infodict = dict(nfev=res.nfev, fvec=res.fun)
|
1039
|
+
ier = res.status
|
1040
|
+
errmsg = res.message
|
1041
|
+
|
1042
|
+
ysize = len(res.fun)
|
1043
|
+
cost = 2 * res.cost # res.cost is half sum of squares!
|
1044
|
+
popt = res.x
|
1045
|
+
|
1046
|
+
# Do Moore-Penrose inverse discarding zero singular values.
|
1047
|
+
_, s, VT = svd(res.jac, full_matrices=False)
|
1048
|
+
threshold = np.finfo(float).eps * max(res.jac.shape) * s[0]
|
1049
|
+
s = s[s > threshold]
|
1050
|
+
VT = VT[:s.size]
|
1051
|
+
pcov = np.dot(VT.T / s**2, VT)
|
1052
|
+
|
1053
|
+
warn_cov = False
|
1054
|
+
if pcov is None or np.isnan(pcov).any():
|
1055
|
+
# indeterminate covariance
|
1056
|
+
pcov = zeros((len(popt), len(popt)), dtype=float)
|
1057
|
+
pcov.fill(inf)
|
1058
|
+
warn_cov = True
|
1059
|
+
elif not absolute_sigma:
|
1060
|
+
if ysize > p0.size:
|
1061
|
+
s_sq = cost / (ysize - p0.size)
|
1062
|
+
pcov = pcov * s_sq
|
1063
|
+
else:
|
1064
|
+
pcov.fill(inf)
|
1065
|
+
warn_cov = True
|
1066
|
+
|
1067
|
+
if warn_cov:
|
1068
|
+
warnings.warn('Covariance of the parameters could not be estimated',
|
1069
|
+
category=OptimizeWarning, stacklevel=2)
|
1070
|
+
|
1071
|
+
if full_output:
|
1072
|
+
return popt, pcov, infodict, errmsg, ier
|
1073
|
+
else:
|
1074
|
+
return popt, pcov
|
1075
|
+
|
1076
|
+
|
1077
|
+
def check_gradient(fcn, Dfcn, x0, args=(), col_deriv=0):
|
1078
|
+
"""Perform a simple check on the gradient for correctness.
|
1079
|
+
|
1080
|
+
"""
|
1081
|
+
|
1082
|
+
x = atleast_1d(x0)
|
1083
|
+
n = len(x)
|
1084
|
+
x = x.reshape((n,))
|
1085
|
+
fvec = atleast_1d(fcn(x, *args))
|
1086
|
+
m = len(fvec)
|
1087
|
+
fvec = fvec.reshape((m,))
|
1088
|
+
ldfjac = m
|
1089
|
+
fjac = atleast_1d(Dfcn(x, *args))
|
1090
|
+
fjac = fjac.reshape((m, n))
|
1091
|
+
if col_deriv == 0:
|
1092
|
+
fjac = transpose(fjac)
|
1093
|
+
|
1094
|
+
xp = zeros((n,), float)
|
1095
|
+
err = zeros((m,), float)
|
1096
|
+
fvecp = None
|
1097
|
+
_minpack._chkder(m, n, x, fvec, fjac, ldfjac, xp, fvecp, 1, err)
|
1098
|
+
|
1099
|
+
fvecp = atleast_1d(fcn(xp, *args))
|
1100
|
+
fvecp = fvecp.reshape((m,))
|
1101
|
+
_minpack._chkder(m, n, x, fvec, fjac, ldfjac, xp, fvecp, 2, err)
|
1102
|
+
|
1103
|
+
good = (prod(greater(err, 0.5), axis=0))
|
1104
|
+
|
1105
|
+
return (good, err)
|
1106
|
+
|
1107
|
+
|
1108
|
+
def _del2(p0, p1, d):
|
1109
|
+
return p0 - np.square(p1 - p0) / d
|
1110
|
+
|
1111
|
+
|
1112
|
+
def _relerr(actual, desired):
|
1113
|
+
return (actual - desired) / desired
|
1114
|
+
|
1115
|
+
|
1116
|
+
def _fixed_point_helper(func, x0, args, xtol, maxiter, use_accel):
|
1117
|
+
p0 = x0
|
1118
|
+
for i in range(maxiter):
|
1119
|
+
p1 = func(p0, *args)
|
1120
|
+
if use_accel:
|
1121
|
+
p2 = func(p1, *args)
|
1122
|
+
d = p2 - 2.0 * p1 + p0
|
1123
|
+
p = xpx.apply_where(d != 0, (p0, p1, d), _del2, fill_value=p2)
|
1124
|
+
else:
|
1125
|
+
p = p1
|
1126
|
+
relerr = xpx.apply_where(p0 != 0, (p, p0), _relerr, fill_value=p)
|
1127
|
+
if np.all(np.abs(relerr) < xtol):
|
1128
|
+
return p
|
1129
|
+
p0 = p
|
1130
|
+
msg = f"Failed to converge after {maxiter} iterations, value is {p}"
|
1131
|
+
raise RuntimeError(msg)
|
1132
|
+
|
1133
|
+
|
1134
|
+
def fixed_point(func, x0, args=(), xtol=1e-8, maxiter=500, method='del2'):
|
1135
|
+
"""
|
1136
|
+
Find a fixed point of the function.
|
1137
|
+
|
1138
|
+
Given a function of one or more variables and a starting point, find a
|
1139
|
+
fixed point of the function: i.e., where ``func(x0) == x0``.
|
1140
|
+
|
1141
|
+
Parameters
|
1142
|
+
----------
|
1143
|
+
func : function
|
1144
|
+
Function to evaluate.
|
1145
|
+
x0 : array_like
|
1146
|
+
Fixed point of function.
|
1147
|
+
args : tuple, optional
|
1148
|
+
Extra arguments to `func`.
|
1149
|
+
xtol : float, optional
|
1150
|
+
Convergence tolerance, defaults to 1e-08.
|
1151
|
+
maxiter : int, optional
|
1152
|
+
Maximum number of iterations, defaults to 500.
|
1153
|
+
method : {"del2", "iteration"}, optional
|
1154
|
+
Method of finding the fixed-point, defaults to "del2",
|
1155
|
+
which uses Steffensen's Method with Aitken's ``Del^2``
|
1156
|
+
convergence acceleration [1]_. The "iteration" method simply iterates
|
1157
|
+
the function until convergence is detected, without attempting to
|
1158
|
+
accelerate the convergence.
|
1159
|
+
|
1160
|
+
References
|
1161
|
+
----------
|
1162
|
+
.. [1] Burden, Faires, "Numerical Analysis", 5th edition, pg. 80
|
1163
|
+
|
1164
|
+
Examples
|
1165
|
+
--------
|
1166
|
+
>>> import numpy as np
|
1167
|
+
>>> from scipy import optimize
|
1168
|
+
>>> def func(x, c1, c2):
|
1169
|
+
... return np.sqrt(c1/(x+c2))
|
1170
|
+
>>> c1 = np.array([10,12.])
|
1171
|
+
>>> c2 = np.array([3, 5.])
|
1172
|
+
>>> optimize.fixed_point(func, [1.2, 1.3], args=(c1,c2))
|
1173
|
+
array([ 1.4920333 , 1.37228132])
|
1174
|
+
|
1175
|
+
"""
|
1176
|
+
use_accel = {'del2': True, 'iteration': False}[method]
|
1177
|
+
x0 = _asarray_validated(x0, as_inexact=True)
|
1178
|
+
return _fixed_point_helper(func, x0, args, xtol, maxiter, use_accel)
|