scipy 1.16.2__cp313-cp313-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.cp313-win_arm64.lib +0 -0
- scipy/_cyutility.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/_lib/_ccallback_c.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/_lib/_fpumode.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/_lib/_test_ccallback.cp313-win_arm64.pyd +0 -0
- scipy/_lib/_test_deprecation_call.cp313-win_arm64.lib +0 -0
- scipy/_lib/_test_deprecation_call.cp313-win_arm64.pyd +0 -0
- scipy/_lib/_test_deprecation_def.cp313-win_arm64.lib +0 -0
- scipy/_lib/_test_deprecation_def.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/_lib/_uarray/_uarray.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/_lib/messagestream.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/cluster/_hierarchy.cp313-win_arm64.pyd +0 -0
- scipy/cluster/_optimal_leaf_ordering.cp313-win_arm64.lib +0 -0
- scipy/cluster/_optimal_leaf_ordering.cp313-win_arm64.pyd +0 -0
- scipy/cluster/_vq.cp313-win_arm64.lib +0 -0
- scipy/cluster/_vq.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/fft/_pocketfft/pypocketfft.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/fftpack/convolve.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/integrate/_dop.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/integrate/_lsoda.cp313-win_arm64.pyd +0 -0
- scipy/integrate/_ode.py +1395 -0
- scipy/integrate/_odepack.cp313-win_arm64.lib +0 -0
- scipy/integrate/_odepack.cp313-win_arm64.pyd +0 -0
- scipy/integrate/_odepack_py.py +273 -0
- scipy/integrate/_quad_vec.py +674 -0
- scipy/integrate/_quadpack.cp313-win_arm64.lib +0 -0
- scipy/integrate/_quadpack.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/integrate/_test_multivariate.cp313-win_arm64.pyd +0 -0
- scipy/integrate/_test_odeint_banded.cp313-win_arm64.lib +0 -0
- scipy/integrate/_test_odeint_banded.cp313-win_arm64.pyd +0 -0
- scipy/integrate/_vode.cp313-win_arm64.lib +0 -0
- scipy/integrate/_vode.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/interpolate/_dfitpack.cp313-win_arm64.pyd +0 -0
- scipy/interpolate/_dierckx.cp313-win_arm64.lib +0 -0
- scipy/interpolate/_dierckx.cp313-win_arm64.pyd +0 -0
- scipy/interpolate/_fitpack.cp313-win_arm64.lib +0 -0
- scipy/interpolate/_fitpack.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/interpolate/_interpnd.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/interpolate/_ppoly.cp313-win_arm64.pyd +0 -0
- scipy/interpolate/_rbf.py +290 -0
- scipy/interpolate/_rbfinterp.py +550 -0
- scipy/interpolate/_rbfinterp_pythran.cp313-win_arm64.lib +0 -0
- scipy/interpolate/_rbfinterp_pythran.cp313-win_arm64.pyd +0 -0
- scipy/interpolate/_rgi.py +764 -0
- scipy/interpolate/_rgi_cython.cp313-win_arm64.lib +0 -0
- scipy/interpolate/_rgi_cython.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/io/_fast_matrix_market/_fmm_core.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/io/_test_fortran.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/io/matlab/_mio5_utils.cp313-win_arm64.pyd +0 -0
- scipy/io/matlab/_mio_utils.cp313-win_arm64.lib +0 -0
- scipy/io/matlab/_mio_utils.cp313-win_arm64.pyd +0 -0
- scipy/io/matlab/_miobase.py +435 -0
- scipy/io/matlab/_streams.cp313-win_arm64.lib +0 -0
- scipy/io/matlab/_streams.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/linalg/_cythonized_array_utils.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/linalg/_decomp_interpolative.cp313-win_arm64.pyd +0 -0
- scipy/linalg/_decomp_ldl.py +356 -0
- scipy/linalg/_decomp_lu.py +401 -0
- scipy/linalg/_decomp_lu_cython.cp313-win_arm64.lib +0 -0
- scipy/linalg/_decomp_lu_cython.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/linalg/_decomp_update.cp313-win_arm64.pyd +0 -0
- scipy/linalg/_expm_frechet.py +417 -0
- scipy/linalg/_fblas.cp313-win_arm64.lib +0 -0
- scipy/linalg/_fblas.cp313-win_arm64.pyd +0 -0
- scipy/linalg/_flapack.cp313-win_arm64.lib +0 -0
- scipy/linalg/_flapack.cp313-win_arm64.pyd +0 -0
- scipy/linalg/_lapack_subroutines.h +1521 -0
- scipy/linalg/_linalg_pythran.cp313-win_arm64.lib +0 -0
- scipy/linalg/_linalg_pythran.cp313-win_arm64.pyd +0 -0
- scipy/linalg/_matfuncs.py +1050 -0
- scipy/linalg/_matfuncs_expm.cp313-win_arm64.lib +0 -0
- scipy/linalg/_matfuncs_expm.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/linalg/_matfuncs_schur_sqrtm.cp313-win_arm64.pyd +0 -0
- scipy/linalg/_matfuncs_sqrtm.py +107 -0
- scipy/linalg/_matfuncs_sqrtm_triu.cp313-win_arm64.lib +0 -0
- scipy/linalg/_matfuncs_sqrtm_triu.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/linalg/_solve_toeplitz.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/linalg/cython_blas.cp313-win_arm64.pyd +0 -0
- scipy/linalg/cython_blas.pxd +169 -0
- scipy/linalg/cython_blas.pyx +1432 -0
- scipy/linalg/cython_lapack.cp313-win_arm64.lib +0 -0
- scipy/linalg/cython_lapack.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/ndimage/_ctest.cp313-win_arm64.pyd +0 -0
- scipy/ndimage/_cytest.cp313-win_arm64.lib +0 -0
- scipy/ndimage/_cytest.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/ndimage/_nd_image.cp313-win_arm64.pyd +0 -0
- scipy/ndimage/_ndimage_api.py +16 -0
- scipy/ndimage/_ni_docstrings.py +214 -0
- scipy/ndimage/_ni_label.cp313-win_arm64.lib +0 -0
- scipy/ndimage/_ni_label.cp313-win_arm64.pyd +0 -0
- scipy/ndimage/_ni_support.py +139 -0
- scipy/ndimage/_rank_filter_1d.cp313-win_arm64.lib +0 -0
- scipy/ndimage/_rank_filter_1d.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/odr/__odrpack.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/optimize/_bglu_dense.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/optimize/_direct.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/optimize/_group_columns.cp313-win_arm64.pyd +0 -0
- scipy/optimize/_hessian_update_strategy.py +479 -0
- scipy/optimize/_highspy/__init__.py +0 -0
- scipy/optimize/_highspy/_core.cp313-win_arm64.lib +0 -0
- scipy/optimize/_highspy/_core.cp313-win_arm64.pyd +0 -0
- scipy/optimize/_highspy/_highs_options.cp313-win_arm64.lib +0 -0
- scipy/optimize/_highspy/_highs_options.cp313-win_arm64.pyd +0 -0
- scipy/optimize/_highspy/_highs_wrapper.py +338 -0
- scipy/optimize/_isotonic.py +157 -0
- scipy/optimize/_lbfgsb.cp313-win_arm64.lib +0 -0
- scipy/optimize/_lbfgsb.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/optimize/_lsap.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/optimize/_lsq/givens_elimination.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/optimize/_minpack.cp313-win_arm64.pyd +0 -0
- scipy/optimize/_minpack_py.py +1178 -0
- scipy/optimize/_moduleTNC.cp313-win_arm64.lib +0 -0
- scipy/optimize/_moduleTNC.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/optimize/_pava_pybind.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/optimize/_slsqplib.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/optimize/_trlib/_trlib.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/optimize/_zeros.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/optimize/cython_optimize/_zeros.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/signal/_max_len_seq_inner.cp313-win_arm64.pyd +0 -0
- scipy/signal/_peak_finding.py +1310 -0
- scipy/signal/_peak_finding_utils.cp313-win_arm64.lib +0 -0
- scipy/signal/_peak_finding_utils.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/signal/_sigtools.cp313-win_arm64.pyd +0 -0
- scipy/signal/_sosfilt.cp313-win_arm64.lib +0 -0
- scipy/signal/_sosfilt.cp313-win_arm64.pyd +0 -0
- scipy/signal/_spectral_py.py +2471 -0
- scipy/signal/_spline.cp313-win_arm64.lib +0 -0
- scipy/signal/_spline.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/signal/_upfirdn_apply.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/sparse/_csparsetools.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/sparse/_sparsetools.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_flow.cp313-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_laplacian.py +563 -0
- scipy/sparse/csgraph/_matching.cp313-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_matching.cp313-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_min_spanning_tree.cp313-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_min_spanning_tree.cp313-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_reordering.cp313-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_reordering.cp313-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_shortest_path.cp313-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_shortest_path.cp313-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_tools.cp313-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_tools.cp313-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_traversal.cp313-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_traversal.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/sparse/linalg/_dsolve/_superlu.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/sparse/linalg/_eigen/arpack/_arpack.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_cpropack.cp313-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_propack/_dpropack.cp313-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_dpropack.cp313-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_propack/_spropack.cp313-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_spropack.cp313-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_propack/_zpropack.cp313-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_zpropack.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/spatial/_ckdtree.cp313-win_arm64.pyd +0 -0
- scipy/spatial/_distance_pybind.cp313-win_arm64.lib +0 -0
- scipy/spatial/_distance_pybind.cp313-win_arm64.pyd +0 -0
- scipy/spatial/_distance_wrap.cp313-win_arm64.lib +0 -0
- scipy/spatial/_distance_wrap.cp313-win_arm64.pyd +0 -0
- scipy/spatial/_geometric_slerp.py +238 -0
- scipy/spatial/_hausdorff.cp313-win_arm64.lib +0 -0
- scipy/spatial/_hausdorff.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/spatial/_qhull.cp313-win_arm64.pyd +0 -0
- scipy/spatial/_qhull.pyi +213 -0
- scipy/spatial/_spherical_voronoi.py +341 -0
- scipy/spatial/_voronoi.cp313-win_arm64.lib +0 -0
- scipy/spatial/_voronoi.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/spatial/transform/_rigid_transform.cp313-win_arm64.pyd +0 -0
- scipy/spatial/transform/_rotation.cp313-win_arm64.lib +0 -0
- scipy/spatial/transform/_rotation.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/special/_comb.cp313-win_arm64.pyd +0 -0
- scipy/special/_ellip_harm.py +214 -0
- scipy/special/_ellip_harm_2.cp313-win_arm64.lib +0 -0
- scipy/special/_ellip_harm_2.cp313-win_arm64.pyd +0 -0
- scipy/special/_gufuncs.cp313-win_arm64.lib +0 -0
- scipy/special/_gufuncs.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/special/_specfun.cp313-win_arm64.pyd +0 -0
- scipy/special/_special_ufuncs.cp313-win_arm64.lib +0 -0
- scipy/special/_special_ufuncs.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/special/_test_internal.cp313-win_arm64.pyd +0 -0
- scipy/special/_test_internal.pyi +9 -0
- scipy/special/_testutils.py +321 -0
- scipy/special/_ufuncs.cp313-win_arm64.lib +0 -0
- scipy/special/_ufuncs.cp313-win_arm64.pyd +0 -0
- scipy/special/_ufuncs.pyi +522 -0
- scipy/special/_ufuncs.pyx +13173 -0
- scipy/special/_ufuncs_cxx.cp313-win_arm64.lib +0 -0
- scipy/special/_ufuncs_cxx.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/special/cython_special.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/stats/_ansari_swilk_statistics.cp313-win_arm64.pyd +0 -0
- scipy/stats/_axis_nan_policy.py +692 -0
- scipy/stats/_biasedurn.cp313-win_arm64.lib +0 -0
- scipy/stats/_biasedurn.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/stats/_levy_stable/levyst.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/stats/_qmc_cy.cp313-win_arm64.pyd +0 -0
- scipy/stats/_qmc_cy.pyi +54 -0
- scipy/stats/_qmvnt.py +454 -0
- scipy/stats/_qmvnt_cy.cp313-win_arm64.lib +0 -0
- scipy/stats/_qmvnt_cy.cp313-win_arm64.pyd +0 -0
- scipy/stats/_quantile.py +335 -0
- scipy/stats/_rcont/__init__.py +4 -0
- scipy/stats/_rcont/rcont.cp313-win_arm64.lib +0 -0
- scipy/stats/_rcont/rcont.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/stats/_sobol.cp313-win_arm64.pyd +0 -0
- scipy/stats/_sobol.pyi +54 -0
- scipy/stats/_sobol_direction_numbers.npz +0 -0
- scipy/stats/_stats.cp313-win_arm64.lib +0 -0
- scipy/stats/_stats.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/stats/_stats_pythran.cp313-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.cp313-win_arm64.lib +0 -0
- scipy/stats/_unuran/unuran_wrapper.cp313-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,2293 @@
|
|
1
|
+
"""
|
2
|
+
Test SciPy functions versus mpmath, if available.
|
3
|
+
|
4
|
+
"""
|
5
|
+
import numpy as np
|
6
|
+
from numpy.testing import assert_, assert_allclose, suppress_warnings
|
7
|
+
from numpy import pi
|
8
|
+
import pytest
|
9
|
+
import itertools
|
10
|
+
|
11
|
+
from scipy._lib import _pep440
|
12
|
+
|
13
|
+
import scipy.special as sc
|
14
|
+
from scipy.special._testutils import (
|
15
|
+
MissingModule, check_version, FuncData,
|
16
|
+
assert_func_equal)
|
17
|
+
from scipy.special._mptestutils import (
|
18
|
+
Arg, FixedArg, ComplexArg, IntArg, assert_mpmath_equal,
|
19
|
+
nonfunctional_tooslow, trace_args, time_limited, exception_to_nan,
|
20
|
+
inf_to_nan)
|
21
|
+
from scipy.special._ufuncs import (
|
22
|
+
_sinpi, _cospi, _lgam1p, _lanczos_sum_expg_scaled, _log1pmx,
|
23
|
+
_igam_fac)
|
24
|
+
|
25
|
+
try:
|
26
|
+
import mpmath
|
27
|
+
except ImportError:
|
28
|
+
mpmath = MissingModule('mpmath')
|
29
|
+
|
30
|
+
|
31
|
+
# ------------------------------------------------------------------------------
|
32
|
+
# expi
|
33
|
+
# ------------------------------------------------------------------------------
|
34
|
+
|
35
|
+
@check_version(mpmath, '0.10')
|
36
|
+
def test_expi_complex():
|
37
|
+
dataset = []
|
38
|
+
for r in np.logspace(-99, 2, 10):
|
39
|
+
for p in np.linspace(0, 2*np.pi, 30):
|
40
|
+
z = r*np.exp(1j*p)
|
41
|
+
dataset.append((z, complex(mpmath.ei(z))))
|
42
|
+
dataset = np.array(dataset, dtype=np.cdouble)
|
43
|
+
|
44
|
+
FuncData(sc.expi, dataset, 0, 1).check()
|
45
|
+
|
46
|
+
|
47
|
+
# ------------------------------------------------------------------------------
|
48
|
+
# expn
|
49
|
+
# ------------------------------------------------------------------------------
|
50
|
+
|
51
|
+
@check_version(mpmath, '0.19')
|
52
|
+
def test_expn_large_n():
|
53
|
+
# Test the transition to the asymptotic regime of n.
|
54
|
+
dataset = []
|
55
|
+
for n in [50, 51]:
|
56
|
+
for x in np.logspace(0, 4, 200):
|
57
|
+
with mpmath.workdps(100):
|
58
|
+
dataset.append((n, x, float(mpmath.expint(n, x))))
|
59
|
+
dataset = np.asarray(dataset)
|
60
|
+
|
61
|
+
FuncData(sc.expn, dataset, (0, 1), 2, rtol=1e-13).check()
|
62
|
+
|
63
|
+
# ------------------------------------------------------------------------------
|
64
|
+
# hyp0f1
|
65
|
+
# ------------------------------------------------------------------------------
|
66
|
+
|
67
|
+
|
68
|
+
@check_version(mpmath, '0.19')
|
69
|
+
def test_hyp0f1_gh5764():
|
70
|
+
# Do a small and somewhat systematic test that runs quickly
|
71
|
+
dataset = []
|
72
|
+
axis = [-99.5, -9.5, -0.5, 0.5, 9.5, 99.5]
|
73
|
+
for v in axis:
|
74
|
+
for x in axis:
|
75
|
+
for y in axis:
|
76
|
+
z = x + 1j*y
|
77
|
+
# mpmath computes the answer correctly at dps ~ 17 but
|
78
|
+
# fails for 20 < dps < 120 (uses a different method);
|
79
|
+
# set the dps high enough that this isn't an issue
|
80
|
+
with mpmath.workdps(120):
|
81
|
+
res = complex(mpmath.hyp0f1(v, z))
|
82
|
+
dataset.append((v, z, res))
|
83
|
+
dataset = np.array(dataset)
|
84
|
+
|
85
|
+
FuncData(lambda v, z: sc.hyp0f1(v.real, z), dataset, (0, 1), 2,
|
86
|
+
rtol=1e-13).check()
|
87
|
+
|
88
|
+
|
89
|
+
@check_version(mpmath, '0.19')
|
90
|
+
def test_hyp0f1_gh_1609():
|
91
|
+
# this is a regression test for gh-1609
|
92
|
+
vv = np.linspace(150, 180, 21)
|
93
|
+
af = sc.hyp0f1(vv, 0.5)
|
94
|
+
mf = np.array([mpmath.hyp0f1(v, 0.5) for v in vv])
|
95
|
+
assert_allclose(af, mf.astype(float), rtol=1e-12)
|
96
|
+
|
97
|
+
|
98
|
+
# ------------------------------------------------------------------------------
|
99
|
+
# hyperu
|
100
|
+
# ------------------------------------------------------------------------------
|
101
|
+
|
102
|
+
@check_version(mpmath, '1.1.0')
|
103
|
+
def test_hyperu_around_0():
|
104
|
+
dataset = []
|
105
|
+
# DLMF 13.2.14-15 test points.
|
106
|
+
for n in np.arange(-5, 5):
|
107
|
+
for b in np.linspace(-5, 5, 20):
|
108
|
+
a = -n
|
109
|
+
dataset.append((a, b, 0, float(mpmath.hyperu(a, b, 0))))
|
110
|
+
a = -n + b - 1
|
111
|
+
dataset.append((a, b, 0, float(mpmath.hyperu(a, b, 0))))
|
112
|
+
# DLMF 13.2.16-22 test points.
|
113
|
+
for a in [-10.5, -1.5, -0.5, 0, 0.5, 1, 10]:
|
114
|
+
for b in [-1.0, -0.5, 0, 0.5, 1, 1.5, 2, 2.5]:
|
115
|
+
dataset.append((a, b, 0, float(mpmath.hyperu(a, b, 0))))
|
116
|
+
dataset = np.array(dataset)
|
117
|
+
|
118
|
+
FuncData(sc.hyperu, dataset, (0, 1, 2), 3, rtol=1e-15, atol=5e-13).check()
|
119
|
+
|
120
|
+
|
121
|
+
# ------------------------------------------------------------------------------
|
122
|
+
# hyp2f1
|
123
|
+
# ------------------------------------------------------------------------------
|
124
|
+
|
125
|
+
@check_version(mpmath, '1.0.0')
|
126
|
+
def test_hyp2f1_strange_points():
|
127
|
+
pts = [
|
128
|
+
(2, -1, -1, 0.7), # expected: 2.4
|
129
|
+
(2, -2, -2, 0.7), # expected: 3.87
|
130
|
+
]
|
131
|
+
pts += list(itertools.product([2, 1, -0.7, -1000], repeat=4))
|
132
|
+
pts = [
|
133
|
+
(a, b, c, x) for a, b, c, x in pts
|
134
|
+
if b == c and round(b) == b and b < 0 and b != -1000
|
135
|
+
]
|
136
|
+
kw = dict(eliminate=True)
|
137
|
+
dataset = [p + (float(mpmath.hyp2f1(*p, **kw)),) for p in pts]
|
138
|
+
dataset = np.array(dataset, dtype=np.float64)
|
139
|
+
|
140
|
+
FuncData(sc.hyp2f1, dataset, (0,1,2,3), 4, rtol=1e-10).check()
|
141
|
+
|
142
|
+
|
143
|
+
@check_version(mpmath, '0.13')
|
144
|
+
def test_hyp2f1_real_some_points():
|
145
|
+
pts = [
|
146
|
+
(1, 2, 3, 0),
|
147
|
+
(1./3, 2./3, 5./6, 27./32),
|
148
|
+
(1./4, 1./2, 3./4, 80./81),
|
149
|
+
(2,-2, -3, 3),
|
150
|
+
(2, -3, -2, 3),
|
151
|
+
(2, -1.5, -1.5, 3),
|
152
|
+
(1, 2, 3, 0),
|
153
|
+
(0.7235, -1, -5, 0.3),
|
154
|
+
(0.25, 1./3, 2, 0.999),
|
155
|
+
(0.25, 1./3, 2, -1),
|
156
|
+
(2, 3, 5, 0.99),
|
157
|
+
(3./2, -0.5, 3, 0.99),
|
158
|
+
(2, 2.5, -3.25, 0.999),
|
159
|
+
(-8, 18.016500331508873, 10.805295997850628, 0.90875647507000001),
|
160
|
+
(-10, 900, -10.5, 0.99),
|
161
|
+
(-10, 900, 10.5, 0.99),
|
162
|
+
(-1, 2, 1, 1.0),
|
163
|
+
(-1, 2, 1, -1.0),
|
164
|
+
(-3, 13, 5, 1.0),
|
165
|
+
(-3, 13, 5, -1.0),
|
166
|
+
(0.5, 1 - 270.5, 1.5, 0.999**2), # from issue 1561
|
167
|
+
]
|
168
|
+
dataset = [p + (float(mpmath.hyp2f1(*p)),) for p in pts]
|
169
|
+
dataset = np.array(dataset, dtype=np.float64)
|
170
|
+
|
171
|
+
with np.errstate(invalid='ignore'):
|
172
|
+
FuncData(sc.hyp2f1, dataset, (0,1,2,3), 4, rtol=1e-10).check()
|
173
|
+
|
174
|
+
|
175
|
+
@check_version(mpmath, '0.14')
|
176
|
+
def test_hyp2f1_some_points_2():
|
177
|
+
# Taken from mpmath unit tests -- this point failed for mpmath 0.13 but
|
178
|
+
# was fixed in their SVN since then
|
179
|
+
pts = [
|
180
|
+
(112, (51,10), (-9,10), -0.99999),
|
181
|
+
(10,-900,10.5,0.99),
|
182
|
+
(10,-900,-10.5,0.99),
|
183
|
+
]
|
184
|
+
|
185
|
+
def fev(x):
|
186
|
+
if isinstance(x, tuple):
|
187
|
+
return float(x[0]) / x[1]
|
188
|
+
else:
|
189
|
+
return x
|
190
|
+
|
191
|
+
dataset = [tuple(map(fev, p)) + (float(mpmath.hyp2f1(*p)),) for p in pts]
|
192
|
+
dataset = np.array(dataset, dtype=np.float64)
|
193
|
+
|
194
|
+
FuncData(sc.hyp2f1, dataset, (0,1,2,3), 4, rtol=1e-10).check()
|
195
|
+
|
196
|
+
|
197
|
+
@check_version(mpmath, '0.13')
|
198
|
+
def test_hyp2f1_real_some():
|
199
|
+
dataset = []
|
200
|
+
for a in [-10, -5, -1.8, 1.8, 5, 10]:
|
201
|
+
for b in [-2.5, -1, 1, 7.4]:
|
202
|
+
for c in [-9, -1.8, 5, 20.4]:
|
203
|
+
for z in [-10, -1.01, -0.99, 0, 0.6, 0.95, 1.5, 10]:
|
204
|
+
try:
|
205
|
+
v = float(mpmath.hyp2f1(a, b, c, z))
|
206
|
+
except Exception:
|
207
|
+
continue
|
208
|
+
dataset.append((a, b, c, z, v))
|
209
|
+
dataset = np.array(dataset, dtype=np.float64)
|
210
|
+
|
211
|
+
with np.errstate(invalid='ignore'):
|
212
|
+
FuncData(sc.hyp2f1, dataset, (0,1,2,3), 4, rtol=1e-9,
|
213
|
+
ignore_inf_sign=True).check()
|
214
|
+
|
215
|
+
|
216
|
+
@check_version(mpmath, '0.12')
|
217
|
+
@pytest.mark.slow
|
218
|
+
def test_hyp2f1_real_random():
|
219
|
+
npoints = 500
|
220
|
+
dataset = np.zeros((npoints, 5), np.float64)
|
221
|
+
|
222
|
+
np.random.seed(1234)
|
223
|
+
dataset[:, 0] = np.random.pareto(1.5, npoints)
|
224
|
+
dataset[:, 1] = np.random.pareto(1.5, npoints)
|
225
|
+
dataset[:, 2] = np.random.pareto(1.5, npoints)
|
226
|
+
dataset[:, 3] = 2*np.random.rand(npoints) - 1
|
227
|
+
|
228
|
+
dataset[:, 0] *= (-1)**np.random.randint(2, npoints)
|
229
|
+
dataset[:, 1] *= (-1)**np.random.randint(2, npoints)
|
230
|
+
dataset[:, 2] *= (-1)**np.random.randint(2, npoints)
|
231
|
+
|
232
|
+
for ds in dataset:
|
233
|
+
if mpmath.__version__ < '0.14':
|
234
|
+
# mpmath < 0.14 fails for c too much smaller than a, b
|
235
|
+
if abs(ds[:2]).max() > abs(ds[2]):
|
236
|
+
ds[2] = abs(ds[:2]).max()
|
237
|
+
ds[4] = float(mpmath.hyp2f1(*tuple(ds[:4])))
|
238
|
+
|
239
|
+
FuncData(sc.hyp2f1, dataset, (0, 1, 2, 3), 4, rtol=1e-9).check()
|
240
|
+
|
241
|
+
|
242
|
+
# ------------------------------------------------------------------------------
|
243
|
+
# erf (complex)
|
244
|
+
# ------------------------------------------------------------------------------
|
245
|
+
|
246
|
+
@check_version(mpmath, '0.14')
|
247
|
+
def test_erf_complex():
|
248
|
+
# need to increase mpmath precision for this test
|
249
|
+
old_dps, old_prec = mpmath.mp.dps, mpmath.mp.prec
|
250
|
+
try:
|
251
|
+
mpmath.mp.dps = 70
|
252
|
+
x1, y1 = np.meshgrid(np.linspace(-10, 1, 31), np.linspace(-10, 1, 11))
|
253
|
+
x2, y2 = np.meshgrid(np.logspace(-80, .8, 31), np.logspace(-80, .8, 11))
|
254
|
+
points = np.r_[x1.ravel(),x2.ravel()] + 1j*np.r_[y1.ravel(), y2.ravel()]
|
255
|
+
|
256
|
+
assert_func_equal(sc.erf, lambda x: complex(mpmath.erf(x)), points,
|
257
|
+
vectorized=False, rtol=1e-13)
|
258
|
+
assert_func_equal(sc.erfc, lambda x: complex(mpmath.erfc(x)), points,
|
259
|
+
vectorized=False, rtol=1e-13)
|
260
|
+
finally:
|
261
|
+
mpmath.mp.dps, mpmath.mp.prec = old_dps, old_prec
|
262
|
+
|
263
|
+
|
264
|
+
# ------------------------------------------------------------------------------
|
265
|
+
# lpmv
|
266
|
+
# ------------------------------------------------------------------------------
|
267
|
+
|
268
|
+
@check_version(mpmath, '0.15')
|
269
|
+
def test_lpmv():
|
270
|
+
pts = []
|
271
|
+
for x in [-0.99, -0.557, 1e-6, 0.132, 1]:
|
272
|
+
pts.extend([
|
273
|
+
(1, 1, x),
|
274
|
+
(1, -1, x),
|
275
|
+
(-1, 1, x),
|
276
|
+
(-1, -2, x),
|
277
|
+
(1, 1.7, x),
|
278
|
+
(1, -1.7, x),
|
279
|
+
(-1, 1.7, x),
|
280
|
+
(-1, -2.7, x),
|
281
|
+
(1, 10, x),
|
282
|
+
(1, 11, x),
|
283
|
+
(3, 8, x),
|
284
|
+
(5, 11, x),
|
285
|
+
(-3, 8, x),
|
286
|
+
(-5, 11, x),
|
287
|
+
(3, -8, x),
|
288
|
+
(5, -11, x),
|
289
|
+
(-3, -8, x),
|
290
|
+
(-5, -11, x),
|
291
|
+
(3, 8.3, x),
|
292
|
+
(5, 11.3, x),
|
293
|
+
(-3, 8.3, x),
|
294
|
+
(-5, 11.3, x),
|
295
|
+
(3, -8.3, x),
|
296
|
+
(5, -11.3, x),
|
297
|
+
(-3, -8.3, x),
|
298
|
+
(-5, -11.3, x),
|
299
|
+
])
|
300
|
+
|
301
|
+
def mplegenp(nu, mu, x):
|
302
|
+
if mu == int(mu) and x == 1:
|
303
|
+
# mpmath 0.17 gets this wrong
|
304
|
+
if mu == 0:
|
305
|
+
return 1
|
306
|
+
else:
|
307
|
+
return 0
|
308
|
+
return mpmath.legenp(nu, mu, x)
|
309
|
+
|
310
|
+
dataset = [p + (mplegenp(p[1], p[0], p[2]),) for p in pts]
|
311
|
+
dataset = np.array(dataset, dtype=np.float64)
|
312
|
+
|
313
|
+
def evf(mu, nu, x):
|
314
|
+
return sc.lpmv(mu.astype(int), nu, x)
|
315
|
+
|
316
|
+
with np.errstate(invalid='ignore'):
|
317
|
+
FuncData(evf, dataset, (0,1,2), 3, rtol=1e-10, atol=1e-14).check()
|
318
|
+
|
319
|
+
|
320
|
+
# ------------------------------------------------------------------------------
|
321
|
+
# beta
|
322
|
+
# ------------------------------------------------------------------------------
|
323
|
+
|
324
|
+
@pytest.mark.slow
|
325
|
+
@check_version(mpmath, '0.15')
|
326
|
+
def test_beta():
|
327
|
+
np.random.seed(1234)
|
328
|
+
|
329
|
+
b = np.r_[np.logspace(-200, 200, 4),
|
330
|
+
np.logspace(-10, 10, 4),
|
331
|
+
np.logspace(-1, 1, 4),
|
332
|
+
np.arange(-10, 11, 1),
|
333
|
+
np.arange(-10, 11, 1) + 0.5,
|
334
|
+
-1, -2.3, -3, -100.3, -10003.4]
|
335
|
+
a = b
|
336
|
+
|
337
|
+
ab = np.array(np.broadcast_arrays(a[:,None], b[None,:])).reshape(2, -1).T
|
338
|
+
|
339
|
+
old_dps, old_prec = mpmath.mp.dps, mpmath.mp.prec
|
340
|
+
try:
|
341
|
+
mpmath.mp.dps = 400
|
342
|
+
|
343
|
+
assert_func_equal(sc.beta,
|
344
|
+
lambda a, b: float(mpmath.beta(a, b)),
|
345
|
+
ab,
|
346
|
+
vectorized=False,
|
347
|
+
rtol=1e-10,
|
348
|
+
ignore_inf_sign=True)
|
349
|
+
|
350
|
+
assert_func_equal(
|
351
|
+
sc.betaln,
|
352
|
+
lambda a, b: float(mpmath.log(abs(mpmath.beta(a, b)))),
|
353
|
+
ab,
|
354
|
+
vectorized=False,
|
355
|
+
rtol=1e-10)
|
356
|
+
finally:
|
357
|
+
mpmath.mp.dps, mpmath.mp.prec = old_dps, old_prec
|
358
|
+
|
359
|
+
|
360
|
+
# ------------------------------------------------------------------------------
|
361
|
+
# loggamma
|
362
|
+
# ------------------------------------------------------------------------------
|
363
|
+
|
364
|
+
LOGGAMMA_TAYLOR_RADIUS = 0.2
|
365
|
+
|
366
|
+
|
367
|
+
@check_version(mpmath, '0.19')
|
368
|
+
def test_loggamma_taylor_transition():
|
369
|
+
# Make sure there isn't a big jump in accuracy when we move from
|
370
|
+
# using the Taylor series to using the recurrence relation.
|
371
|
+
|
372
|
+
r = LOGGAMMA_TAYLOR_RADIUS + np.array([-0.1, -0.01, 0, 0.01, 0.1])
|
373
|
+
theta = np.linspace(0, 2*np.pi, 20)
|
374
|
+
r, theta = np.meshgrid(r, theta)
|
375
|
+
dz = r*np.exp(1j*theta)
|
376
|
+
z = np.r_[1 + dz, 2 + dz].flatten()
|
377
|
+
|
378
|
+
dataset = [(z0, complex(mpmath.loggamma(z0))) for z0 in z]
|
379
|
+
dataset = np.array(dataset)
|
380
|
+
|
381
|
+
FuncData(sc.loggamma, dataset, 0, 1, rtol=5e-14).check()
|
382
|
+
|
383
|
+
|
384
|
+
@check_version(mpmath, '0.19')
|
385
|
+
def test_loggamma_taylor():
|
386
|
+
# Test around the zeros at z = 1, 2.
|
387
|
+
|
388
|
+
r = np.logspace(-16, np.log10(LOGGAMMA_TAYLOR_RADIUS), 10)
|
389
|
+
theta = np.linspace(0, 2*np.pi, 20)
|
390
|
+
r, theta = np.meshgrid(r, theta)
|
391
|
+
dz = r*np.exp(1j*theta)
|
392
|
+
z = np.r_[1 + dz, 2 + dz].flatten()
|
393
|
+
|
394
|
+
dataset = [(z0, complex(mpmath.loggamma(z0))) for z0 in z]
|
395
|
+
dataset = np.array(dataset)
|
396
|
+
|
397
|
+
FuncData(sc.loggamma, dataset, 0, 1, rtol=5e-14).check()
|
398
|
+
|
399
|
+
|
400
|
+
# ------------------------------------------------------------------------------
|
401
|
+
# rgamma
|
402
|
+
# ------------------------------------------------------------------------------
|
403
|
+
|
404
|
+
@check_version(mpmath, '0.19')
|
405
|
+
@pytest.mark.slow
|
406
|
+
def test_rgamma_zeros():
|
407
|
+
# Test around the zeros at z = 0, -1, -2, ..., -169. (After -169 we
|
408
|
+
# get values that are out of floating point range even when we're
|
409
|
+
# within 0.1 of the zero.)
|
410
|
+
|
411
|
+
# Can't use too many points here or the test takes forever.
|
412
|
+
dx = np.r_[-np.logspace(-1, -13, 3), 0, np.logspace(-13, -1, 3)]
|
413
|
+
dy = dx.copy()
|
414
|
+
dx, dy = np.meshgrid(dx, dy)
|
415
|
+
dz = dx + 1j*dy
|
416
|
+
zeros = np.arange(0, -170, -1).reshape(1, 1, -1)
|
417
|
+
z = (zeros + np.dstack((dz,)*zeros.size)).flatten()
|
418
|
+
with mpmath.workdps(100):
|
419
|
+
dataset = [(z0, complex(mpmath.rgamma(z0))) for z0 in z]
|
420
|
+
|
421
|
+
dataset = np.array(dataset)
|
422
|
+
FuncData(sc.rgamma, dataset, 0, 1, rtol=1e-12).check()
|
423
|
+
|
424
|
+
|
425
|
+
# ------------------------------------------------------------------------------
|
426
|
+
# digamma
|
427
|
+
# ------------------------------------------------------------------------------
|
428
|
+
|
429
|
+
@check_version(mpmath, '0.19')
|
430
|
+
@pytest.mark.slow
|
431
|
+
def test_digamma_roots():
|
432
|
+
# Test the special-cased roots for digamma.
|
433
|
+
root = mpmath.findroot(mpmath.digamma, 1.5)
|
434
|
+
roots = [float(root)]
|
435
|
+
root = mpmath.findroot(mpmath.digamma, -0.5)
|
436
|
+
roots.append(float(root))
|
437
|
+
roots = np.array(roots)
|
438
|
+
|
439
|
+
# If we test beyond a radius of 0.24 mpmath will take forever.
|
440
|
+
dx = np.r_[-0.24, -np.logspace(-1, -15, 10), 0, np.logspace(-15, -1, 10), 0.24]
|
441
|
+
dy = dx.copy()
|
442
|
+
dx, dy = np.meshgrid(dx, dy)
|
443
|
+
dz = dx + 1j*dy
|
444
|
+
z = (roots + np.dstack((dz,)*roots.size)).flatten()
|
445
|
+
with mpmath.workdps(30):
|
446
|
+
dataset = [(z0, complex(mpmath.digamma(z0))) for z0 in z]
|
447
|
+
|
448
|
+
dataset = np.array(dataset)
|
449
|
+
FuncData(sc.digamma, dataset, 0, 1, rtol=1e-14).check()
|
450
|
+
|
451
|
+
|
452
|
+
@check_version(mpmath, '0.19')
|
453
|
+
def test_digamma_negreal():
|
454
|
+
# Test digamma around the negative real axis. Don't do this in
|
455
|
+
# TestSystematic because the points need some jiggering so that
|
456
|
+
# mpmath doesn't take forever.
|
457
|
+
|
458
|
+
digamma = exception_to_nan(mpmath.digamma)
|
459
|
+
|
460
|
+
x = -np.logspace(300, -30, 100)
|
461
|
+
y = np.r_[-np.logspace(0, -3, 5), 0, np.logspace(-3, 0, 5)]
|
462
|
+
x, y = np.meshgrid(x, y)
|
463
|
+
z = (x + 1j*y).flatten()
|
464
|
+
|
465
|
+
with mpmath.workdps(40):
|
466
|
+
dataset = [(z0, complex(digamma(z0))) for z0 in z]
|
467
|
+
dataset = np.asarray(dataset)
|
468
|
+
|
469
|
+
FuncData(sc.digamma, dataset, 0, 1, rtol=1e-13).check()
|
470
|
+
|
471
|
+
|
472
|
+
@check_version(mpmath, '0.19')
|
473
|
+
def test_digamma_boundary():
|
474
|
+
# Check that there isn't a jump in accuracy when we switch from
|
475
|
+
# using the asymptotic series to the reflection formula.
|
476
|
+
|
477
|
+
x = -np.logspace(300, -30, 100)
|
478
|
+
y = np.array([-6.1, -5.9, 5.9, 6.1])
|
479
|
+
x, y = np.meshgrid(x, y)
|
480
|
+
z = (x + 1j*y).flatten()
|
481
|
+
|
482
|
+
with mpmath.workdps(30):
|
483
|
+
dataset = [(z0, complex(mpmath.digamma(z0))) for z0 in z]
|
484
|
+
dataset = np.asarray(dataset)
|
485
|
+
|
486
|
+
FuncData(sc.digamma, dataset, 0, 1, rtol=1e-13).check()
|
487
|
+
|
488
|
+
|
489
|
+
# ------------------------------------------------------------------------------
|
490
|
+
# gammainc
|
491
|
+
# ------------------------------------------------------------------------------
|
492
|
+
|
493
|
+
@check_version(mpmath, '0.19')
|
494
|
+
@pytest.mark.slow
|
495
|
+
def test_gammainc_boundary():
|
496
|
+
# Test the transition to the asymptotic series.
|
497
|
+
small = 20
|
498
|
+
a = np.linspace(0.5*small, 2*small, 50)
|
499
|
+
x = a.copy()
|
500
|
+
a, x = np.meshgrid(a, x)
|
501
|
+
a, x = a.flatten(), x.flatten()
|
502
|
+
with mpmath.workdps(100):
|
503
|
+
dataset = [(a0, x0, float(mpmath.gammainc(a0, b=x0, regularized=True)))
|
504
|
+
for a0, x0 in zip(a, x)]
|
505
|
+
dataset = np.array(dataset)
|
506
|
+
|
507
|
+
FuncData(sc.gammainc, dataset, (0, 1), 2, rtol=1e-12).check()
|
508
|
+
|
509
|
+
|
510
|
+
# ------------------------------------------------------------------------------
|
511
|
+
# spence
|
512
|
+
# ------------------------------------------------------------------------------
|
513
|
+
|
514
|
+
@check_version(mpmath, '0.19')
|
515
|
+
@pytest.mark.slow
|
516
|
+
def test_spence_circle():
|
517
|
+
# The trickiest region for spence is around the circle |z - 1| = 1,
|
518
|
+
# so test that region carefully.
|
519
|
+
|
520
|
+
def spence(z):
|
521
|
+
return complex(mpmath.polylog(2, 1 - z))
|
522
|
+
|
523
|
+
r = np.linspace(0.5, 1.5)
|
524
|
+
theta = np.linspace(0, 2*pi)
|
525
|
+
z = (1 + np.outer(r, np.exp(1j*theta))).flatten()
|
526
|
+
dataset = np.asarray([(z0, spence(z0)) for z0 in z])
|
527
|
+
|
528
|
+
FuncData(sc.spence, dataset, 0, 1, rtol=1e-14).check()
|
529
|
+
|
530
|
+
|
531
|
+
# ------------------------------------------------------------------------------
|
532
|
+
# sinpi and cospi
|
533
|
+
# ------------------------------------------------------------------------------
|
534
|
+
|
535
|
+
@check_version(mpmath, '0.19')
|
536
|
+
def test_sinpi_zeros():
|
537
|
+
eps = np.finfo(float).eps
|
538
|
+
dx = np.r_[-np.logspace(0, -13, 3), 0, np.logspace(-13, 0, 3)]
|
539
|
+
dy = dx.copy()
|
540
|
+
dx, dy = np.meshgrid(dx, dy)
|
541
|
+
dz = dx + 1j*dy
|
542
|
+
zeros = np.arange(-100, 100, 1).reshape(1, 1, -1)
|
543
|
+
z = (zeros + np.dstack((dz,)*zeros.size)).flatten()
|
544
|
+
dataset = np.asarray([(z0, complex(mpmath.sinpi(z0)))
|
545
|
+
for z0 in z])
|
546
|
+
FuncData(_sinpi, dataset, 0, 1, rtol=2*eps).check()
|
547
|
+
|
548
|
+
|
549
|
+
@check_version(mpmath, '0.19')
|
550
|
+
def test_cospi_zeros():
|
551
|
+
eps = np.finfo(float).eps
|
552
|
+
dx = np.r_[-np.logspace(0, -13, 3), 0, np.logspace(-13, 0, 3)]
|
553
|
+
dy = dx.copy()
|
554
|
+
dx, dy = np.meshgrid(dx, dy)
|
555
|
+
dz = dx + 1j*dy
|
556
|
+
zeros = (np.arange(-100, 100, 1) + 0.5).reshape(1, 1, -1)
|
557
|
+
z = (zeros + np.dstack((dz,)*zeros.size)).flatten()
|
558
|
+
dataset = np.asarray([(z0, complex(mpmath.cospi(z0)))
|
559
|
+
for z0 in z])
|
560
|
+
|
561
|
+
FuncData(_cospi, dataset, 0, 1, rtol=2*eps).check()
|
562
|
+
|
563
|
+
|
564
|
+
# ------------------------------------------------------------------------------
|
565
|
+
# ellipj
|
566
|
+
# ------------------------------------------------------------------------------
|
567
|
+
|
568
|
+
@check_version(mpmath, '0.19')
|
569
|
+
def test_dn_quarter_period():
|
570
|
+
def dn(u, m):
|
571
|
+
return sc.ellipj(u, m)[2]
|
572
|
+
|
573
|
+
def mpmath_dn(u, m):
|
574
|
+
return float(mpmath.ellipfun("dn", u=u, m=m))
|
575
|
+
|
576
|
+
m = np.linspace(0, 1, 20)
|
577
|
+
du = np.r_[-np.logspace(-1, -15, 10), 0, np.logspace(-15, -1, 10)]
|
578
|
+
dataset = []
|
579
|
+
for m0 in m:
|
580
|
+
u0 = float(mpmath.ellipk(m0))
|
581
|
+
for du0 in du:
|
582
|
+
p = u0 + du0
|
583
|
+
dataset.append((p, m0, mpmath_dn(p, m0)))
|
584
|
+
dataset = np.asarray(dataset)
|
585
|
+
|
586
|
+
FuncData(dn, dataset, (0, 1), 2, rtol=1e-10).check()
|
587
|
+
|
588
|
+
|
589
|
+
# ------------------------------------------------------------------------------
|
590
|
+
# Wright Omega
|
591
|
+
# ------------------------------------------------------------------------------
|
592
|
+
|
593
|
+
def _mpmath_wrightomega(z, dps):
|
594
|
+
with mpmath.workdps(dps):
|
595
|
+
z = mpmath.mpc(z)
|
596
|
+
unwind = mpmath.ceil((z.imag - mpmath.pi)/(2*mpmath.pi))
|
597
|
+
res = mpmath.lambertw(mpmath.exp(z), unwind)
|
598
|
+
return res
|
599
|
+
|
600
|
+
|
601
|
+
@pytest.mark.slow
|
602
|
+
@check_version(mpmath, '0.19')
|
603
|
+
def test_wrightomega_branch():
|
604
|
+
x = -np.logspace(10, 0, 25)
|
605
|
+
picut_above = [np.nextafter(np.pi, np.inf)]
|
606
|
+
picut_below = [np.nextafter(np.pi, -np.inf)]
|
607
|
+
npicut_above = [np.nextafter(-np.pi, np.inf)]
|
608
|
+
npicut_below = [np.nextafter(-np.pi, -np.inf)]
|
609
|
+
for i in range(50):
|
610
|
+
picut_above.append(np.nextafter(picut_above[-1], np.inf))
|
611
|
+
picut_below.append(np.nextafter(picut_below[-1], -np.inf))
|
612
|
+
npicut_above.append(np.nextafter(npicut_above[-1], np.inf))
|
613
|
+
npicut_below.append(np.nextafter(npicut_below[-1], -np.inf))
|
614
|
+
y = np.hstack((picut_above, picut_below, npicut_above, npicut_below))
|
615
|
+
x, y = np.meshgrid(x, y)
|
616
|
+
z = (x + 1j*y).flatten()
|
617
|
+
|
618
|
+
dataset = np.asarray([(z0, complex(_mpmath_wrightomega(z0, 25)))
|
619
|
+
for z0 in z])
|
620
|
+
|
621
|
+
FuncData(sc.wrightomega, dataset, 0, 1, rtol=1e-8).check()
|
622
|
+
|
623
|
+
|
624
|
+
@pytest.mark.slow
|
625
|
+
@check_version(mpmath, '0.19')
|
626
|
+
def test_wrightomega_region1():
|
627
|
+
# This region gets less coverage in the TestSystematic test
|
628
|
+
x = np.linspace(-2, 1)
|
629
|
+
y = np.linspace(1, 2*np.pi)
|
630
|
+
x, y = np.meshgrid(x, y)
|
631
|
+
z = (x + 1j*y).flatten()
|
632
|
+
|
633
|
+
dataset = np.asarray([(z0, complex(_mpmath_wrightomega(z0, 25)))
|
634
|
+
for z0 in z])
|
635
|
+
|
636
|
+
FuncData(sc.wrightomega, dataset, 0, 1, rtol=1e-15).check()
|
637
|
+
|
638
|
+
|
639
|
+
@pytest.mark.slow
|
640
|
+
@check_version(mpmath, '0.19')
|
641
|
+
def test_wrightomega_region2():
|
642
|
+
# This region gets less coverage in the TestSystematic test
|
643
|
+
x = np.linspace(-2, 1)
|
644
|
+
y = np.linspace(-2*np.pi, -1)
|
645
|
+
x, y = np.meshgrid(x, y)
|
646
|
+
z = (x + 1j*y).flatten()
|
647
|
+
|
648
|
+
dataset = np.asarray([(z0, complex(_mpmath_wrightomega(z0, 25)))
|
649
|
+
for z0 in z])
|
650
|
+
|
651
|
+
FuncData(sc.wrightomega, dataset, 0, 1, rtol=1e-15).check()
|
652
|
+
|
653
|
+
|
654
|
+
# ------------------------------------------------------------------------------
|
655
|
+
# lambertw
|
656
|
+
# ------------------------------------------------------------------------------
|
657
|
+
|
658
|
+
@pytest.mark.slow
|
659
|
+
@check_version(mpmath, '0.19')
|
660
|
+
def test_lambertw_smallz():
|
661
|
+
x, y = np.linspace(-1, 1, 25), np.linspace(-1, 1, 25)
|
662
|
+
x, y = np.meshgrid(x, y)
|
663
|
+
z = (x + 1j*y).flatten()
|
664
|
+
|
665
|
+
dataset = np.asarray([(z0, complex(mpmath.lambertw(z0)))
|
666
|
+
for z0 in z])
|
667
|
+
|
668
|
+
FuncData(sc.lambertw, dataset, 0, 1, rtol=1e-13).check()
|
669
|
+
|
670
|
+
|
671
|
+
# ------------------------------------------------------------------------------
|
672
|
+
# Systematic tests
|
673
|
+
# ------------------------------------------------------------------------------
|
674
|
+
|
675
|
+
# The functions lpn, lpmn, clpmn, and sph_harm appearing below are
|
676
|
+
# deprecated in favor of legendre_p_all, assoc_legendre_p_all,
|
677
|
+
# assoc_legendre_p_all (assoc_legendre_p_all covers lpmn and clpmn),
|
678
|
+
# and sph_harm_y respectively. The deprecated functions listed above are
|
679
|
+
# implemented as shims around their respective replacements. The replacements
|
680
|
+
# are tested separately, but tests for the deprecated functions remain to
|
681
|
+
# verify the correctness of the shims.
|
682
|
+
|
683
|
+
HYPERKW = dict(maxprec=200, maxterms=200)
|
684
|
+
|
685
|
+
|
686
|
+
@pytest.mark.slow
|
687
|
+
@check_version(mpmath, '0.17')
|
688
|
+
class TestSystematic:
|
689
|
+
|
690
|
+
def test_airyai(self):
|
691
|
+
# oscillating function, limit range
|
692
|
+
assert_mpmath_equal(lambda z: sc.airy(z)[0],
|
693
|
+
mpmath.airyai,
|
694
|
+
[Arg(-1e8, 1e8)],
|
695
|
+
rtol=1e-5)
|
696
|
+
assert_mpmath_equal(lambda z: sc.airy(z)[0],
|
697
|
+
mpmath.airyai,
|
698
|
+
[Arg(-1e3, 1e3)])
|
699
|
+
|
700
|
+
def test_airyai_complex(self):
|
701
|
+
assert_mpmath_equal(lambda z: sc.airy(z)[0],
|
702
|
+
mpmath.airyai,
|
703
|
+
[ComplexArg()])
|
704
|
+
|
705
|
+
def test_airyai_prime(self):
|
706
|
+
# oscillating function, limit range
|
707
|
+
assert_mpmath_equal(lambda z: sc.airy(z)[1], lambda z:
|
708
|
+
mpmath.airyai(z, derivative=1),
|
709
|
+
[Arg(-1e8, 1e8)],
|
710
|
+
rtol=1e-5)
|
711
|
+
assert_mpmath_equal(lambda z: sc.airy(z)[1], lambda z:
|
712
|
+
mpmath.airyai(z, derivative=1),
|
713
|
+
[Arg(-1e3, 1e3)])
|
714
|
+
|
715
|
+
def test_airyai_prime_complex(self):
|
716
|
+
assert_mpmath_equal(lambda z: sc.airy(z)[1], lambda z:
|
717
|
+
mpmath.airyai(z, derivative=1),
|
718
|
+
[ComplexArg()])
|
719
|
+
|
720
|
+
def test_airybi(self):
|
721
|
+
# oscillating function, limit range
|
722
|
+
assert_mpmath_equal(lambda z: sc.airy(z)[2], lambda z:
|
723
|
+
mpmath.airybi(z),
|
724
|
+
[Arg(-1e8, 1e8)],
|
725
|
+
rtol=1e-5)
|
726
|
+
assert_mpmath_equal(lambda z: sc.airy(z)[2], lambda z:
|
727
|
+
mpmath.airybi(z),
|
728
|
+
[Arg(-1e3, 1e3)])
|
729
|
+
|
730
|
+
def test_airybi_complex(self):
|
731
|
+
assert_mpmath_equal(lambda z: sc.airy(z)[2], lambda z:
|
732
|
+
mpmath.airybi(z),
|
733
|
+
[ComplexArg()])
|
734
|
+
|
735
|
+
def test_airybi_prime(self):
|
736
|
+
# oscillating function, limit range
|
737
|
+
assert_mpmath_equal(lambda z: sc.airy(z)[3], lambda z:
|
738
|
+
mpmath.airybi(z, derivative=1),
|
739
|
+
[Arg(-1e8, 1e8)],
|
740
|
+
rtol=1e-5)
|
741
|
+
assert_mpmath_equal(lambda z: sc.airy(z)[3], lambda z:
|
742
|
+
mpmath.airybi(z, derivative=1),
|
743
|
+
[Arg(-1e3, 1e3)])
|
744
|
+
|
745
|
+
def test_airybi_prime_complex(self):
|
746
|
+
assert_mpmath_equal(lambda z: sc.airy(z)[3], lambda z:
|
747
|
+
mpmath.airybi(z, derivative=1),
|
748
|
+
[ComplexArg()])
|
749
|
+
|
750
|
+
def test_bei(self):
|
751
|
+
assert_mpmath_equal(sc.bei,
|
752
|
+
exception_to_nan(lambda z: mpmath.bei(0, z, **HYPERKW)),
|
753
|
+
[Arg(-1e3, 1e3)])
|
754
|
+
|
755
|
+
def test_ber(self):
|
756
|
+
assert_mpmath_equal(sc.ber,
|
757
|
+
exception_to_nan(lambda z: mpmath.ber(0, z, **HYPERKW)),
|
758
|
+
[Arg(-1e3, 1e3)])
|
759
|
+
|
760
|
+
def test_bernoulli(self):
|
761
|
+
assert_mpmath_equal(lambda n: sc.bernoulli(int(n))[int(n)],
|
762
|
+
lambda n: float(mpmath.bernoulli(int(n))),
|
763
|
+
[IntArg(0, 13000)],
|
764
|
+
rtol=1e-9, n=13000)
|
765
|
+
|
766
|
+
def test_besseli(self):
|
767
|
+
assert_mpmath_equal(
|
768
|
+
sc.iv,
|
769
|
+
exception_to_nan(lambda v, z: mpmath.besseli(v, z, **HYPERKW)),
|
770
|
+
[Arg(-1e100, 1e100), Arg()],
|
771
|
+
atol=1e-270,
|
772
|
+
)
|
773
|
+
|
774
|
+
def test_besseli_complex(self):
|
775
|
+
assert_mpmath_equal(
|
776
|
+
lambda v, z: sc.iv(v.real, z),
|
777
|
+
exception_to_nan(lambda v, z: mpmath.besseli(v, z, **HYPERKW)),
|
778
|
+
[Arg(-1e100, 1e100), ComplexArg()],
|
779
|
+
)
|
780
|
+
|
781
|
+
def test_besselj(self):
|
782
|
+
assert_mpmath_equal(
|
783
|
+
sc.jv,
|
784
|
+
exception_to_nan(lambda v, z: mpmath.besselj(v, z, **HYPERKW)),
|
785
|
+
[Arg(-1e100, 1e100), Arg(-1e3, 1e3)],
|
786
|
+
ignore_inf_sign=True,
|
787
|
+
)
|
788
|
+
|
789
|
+
# loss of precision at large arguments due to oscillation
|
790
|
+
assert_mpmath_equal(
|
791
|
+
sc.jv,
|
792
|
+
exception_to_nan(lambda v, z: mpmath.besselj(v, z, **HYPERKW)),
|
793
|
+
[Arg(-1e100, 1e100), Arg(-1e8, 1e8)],
|
794
|
+
ignore_inf_sign=True,
|
795
|
+
rtol=1e-5,
|
796
|
+
)
|
797
|
+
|
798
|
+
def test_besselj_complex(self):
|
799
|
+
assert_mpmath_equal(
|
800
|
+
lambda v, z: sc.jv(v.real, z),
|
801
|
+
exception_to_nan(lambda v, z: mpmath.besselj(v, z, **HYPERKW)),
|
802
|
+
[Arg(), ComplexArg()]
|
803
|
+
)
|
804
|
+
|
805
|
+
def test_besselk(self):
|
806
|
+
assert_mpmath_equal(
|
807
|
+
sc.kv,
|
808
|
+
mpmath.besselk,
|
809
|
+
[Arg(-200, 200), Arg(0, np.inf)],
|
810
|
+
nan_ok=False,
|
811
|
+
rtol=1e-12,
|
812
|
+
)
|
813
|
+
|
814
|
+
def test_besselk_int(self):
|
815
|
+
assert_mpmath_equal(
|
816
|
+
sc.kn,
|
817
|
+
mpmath.besselk,
|
818
|
+
[IntArg(-200, 200), Arg(0, np.inf)],
|
819
|
+
nan_ok=False,
|
820
|
+
rtol=1e-12,
|
821
|
+
)
|
822
|
+
|
823
|
+
def test_besselk_complex(self):
|
824
|
+
assert_mpmath_equal(
|
825
|
+
lambda v, z: sc.kv(v.real, z),
|
826
|
+
exception_to_nan(lambda v, z: mpmath.besselk(v, z, **HYPERKW)),
|
827
|
+
[Arg(-1e100, 1e100), ComplexArg()],
|
828
|
+
)
|
829
|
+
|
830
|
+
def test_bessely(self):
|
831
|
+
def mpbessely(v, x):
|
832
|
+
r = float(mpmath.bessely(v, x, **HYPERKW))
|
833
|
+
if abs(r) > 1e305:
|
834
|
+
# overflowing to inf a bit earlier is OK
|
835
|
+
r = np.inf * np.sign(r)
|
836
|
+
if abs(r) == 0 and x == 0:
|
837
|
+
# invalid result from mpmath, point x=0 is a divergence
|
838
|
+
return np.nan
|
839
|
+
return r
|
840
|
+
assert_mpmath_equal(
|
841
|
+
sc.yv,
|
842
|
+
exception_to_nan(mpbessely),
|
843
|
+
[Arg(-1e100, 1e100), Arg(-1e8, 1e8)],
|
844
|
+
n=5000,
|
845
|
+
)
|
846
|
+
|
847
|
+
def test_bessely_complex(self):
|
848
|
+
def mpbessely(v, x):
|
849
|
+
r = complex(mpmath.bessely(v, x, **HYPERKW))
|
850
|
+
if abs(r) > 1e305:
|
851
|
+
# overflowing to inf a bit earlier is OK
|
852
|
+
with np.errstate(invalid='ignore'):
|
853
|
+
r = np.inf * np.sign(r)
|
854
|
+
return r
|
855
|
+
assert_mpmath_equal(
|
856
|
+
lambda v, z: sc.yv(v.real, z),
|
857
|
+
exception_to_nan(mpbessely),
|
858
|
+
[Arg(), ComplexArg()],
|
859
|
+
n=15000,
|
860
|
+
)
|
861
|
+
|
862
|
+
def test_bessely_int(self):
|
863
|
+
def mpbessely(v, x):
|
864
|
+
r = float(mpmath.bessely(v, x))
|
865
|
+
if abs(r) == 0 and x == 0:
|
866
|
+
# invalid result from mpmath, point x=0 is a divergence
|
867
|
+
return np.nan
|
868
|
+
return r
|
869
|
+
assert_mpmath_equal(
|
870
|
+
lambda v, z: sc.yn(int(v), z),
|
871
|
+
exception_to_nan(mpbessely),
|
872
|
+
[IntArg(-1000, 1000), Arg(-1e8, 1e8)],
|
873
|
+
)
|
874
|
+
|
875
|
+
def test_beta(self):
|
876
|
+
bad_points = []
|
877
|
+
|
878
|
+
def beta(a, b, nonzero=False):
|
879
|
+
if a < -1e12 or b < -1e12:
|
880
|
+
# Function is defined here only at integers, but due
|
881
|
+
# to loss of precision this is numerically
|
882
|
+
# ill-defined. Don't compare values here.
|
883
|
+
return np.nan
|
884
|
+
if (a < 0 or b < 0) and (abs(float(a + b)) % 1) == 0:
|
885
|
+
# close to a zero of the function: mpmath and scipy
|
886
|
+
# will not round here the same, so the test needs to be
|
887
|
+
# run with an absolute tolerance
|
888
|
+
if nonzero:
|
889
|
+
bad_points.append((float(a), float(b)))
|
890
|
+
return np.nan
|
891
|
+
return mpmath.beta(a, b)
|
892
|
+
|
893
|
+
assert_mpmath_equal(
|
894
|
+
sc.beta,
|
895
|
+
lambda a, b: beta(a, b, nonzero=True),
|
896
|
+
[Arg(), Arg()],
|
897
|
+
dps=400,
|
898
|
+
ignore_inf_sign=True,
|
899
|
+
)
|
900
|
+
|
901
|
+
assert_mpmath_equal(
|
902
|
+
sc.beta,
|
903
|
+
beta,
|
904
|
+
np.array(bad_points),
|
905
|
+
dps=400,
|
906
|
+
ignore_inf_sign=True,
|
907
|
+
atol=1e-11,
|
908
|
+
)
|
909
|
+
|
910
|
+
def test_betainc(self):
|
911
|
+
assert_mpmath_equal(
|
912
|
+
sc.betainc,
|
913
|
+
time_limited()(
|
914
|
+
exception_to_nan(
|
915
|
+
lambda a, b, x: mpmath.betainc(a, b, 0, x, regularized=True)
|
916
|
+
)
|
917
|
+
),
|
918
|
+
[Arg(), Arg(), Arg()],
|
919
|
+
)
|
920
|
+
|
921
|
+
def test_betaincc(self):
|
922
|
+
assert_mpmath_equal(
|
923
|
+
sc.betaincc,
|
924
|
+
time_limited()(
|
925
|
+
exception_to_nan(
|
926
|
+
lambda a, b, x: mpmath.betainc(a, b, x, 1, regularized=True)
|
927
|
+
)
|
928
|
+
),
|
929
|
+
[Arg(), Arg(), Arg()],
|
930
|
+
dps=400,
|
931
|
+
)
|
932
|
+
|
933
|
+
def test_binom(self):
|
934
|
+
bad_points = []
|
935
|
+
|
936
|
+
def binomial(n, k, nonzero=False):
|
937
|
+
if abs(k) > 1e8*(abs(n) + 1):
|
938
|
+
# The binomial is rapidly oscillating in this region,
|
939
|
+
# and the function is numerically ill-defined. Don't
|
940
|
+
# compare values here.
|
941
|
+
return np.nan
|
942
|
+
if n < k and abs(float(n-k) - np.round(float(n-k))) < 1e-15:
|
943
|
+
# close to a zero of the function: mpmath and scipy
|
944
|
+
# will not round here the same, so the test needs to be
|
945
|
+
# run with an absolute tolerance
|
946
|
+
if nonzero:
|
947
|
+
bad_points.append((float(n), float(k)))
|
948
|
+
return np.nan
|
949
|
+
return mpmath.binomial(n, k)
|
950
|
+
|
951
|
+
assert_mpmath_equal(
|
952
|
+
sc.binom,
|
953
|
+
lambda n, k: binomial(n, k, nonzero=True),
|
954
|
+
[Arg(), Arg()],
|
955
|
+
dps=400,
|
956
|
+
)
|
957
|
+
|
958
|
+
assert_mpmath_equal(
|
959
|
+
sc.binom,
|
960
|
+
binomial,
|
961
|
+
np.array(bad_points),
|
962
|
+
dps=400,
|
963
|
+
atol=1e-14,
|
964
|
+
)
|
965
|
+
|
966
|
+
def test_chebyt_int(self):
|
967
|
+
assert_mpmath_equal(
|
968
|
+
lambda n, x: sc.eval_chebyt(int(n), x),
|
969
|
+
exception_to_nan(lambda n, x: mpmath.chebyt(n, x, **HYPERKW)),
|
970
|
+
[IntArg(), Arg()],
|
971
|
+
dps=50,
|
972
|
+
)
|
973
|
+
|
974
|
+
@pytest.mark.xfail(run=False, reason="some cases in hyp2f1 not fully accurate")
|
975
|
+
def test_chebyt(self):
|
976
|
+
assert_mpmath_equal(
|
977
|
+
sc.eval_chebyt,
|
978
|
+
lambda n, x: time_limited()(
|
979
|
+
exception_to_nan(mpmath.chebyt)
|
980
|
+
)(n, x, **HYPERKW),
|
981
|
+
[Arg(-101, 101), Arg()],
|
982
|
+
n=10000,
|
983
|
+
)
|
984
|
+
|
985
|
+
def test_chebyu_int(self):
|
986
|
+
assert_mpmath_equal(
|
987
|
+
lambda n, x: sc.eval_chebyu(int(n), x),
|
988
|
+
exception_to_nan(lambda n, x: mpmath.chebyu(n, x, **HYPERKW)),
|
989
|
+
[IntArg(), Arg()],
|
990
|
+
dps=50,
|
991
|
+
)
|
992
|
+
|
993
|
+
@pytest.mark.xfail(run=False, reason="some cases in hyp2f1 not fully accurate")
|
994
|
+
def test_chebyu(self):
|
995
|
+
assert_mpmath_equal(
|
996
|
+
sc.eval_chebyu,
|
997
|
+
lambda n, x: time_limited()(
|
998
|
+
exception_to_nan(mpmath.chebyu)
|
999
|
+
)(n, x, **HYPERKW),
|
1000
|
+
[Arg(-101, 101), Arg()],
|
1001
|
+
)
|
1002
|
+
|
1003
|
+
def test_chi(self):
|
1004
|
+
def chi(x):
|
1005
|
+
return sc.shichi(x)[1]
|
1006
|
+
assert_mpmath_equal(chi, mpmath.chi, [Arg()])
|
1007
|
+
# check asymptotic series cross-over
|
1008
|
+
assert_mpmath_equal(chi, mpmath.chi, [FixedArg([88 - 1e-9, 88, 88 + 1e-9])])
|
1009
|
+
|
1010
|
+
def test_chi_complex(self):
|
1011
|
+
def chi(z):
|
1012
|
+
return sc.shichi(z)[1]
|
1013
|
+
# chi oscillates as Im[z] -> +- inf, so limit range
|
1014
|
+
assert_mpmath_equal(
|
1015
|
+
chi,
|
1016
|
+
mpmath.chi,
|
1017
|
+
[ComplexArg(complex(-np.inf, -1e8), complex(np.inf, 1e8))],
|
1018
|
+
rtol=1e-12,
|
1019
|
+
)
|
1020
|
+
|
1021
|
+
def test_ci(self):
|
1022
|
+
def ci(x):
|
1023
|
+
return sc.sici(x)[1]
|
1024
|
+
# oscillating function: limit range
|
1025
|
+
assert_mpmath_equal(ci, mpmath.ci, [Arg(-1e8, 1e8)])
|
1026
|
+
|
1027
|
+
def test_ci_complex(self):
|
1028
|
+
def ci(z):
|
1029
|
+
return sc.sici(z)[1]
|
1030
|
+
# ci oscillates as Re[z] -> +- inf, so limit range
|
1031
|
+
assert_mpmath_equal(
|
1032
|
+
ci,
|
1033
|
+
mpmath.ci,
|
1034
|
+
[ComplexArg(complex(-1e8, -np.inf), complex(1e8, np.inf))],
|
1035
|
+
rtol=1e-8,
|
1036
|
+
)
|
1037
|
+
|
1038
|
+
def test_cospi(self):
|
1039
|
+
eps = np.finfo(float).eps
|
1040
|
+
assert_mpmath_equal(_cospi, mpmath.cospi, [Arg()], nan_ok=False, rtol=2*eps)
|
1041
|
+
|
1042
|
+
def test_cospi_complex(self):
|
1043
|
+
assert_mpmath_equal(
|
1044
|
+
_cospi,
|
1045
|
+
mpmath.cospi,
|
1046
|
+
[ComplexArg()],
|
1047
|
+
nan_ok=False,
|
1048
|
+
rtol=1e-13,
|
1049
|
+
)
|
1050
|
+
|
1051
|
+
def test_digamma(self):
|
1052
|
+
assert_mpmath_equal(
|
1053
|
+
sc.digamma,
|
1054
|
+
exception_to_nan(mpmath.digamma),
|
1055
|
+
[Arg()],
|
1056
|
+
rtol=1e-12,
|
1057
|
+
dps=50,
|
1058
|
+
)
|
1059
|
+
|
1060
|
+
def test_digamma_complex(self):
|
1061
|
+
# Test on a cut plane because mpmath will hang. See
|
1062
|
+
# test_digamma_negreal for tests on the negative real axis.
|
1063
|
+
def param_filter(z):
|
1064
|
+
return np.where((z.real < 0) & (np.abs(z.imag) < 1.12), False, True)
|
1065
|
+
|
1066
|
+
assert_mpmath_equal(
|
1067
|
+
sc.digamma,
|
1068
|
+
exception_to_nan(mpmath.digamma),
|
1069
|
+
[ComplexArg()],
|
1070
|
+
rtol=1e-13,
|
1071
|
+
dps=40,
|
1072
|
+
param_filter=param_filter
|
1073
|
+
)
|
1074
|
+
|
1075
|
+
def test_e1(self):
|
1076
|
+
assert_mpmath_equal(
|
1077
|
+
sc.exp1,
|
1078
|
+
mpmath.e1,
|
1079
|
+
[Arg()],
|
1080
|
+
rtol=1e-14,
|
1081
|
+
)
|
1082
|
+
|
1083
|
+
def test_e1_complex(self):
|
1084
|
+
# E_1 oscillates as Im[z] -> +- inf, so limit range
|
1085
|
+
assert_mpmath_equal(
|
1086
|
+
sc.exp1,
|
1087
|
+
mpmath.e1,
|
1088
|
+
[ComplexArg(complex(-np.inf, -1e8), complex(np.inf, 1e8))],
|
1089
|
+
rtol=1e-11,
|
1090
|
+
)
|
1091
|
+
|
1092
|
+
# Check cross-over region
|
1093
|
+
assert_mpmath_equal(
|
1094
|
+
sc.exp1,
|
1095
|
+
mpmath.e1,
|
1096
|
+
(np.linspace(-50, 50, 171)[:, None]
|
1097
|
+
+ np.r_[0, np.logspace(-3, 2, 61), -np.logspace(-3, 2, 11)]*1j).ravel(),
|
1098
|
+
rtol=1e-11,
|
1099
|
+
)
|
1100
|
+
assert_mpmath_equal(
|
1101
|
+
sc.exp1,
|
1102
|
+
mpmath.e1,
|
1103
|
+
(np.linspace(-50, -35, 10000) + 0j),
|
1104
|
+
rtol=1e-11,
|
1105
|
+
)
|
1106
|
+
|
1107
|
+
def test_exprel(self):
|
1108
|
+
assert_mpmath_equal(
|
1109
|
+
sc.exprel,
|
1110
|
+
lambda x: mpmath.expm1(x)/x if x != 0 else mpmath.mpf('1.0'),
|
1111
|
+
[Arg(a=-np.log(np.finfo(np.float64).max),
|
1112
|
+
b=np.log(np.finfo(np.float64).max))],
|
1113
|
+
)
|
1114
|
+
assert_mpmath_equal(
|
1115
|
+
sc.exprel,
|
1116
|
+
lambda x: mpmath.expm1(x)/x if x != 0 else mpmath.mpf('1.0'),
|
1117
|
+
np.array([1e-12, 1e-24, 0, 1e12, 1e24, np.inf]),
|
1118
|
+
rtol=1e-11,
|
1119
|
+
)
|
1120
|
+
assert_(np.isinf(sc.exprel(np.inf)))
|
1121
|
+
assert_(sc.exprel(-np.inf) == 0)
|
1122
|
+
|
1123
|
+
def test_expm1_complex(self):
|
1124
|
+
# Oscillates as a function of Im[z], so limit range to avoid loss of precision
|
1125
|
+
assert_mpmath_equal(
|
1126
|
+
sc.expm1,
|
1127
|
+
mpmath.expm1,
|
1128
|
+
[ComplexArg(complex(-np.inf, -1e7), complex(np.inf, 1e7))],
|
1129
|
+
)
|
1130
|
+
|
1131
|
+
def test_log1p_complex(self):
|
1132
|
+
assert_mpmath_equal(
|
1133
|
+
sc.log1p,
|
1134
|
+
lambda x: mpmath.log(x+1),
|
1135
|
+
[ComplexArg()],
|
1136
|
+
dps=60,
|
1137
|
+
)
|
1138
|
+
|
1139
|
+
def test_log1pmx(self):
|
1140
|
+
assert_mpmath_equal(
|
1141
|
+
_log1pmx,
|
1142
|
+
lambda x: mpmath.log(x + 1) - x,
|
1143
|
+
[Arg()],
|
1144
|
+
dps=60,
|
1145
|
+
rtol=1e-14,
|
1146
|
+
)
|
1147
|
+
|
1148
|
+
def test_ei(self):
|
1149
|
+
assert_mpmath_equal(sc.expi, mpmath.ei, [Arg()], rtol=1e-11)
|
1150
|
+
|
1151
|
+
def test_ei_complex(self):
|
1152
|
+
# Ei oscillates as Im[z] -> +- inf, so limit range
|
1153
|
+
assert_mpmath_equal(
|
1154
|
+
sc.expi,
|
1155
|
+
mpmath.ei,
|
1156
|
+
[ComplexArg(complex(-np.inf, -1e8), complex(np.inf, 1e8))],
|
1157
|
+
rtol=1e-9,
|
1158
|
+
)
|
1159
|
+
|
1160
|
+
def test_ellipe(self):
|
1161
|
+
assert_mpmath_equal(sc.ellipe, mpmath.ellipe, [Arg(b=1.0)])
|
1162
|
+
|
1163
|
+
def test_ellipeinc(self):
|
1164
|
+
assert_mpmath_equal(sc.ellipeinc, mpmath.ellipe, [Arg(-1e3, 1e3), Arg(b=1.0)])
|
1165
|
+
|
1166
|
+
def test_ellipeinc_largephi(self):
|
1167
|
+
assert_mpmath_equal(sc.ellipeinc, mpmath.ellipe, [Arg(), Arg()])
|
1168
|
+
|
1169
|
+
def test_ellipf(self):
|
1170
|
+
assert_mpmath_equal(sc.ellipkinc, mpmath.ellipf, [Arg(-1e3, 1e3), Arg()])
|
1171
|
+
|
1172
|
+
def test_ellipf_largephi(self):
|
1173
|
+
assert_mpmath_equal(sc.ellipkinc, mpmath.ellipf, [Arg(), Arg()])
|
1174
|
+
|
1175
|
+
def test_ellipk(self):
|
1176
|
+
assert_mpmath_equal(sc.ellipk, mpmath.ellipk, [Arg(b=1.0)])
|
1177
|
+
assert_mpmath_equal(
|
1178
|
+
sc.ellipkm1,
|
1179
|
+
lambda m: mpmath.ellipk(1 - m),
|
1180
|
+
[Arg(a=0.0)],
|
1181
|
+
dps=400,
|
1182
|
+
)
|
1183
|
+
|
1184
|
+
def test_ellipkinc(self):
|
1185
|
+
def ellipkinc(phi, m):
|
1186
|
+
return mpmath.ellippi(0, phi, m)
|
1187
|
+
assert_mpmath_equal(
|
1188
|
+
sc.ellipkinc,
|
1189
|
+
ellipkinc,
|
1190
|
+
[Arg(-1e3, 1e3), Arg(b=1.0)],
|
1191
|
+
ignore_inf_sign=True,
|
1192
|
+
)
|
1193
|
+
|
1194
|
+
def test_ellipkinc_largephi(self):
|
1195
|
+
def ellipkinc(phi, m):
|
1196
|
+
return mpmath.ellippi(0, phi, m)
|
1197
|
+
assert_mpmath_equal(
|
1198
|
+
sc.ellipkinc,
|
1199
|
+
ellipkinc,
|
1200
|
+
[Arg(), Arg(b=1.0)],
|
1201
|
+
ignore_inf_sign=True,
|
1202
|
+
)
|
1203
|
+
|
1204
|
+
def test_ellipfun_sn(self):
|
1205
|
+
def sn(u, m):
|
1206
|
+
# mpmath doesn't get the zero at u = 0--fix that
|
1207
|
+
if u == 0:
|
1208
|
+
return 0
|
1209
|
+
else:
|
1210
|
+
return mpmath.ellipfun("sn", u=u, m=m)
|
1211
|
+
|
1212
|
+
# Oscillating function --- limit range of first argument; the
|
1213
|
+
# loss of precision there is an expected numerical feature
|
1214
|
+
# rather than an actual bug
|
1215
|
+
assert_mpmath_equal(
|
1216
|
+
lambda u, m: sc.ellipj(u, m)[0],
|
1217
|
+
sn,
|
1218
|
+
[Arg(-1e6, 1e6), Arg(a=0, b=1)],
|
1219
|
+
rtol=1e-8,
|
1220
|
+
)
|
1221
|
+
|
1222
|
+
def test_ellipfun_cn(self):
|
1223
|
+
# see comment in ellipfun_sn
|
1224
|
+
assert_mpmath_equal(
|
1225
|
+
lambda u, m: sc.ellipj(u, m)[1],
|
1226
|
+
lambda u, m: mpmath.ellipfun("cn", u=u, m=m),
|
1227
|
+
[Arg(-1e6, 1e6), Arg(a=0, b=1)],
|
1228
|
+
rtol=1e-8,
|
1229
|
+
)
|
1230
|
+
|
1231
|
+
def test_ellipfun_dn(self):
|
1232
|
+
# see comment in ellipfun_sn
|
1233
|
+
assert_mpmath_equal(
|
1234
|
+
lambda u, m: sc.ellipj(u, m)[2],
|
1235
|
+
lambda u, m: mpmath.ellipfun("dn", u=u, m=m),
|
1236
|
+
[Arg(-1e6, 1e6), Arg(a=0, b=1)],
|
1237
|
+
rtol=1e-8,
|
1238
|
+
)
|
1239
|
+
|
1240
|
+
def test_erf(self):
|
1241
|
+
assert_mpmath_equal(sc.erf, lambda z: mpmath.erf(z), [Arg()])
|
1242
|
+
|
1243
|
+
def test_erf_complex(self):
|
1244
|
+
assert_mpmath_equal(sc.erf, lambda z: mpmath.erf(z), [ComplexArg()], n=200)
|
1245
|
+
|
1246
|
+
def test_erfc(self):
|
1247
|
+
assert_mpmath_equal(
|
1248
|
+
sc.erfc,
|
1249
|
+
exception_to_nan(lambda z: mpmath.erfc(z)),
|
1250
|
+
[Arg()],
|
1251
|
+
rtol=1e-13,
|
1252
|
+
)
|
1253
|
+
|
1254
|
+
def test_erfc_complex(self):
|
1255
|
+
assert_mpmath_equal(
|
1256
|
+
sc.erfc,
|
1257
|
+
exception_to_nan(lambda z: mpmath.erfc(z)),
|
1258
|
+
[ComplexArg()],
|
1259
|
+
n=200,
|
1260
|
+
)
|
1261
|
+
|
1262
|
+
def test_erfi(self):
|
1263
|
+
assert_mpmath_equal(sc.erfi, mpmath.erfi, [Arg()], n=200)
|
1264
|
+
|
1265
|
+
def test_erfi_complex(self):
|
1266
|
+
assert_mpmath_equal(sc.erfi, mpmath.erfi, [ComplexArg()], n=200)
|
1267
|
+
|
1268
|
+
def test_ndtr(self):
|
1269
|
+
assert_mpmath_equal(
|
1270
|
+
sc.ndtr,
|
1271
|
+
exception_to_nan(lambda z: mpmath.ncdf(z)),
|
1272
|
+
[Arg()],
|
1273
|
+
n=200,
|
1274
|
+
)
|
1275
|
+
|
1276
|
+
def test_ndtr_complex(self):
|
1277
|
+
assert_mpmath_equal(
|
1278
|
+
sc.ndtr,
|
1279
|
+
lambda z: mpmath.erfc(-z/np.sqrt(2.))/2.,
|
1280
|
+
[ComplexArg(a=complex(-10000, -10000), b=complex(10000, 10000))],
|
1281
|
+
n=400,
|
1282
|
+
)
|
1283
|
+
|
1284
|
+
def test_log_ndtr(self):
|
1285
|
+
assert_mpmath_equal(
|
1286
|
+
sc.log_ndtr,
|
1287
|
+
exception_to_nan(lambda z: mpmath.log(mpmath.ncdf(z))),
|
1288
|
+
[Arg()], n=600, dps=300, rtol=1e-13,
|
1289
|
+
)
|
1290
|
+
|
1291
|
+
def test_log_ndtr_complex(self):
|
1292
|
+
assert_mpmath_equal(
|
1293
|
+
sc.log_ndtr,
|
1294
|
+
exception_to_nan(lambda z: mpmath.log(mpmath.erfc(-z/np.sqrt(2.))/2.)),
|
1295
|
+
[ComplexArg(a=complex(-10000, -100), b=complex(10000, 100))],
|
1296
|
+
n=200, dps=300,
|
1297
|
+
)
|
1298
|
+
|
1299
|
+
def test_eulernum(self):
|
1300
|
+
assert_mpmath_equal(
|
1301
|
+
lambda n: sc.euler(n)[-1],
|
1302
|
+
mpmath.eulernum,
|
1303
|
+
[IntArg(1, 10000)],
|
1304
|
+
n=10000,
|
1305
|
+
)
|
1306
|
+
|
1307
|
+
def test_expint(self):
|
1308
|
+
assert_mpmath_equal(
|
1309
|
+
sc.expn,
|
1310
|
+
mpmath.expint,
|
1311
|
+
[IntArg(0, 200), Arg(0, np.inf)],
|
1312
|
+
rtol=1e-13,
|
1313
|
+
dps=160,
|
1314
|
+
)
|
1315
|
+
|
1316
|
+
def test_fresnels(self):
|
1317
|
+
def fresnels(x):
|
1318
|
+
return sc.fresnel(x)[0]
|
1319
|
+
assert_mpmath_equal(fresnels, mpmath.fresnels, [Arg()])
|
1320
|
+
|
1321
|
+
def test_fresnelc(self):
|
1322
|
+
def fresnelc(x):
|
1323
|
+
return sc.fresnel(x)[1]
|
1324
|
+
assert_mpmath_equal(fresnelc, mpmath.fresnelc, [Arg()])
|
1325
|
+
|
1326
|
+
def test_gamma(self):
|
1327
|
+
assert_mpmath_equal(sc.gamma, exception_to_nan(mpmath.gamma), [Arg()])
|
1328
|
+
|
1329
|
+
def test_gamma_complex(self):
|
1330
|
+
assert_mpmath_equal(
|
1331
|
+
sc.gamma,
|
1332
|
+
exception_to_nan(mpmath.gamma),
|
1333
|
+
[ComplexArg()],
|
1334
|
+
rtol=5e-13,
|
1335
|
+
)
|
1336
|
+
|
1337
|
+
def test_gammainc(self):
|
1338
|
+
# Larger arguments are tested in test_data.py:test_local
|
1339
|
+
assert_mpmath_equal(
|
1340
|
+
sc.gammainc,
|
1341
|
+
lambda z, b: mpmath.gammainc(z, b=b, regularized=True),
|
1342
|
+
[Arg(0, 1e4, inclusive_a=False), Arg(0, 1e4)],
|
1343
|
+
nan_ok=False,
|
1344
|
+
rtol=1e-11,
|
1345
|
+
)
|
1346
|
+
|
1347
|
+
def test_gammaincc(self):
|
1348
|
+
# Larger arguments are tested in test_data.py:test_local
|
1349
|
+
assert_mpmath_equal(
|
1350
|
+
sc.gammaincc,
|
1351
|
+
lambda z, a: mpmath.gammainc(z, a=a, regularized=True),
|
1352
|
+
[Arg(0, 1e4, inclusive_a=False), Arg(0, 1e4)],
|
1353
|
+
nan_ok=False,
|
1354
|
+
rtol=1e-11,
|
1355
|
+
)
|
1356
|
+
|
1357
|
+
def test_gammaln(self):
|
1358
|
+
# The real part of loggamma is log(|gamma(z)|).
|
1359
|
+
def f(z):
|
1360
|
+
return mpmath.loggamma(z).real
|
1361
|
+
|
1362
|
+
assert_mpmath_equal(sc.gammaln, exception_to_nan(f), [Arg()])
|
1363
|
+
|
1364
|
+
@pytest.mark.xfail(run=False)
|
1365
|
+
def test_gegenbauer(self):
|
1366
|
+
assert_mpmath_equal(
|
1367
|
+
sc.eval_gegenbauer,
|
1368
|
+
exception_to_nan(mpmath.gegenbauer),
|
1369
|
+
[Arg(-1e3, 1e3), Arg(), Arg()],
|
1370
|
+
)
|
1371
|
+
|
1372
|
+
def test_gegenbauer_int(self):
|
1373
|
+
# Redefine functions to deal with numerical + mpmath issues
|
1374
|
+
def gegenbauer(n, a, x):
|
1375
|
+
# Avoid overflow at large `a` (mpmath would need an even larger
|
1376
|
+
# dps to handle this correctly, so just skip this region)
|
1377
|
+
if abs(a) > 1e100:
|
1378
|
+
return np.nan
|
1379
|
+
|
1380
|
+
# Deal with n=0, n=1 correctly; mpmath 0.17 doesn't do these
|
1381
|
+
# always correctly
|
1382
|
+
if n == 0:
|
1383
|
+
r = 1.0
|
1384
|
+
elif n == 1:
|
1385
|
+
r = 2*a*x
|
1386
|
+
else:
|
1387
|
+
r = mpmath.gegenbauer(n, a, x)
|
1388
|
+
|
1389
|
+
# Mpmath 0.17 gives wrong results (spurious zero) in some cases, so
|
1390
|
+
# compute the value by perturbing the result
|
1391
|
+
if float(r) == 0 and a < -1 and float(a) == int(float(a)):
|
1392
|
+
r = mpmath.gegenbauer(n, a + mpmath.mpf('1e-50'), x)
|
1393
|
+
if abs(r) < mpmath.mpf('1e-50'):
|
1394
|
+
r = mpmath.mpf('0.0')
|
1395
|
+
|
1396
|
+
# Differing overflow thresholds in scipy vs. mpmath
|
1397
|
+
if abs(r) > 1e270:
|
1398
|
+
return np.inf
|
1399
|
+
return r
|
1400
|
+
|
1401
|
+
def sc_gegenbauer(n, a, x):
|
1402
|
+
r = sc.eval_gegenbauer(int(n), a, x)
|
1403
|
+
# Differing overflow thresholds in scipy vs. mpmath
|
1404
|
+
if abs(r) > 1e270:
|
1405
|
+
return np.inf
|
1406
|
+
return r
|
1407
|
+
assert_mpmath_equal(
|
1408
|
+
sc_gegenbauer,
|
1409
|
+
exception_to_nan(gegenbauer),
|
1410
|
+
[IntArg(0, 100), Arg(-1e9, 1e9), Arg()],
|
1411
|
+
n=40000, dps=100, ignore_inf_sign=True, rtol=1e-6,
|
1412
|
+
)
|
1413
|
+
|
1414
|
+
# Check the small-x expansion
|
1415
|
+
assert_mpmath_equal(
|
1416
|
+
sc_gegenbauer,
|
1417
|
+
exception_to_nan(gegenbauer),
|
1418
|
+
[IntArg(0, 100), Arg(), FixedArg(np.logspace(-30, -4, 30))],
|
1419
|
+
dps=100, ignore_inf_sign=True,
|
1420
|
+
)
|
1421
|
+
|
1422
|
+
@pytest.mark.xfail(run=False)
|
1423
|
+
def test_gegenbauer_complex(self):
|
1424
|
+
assert_mpmath_equal(
|
1425
|
+
lambda n, a, x: sc.eval_gegenbauer(int(n), a.real, x),
|
1426
|
+
exception_to_nan(mpmath.gegenbauer),
|
1427
|
+
[IntArg(0, 100), Arg(), ComplexArg()],
|
1428
|
+
)
|
1429
|
+
|
1430
|
+
@nonfunctional_tooslow
|
1431
|
+
def test_gegenbauer_complex_general(self):
|
1432
|
+
assert_mpmath_equal(
|
1433
|
+
lambda n, a, x: sc.eval_gegenbauer(n.real, a.real, x),
|
1434
|
+
exception_to_nan(mpmath.gegenbauer),
|
1435
|
+
[Arg(-1e3, 1e3), Arg(), ComplexArg()],
|
1436
|
+
)
|
1437
|
+
|
1438
|
+
def test_hankel1(self):
|
1439
|
+
assert_mpmath_equal(
|
1440
|
+
sc.hankel1,
|
1441
|
+
exception_to_nan(lambda v, x: mpmath.hankel1(v, x, **HYPERKW)),
|
1442
|
+
[Arg(-1e20, 1e20), Arg()],
|
1443
|
+
)
|
1444
|
+
|
1445
|
+
def test_hankel2(self):
|
1446
|
+
assert_mpmath_equal(
|
1447
|
+
sc.hankel2,
|
1448
|
+
exception_to_nan(lambda v, x: mpmath.hankel2(v, x, **HYPERKW)),
|
1449
|
+
[Arg(-1e20, 1e20), Arg()],
|
1450
|
+
)
|
1451
|
+
|
1452
|
+
@pytest.mark.xfail(run=False, reason="issues at intermediately large orders")
|
1453
|
+
def test_hermite(self):
|
1454
|
+
assert_mpmath_equal(
|
1455
|
+
lambda n, x: sc.eval_hermite(int(n), x),
|
1456
|
+
exception_to_nan(mpmath.hermite),
|
1457
|
+
[IntArg(0, 10000), Arg()],
|
1458
|
+
)
|
1459
|
+
|
1460
|
+
# hurwitz: same as zeta
|
1461
|
+
|
1462
|
+
def test_hyp0f1(self):
|
1463
|
+
# mpmath reports no convergence unless maxterms is large enough
|
1464
|
+
KW = dict(maxprec=400, maxterms=1500)
|
1465
|
+
# n=500 (non-xslow default) fails for one bad point
|
1466
|
+
assert_mpmath_equal(
|
1467
|
+
sc.hyp0f1,
|
1468
|
+
lambda a, x: mpmath.hyp0f1(a, x, **KW),
|
1469
|
+
[Arg(-1e7, 1e7), Arg(0, 1e5)],
|
1470
|
+
n=5000,
|
1471
|
+
)
|
1472
|
+
# NB: The range of the second parameter ("z") is limited from below
|
1473
|
+
# because of an overflow in the intermediate calculations. The way
|
1474
|
+
# for fix it is to implement an asymptotic expansion for Bessel J
|
1475
|
+
# (similar to what is implemented for Bessel I here).
|
1476
|
+
|
1477
|
+
def test_hyp0f1_complex(self):
|
1478
|
+
assert_mpmath_equal(
|
1479
|
+
lambda a, z: sc.hyp0f1(a.real, z),
|
1480
|
+
exception_to_nan(lambda a, x: mpmath.hyp0f1(a, x, **HYPERKW)),
|
1481
|
+
[Arg(-10, 10), ComplexArg(complex(-120, -120), complex(120, 120))],
|
1482
|
+
)
|
1483
|
+
# NB: The range of the first parameter ("v") are limited by an overflow
|
1484
|
+
# in the intermediate calculations. Can be fixed by implementing an
|
1485
|
+
# asymptotic expansion for Bessel functions for large order.
|
1486
|
+
|
1487
|
+
def test_hyp1f1(self):
|
1488
|
+
def mpmath_hyp1f1(a, b, x):
|
1489
|
+
try:
|
1490
|
+
return mpmath.hyp1f1(a, b, x)
|
1491
|
+
except ZeroDivisionError:
|
1492
|
+
return np.inf
|
1493
|
+
|
1494
|
+
assert_mpmath_equal(
|
1495
|
+
sc.hyp1f1,
|
1496
|
+
mpmath_hyp1f1,
|
1497
|
+
[Arg(-50, 50), Arg(1, 50, inclusive_a=False), Arg(-50, 50)],
|
1498
|
+
n=500,
|
1499
|
+
nan_ok=False,
|
1500
|
+
)
|
1501
|
+
|
1502
|
+
@pytest.mark.xfail(run=False)
|
1503
|
+
def test_hyp1f1_complex(self):
|
1504
|
+
assert_mpmath_equal(
|
1505
|
+
inf_to_nan(lambda a, b, x: sc.hyp1f1(a.real, b.real, x)),
|
1506
|
+
exception_to_nan(lambda a, b, x: mpmath.hyp1f1(a, b, x, **HYPERKW)),
|
1507
|
+
[Arg(-1e3, 1e3), Arg(-1e3, 1e3), ComplexArg()],
|
1508
|
+
n=2000,
|
1509
|
+
)
|
1510
|
+
|
1511
|
+
@nonfunctional_tooslow
|
1512
|
+
def test_hyp2f1_complex(self):
|
1513
|
+
# SciPy's hyp2f1 seems to have performance and accuracy problems
|
1514
|
+
assert_mpmath_equal(
|
1515
|
+
lambda a, b, c, x: sc.hyp2f1(a.real, b.real, c.real, x),
|
1516
|
+
exception_to_nan(lambda a, b, c, x: mpmath.hyp2f1(a, b, c, x, **HYPERKW)),
|
1517
|
+
[Arg(-1e2, 1e2), Arg(-1e2, 1e2), Arg(-1e2, 1e2), ComplexArg()],
|
1518
|
+
n=10,
|
1519
|
+
)
|
1520
|
+
|
1521
|
+
@pytest.mark.xfail(run=False)
|
1522
|
+
def test_hyperu(self):
|
1523
|
+
assert_mpmath_equal(
|
1524
|
+
sc.hyperu,
|
1525
|
+
exception_to_nan(lambda a, b, x: mpmath.hyperu(a, b, x, **HYPERKW)),
|
1526
|
+
[Arg(), Arg(), Arg()],
|
1527
|
+
)
|
1528
|
+
|
1529
|
+
@pytest.mark.xfail_on_32bit("mpmath issue gh-342: "
|
1530
|
+
"unsupported operand mpz, long for pow")
|
1531
|
+
def test_igam_fac(self):
|
1532
|
+
def mp_igam_fac(a, x):
|
1533
|
+
return mpmath.power(x, a)*mpmath.exp(-x)/mpmath.gamma(a)
|
1534
|
+
|
1535
|
+
assert_mpmath_equal(
|
1536
|
+
_igam_fac,
|
1537
|
+
mp_igam_fac,
|
1538
|
+
[Arg(0, 1e14, inclusive_a=False), Arg(0, 1e14)],
|
1539
|
+
rtol=1e-10,
|
1540
|
+
dps=29,
|
1541
|
+
)
|
1542
|
+
|
1543
|
+
def test_j0(self):
|
1544
|
+
# The Bessel function at large arguments is j0(x) ~ cos(x + phi)/sqrt(x)
|
1545
|
+
# and at large arguments the phase of the cosine loses precision.
|
1546
|
+
#
|
1547
|
+
# This is numerically expected behavior, so we compare only up to
|
1548
|
+
# 1e8 = 1e15 * 1e-7
|
1549
|
+
assert_mpmath_equal(sc.j0, mpmath.j0, [Arg(-1e3, 1e3)])
|
1550
|
+
assert_mpmath_equal(sc.j0, mpmath.j0, [Arg(-1e8, 1e8)], rtol=1e-5)
|
1551
|
+
|
1552
|
+
def test_j1(self):
|
1553
|
+
# See comment in test_j0
|
1554
|
+
assert_mpmath_equal(sc.j1, mpmath.j1, [Arg(-1e3, 1e3)])
|
1555
|
+
assert_mpmath_equal(sc.j1, mpmath.j1, [Arg(-1e8, 1e8)], rtol=1e-5)
|
1556
|
+
|
1557
|
+
@pytest.mark.xfail(run=False)
|
1558
|
+
def test_jacobi(self):
|
1559
|
+
assert_mpmath_equal(
|
1560
|
+
sc.eval_jacobi,
|
1561
|
+
exception_to_nan(lambda a, b, c, x: mpmath.jacobi(a, b, c, x, **HYPERKW)),
|
1562
|
+
[Arg(), Arg(), Arg(), Arg()],
|
1563
|
+
)
|
1564
|
+
assert_mpmath_equal(
|
1565
|
+
lambda n, b, c, x: sc.eval_jacobi(int(n), b, c, x),
|
1566
|
+
exception_to_nan(lambda a, b, c, x: mpmath.jacobi(a, b, c, x, **HYPERKW)),
|
1567
|
+
[IntArg(), Arg(), Arg(), Arg()],
|
1568
|
+
)
|
1569
|
+
|
1570
|
+
def test_jacobi_int(self):
|
1571
|
+
# Redefine functions to deal with numerical + mpmath issues
|
1572
|
+
def jacobi(n, a, b, x):
|
1573
|
+
# Mpmath does not handle n=0 case always correctly
|
1574
|
+
if n == 0:
|
1575
|
+
return 1.0
|
1576
|
+
return mpmath.jacobi(n, a, b, x)
|
1577
|
+
assert_mpmath_equal(
|
1578
|
+
lambda n, a, b, x: sc.eval_jacobi(int(n), a, b, x),
|
1579
|
+
lambda n, a, b, x: exception_to_nan(jacobi)(n, a, b, x, **HYPERKW),
|
1580
|
+
[IntArg(), Arg(), Arg(), Arg()],
|
1581
|
+
n=20000,
|
1582
|
+
dps=50,
|
1583
|
+
)
|
1584
|
+
|
1585
|
+
def test_kei(self):
|
1586
|
+
def kei(x):
|
1587
|
+
if x == 0:
|
1588
|
+
# work around mpmath issue at x=0
|
1589
|
+
return -pi/4
|
1590
|
+
return exception_to_nan(mpmath.kei)(0, x, **HYPERKW)
|
1591
|
+
assert_mpmath_equal(sc.kei, kei, [Arg(-1e30, 1e30)], n=1000)
|
1592
|
+
|
1593
|
+
def test_ker(self):
|
1594
|
+
assert_mpmath_equal(
|
1595
|
+
sc.ker,
|
1596
|
+
exception_to_nan(lambda x: mpmath.ker(0, x, **HYPERKW)),
|
1597
|
+
[Arg(-1e30, 1e30)],
|
1598
|
+
n=1000,
|
1599
|
+
)
|
1600
|
+
|
1601
|
+
@nonfunctional_tooslow
|
1602
|
+
def test_laguerre(self):
|
1603
|
+
assert_mpmath_equal(
|
1604
|
+
trace_args(sc.eval_laguerre),
|
1605
|
+
lambda n, x: exception_to_nan(mpmath.laguerre)(n, x, **HYPERKW),
|
1606
|
+
[Arg(), Arg()],
|
1607
|
+
)
|
1608
|
+
|
1609
|
+
def test_laguerre_int(self):
|
1610
|
+
assert_mpmath_equal(
|
1611
|
+
lambda n, x: sc.eval_laguerre(int(n), x),
|
1612
|
+
lambda n, x: exception_to_nan(mpmath.laguerre)(n, x, **HYPERKW),
|
1613
|
+
[IntArg(), Arg()],
|
1614
|
+
n=20000,
|
1615
|
+
)
|
1616
|
+
|
1617
|
+
@pytest.mark.xfail_on_32bit("see gh-3551 for bad points")
|
1618
|
+
def test_lambertw_real(self):
|
1619
|
+
assert_mpmath_equal(
|
1620
|
+
lambda x, k: sc.lambertw(x, int(k.real)),
|
1621
|
+
lambda x, k: mpmath.lambertw(x, int(k.real)),
|
1622
|
+
[ComplexArg(-np.inf, np.inf), IntArg(0, 10)],
|
1623
|
+
rtol=1e-13, nan_ok=False,
|
1624
|
+
)
|
1625
|
+
|
1626
|
+
def test_lanczos_sum_expg_scaled(self):
|
1627
|
+
maxgamma = 171.624376956302725
|
1628
|
+
e = np.exp(1)
|
1629
|
+
g = 6.024680040776729583740234375
|
1630
|
+
|
1631
|
+
def gamma(x):
|
1632
|
+
with np.errstate(over='ignore'):
|
1633
|
+
fac = ((x + g - 0.5)/e)**(x - 0.5)
|
1634
|
+
if fac != np.inf:
|
1635
|
+
res = fac*_lanczos_sum_expg_scaled(x)
|
1636
|
+
else:
|
1637
|
+
fac = ((x + g - 0.5)/e)**(0.5*(x - 0.5))
|
1638
|
+
res = fac*_lanczos_sum_expg_scaled(x)
|
1639
|
+
res *= fac
|
1640
|
+
return res
|
1641
|
+
|
1642
|
+
assert_mpmath_equal(
|
1643
|
+
gamma,
|
1644
|
+
mpmath.gamma,
|
1645
|
+
[Arg(0, maxgamma, inclusive_a=False)],
|
1646
|
+
rtol=1e-13,
|
1647
|
+
)
|
1648
|
+
|
1649
|
+
@nonfunctional_tooslow
|
1650
|
+
def test_legendre(self):
|
1651
|
+
assert_mpmath_equal(sc.eval_legendre, mpmath.legendre, [Arg(), Arg()])
|
1652
|
+
|
1653
|
+
def test_legendre_int(self):
|
1654
|
+
assert_mpmath_equal(
|
1655
|
+
lambda n, x: sc.eval_legendre(int(n), x),
|
1656
|
+
lambda n, x: exception_to_nan(mpmath.legendre)(n, x, **HYPERKW),
|
1657
|
+
[IntArg(), Arg()],
|
1658
|
+
n=20000,
|
1659
|
+
)
|
1660
|
+
|
1661
|
+
# Check the small-x expansion
|
1662
|
+
assert_mpmath_equal(
|
1663
|
+
lambda n, x: sc.eval_legendre(int(n), x),
|
1664
|
+
lambda n, x: exception_to_nan(mpmath.legendre)(n, x, **HYPERKW),
|
1665
|
+
[IntArg(), FixedArg(np.logspace(-30, -4, 20))],
|
1666
|
+
)
|
1667
|
+
|
1668
|
+
def test_legenp(self):
|
1669
|
+
def lpnm(n, m, z):
|
1670
|
+
try:
|
1671
|
+
with suppress_warnings() as sup:
|
1672
|
+
sup.filter(category=DeprecationWarning)
|
1673
|
+
v = sc.lpmn(m, n, z)[0][-1,-1]
|
1674
|
+
except ValueError:
|
1675
|
+
return np.nan
|
1676
|
+
if abs(v) > 1e306:
|
1677
|
+
# harmonize overflow to inf
|
1678
|
+
v = np.inf * np.sign(v.real)
|
1679
|
+
return v
|
1680
|
+
|
1681
|
+
def lpnm_2(n, m, z):
|
1682
|
+
v = sc.lpmv(m, n, z)
|
1683
|
+
if abs(v) > 1e306:
|
1684
|
+
# harmonize overflow to inf
|
1685
|
+
v = np.inf * np.sign(v.real)
|
1686
|
+
return v
|
1687
|
+
|
1688
|
+
def legenp(n, m, z):
|
1689
|
+
if (z == 1 or z == -1) and int(n) == n:
|
1690
|
+
# Special case (mpmath may give inf, we take the limit by
|
1691
|
+
# continuity)
|
1692
|
+
if m == 0:
|
1693
|
+
if n < 0:
|
1694
|
+
n = -n - 1
|
1695
|
+
return mpmath.power(mpmath.sign(z), n)
|
1696
|
+
else:
|
1697
|
+
return 0
|
1698
|
+
|
1699
|
+
if abs(z) < 1e-15:
|
1700
|
+
# mpmath has bad performance here
|
1701
|
+
return np.nan
|
1702
|
+
|
1703
|
+
typ = 2 if abs(z) <= 1 else 3
|
1704
|
+
v = exception_to_nan(mpmath.legenp)(n, m, z, type=typ)
|
1705
|
+
|
1706
|
+
if abs(v) > 1e306:
|
1707
|
+
# harmonize overflow to inf
|
1708
|
+
v = mpmath.inf * mpmath.sign(v.real)
|
1709
|
+
|
1710
|
+
return v
|
1711
|
+
|
1712
|
+
assert_mpmath_equal(lpnm, legenp, [IntArg(-100, 100), IntArg(-100, 100), Arg()])
|
1713
|
+
|
1714
|
+
assert_mpmath_equal(
|
1715
|
+
lpnm_2,
|
1716
|
+
legenp,
|
1717
|
+
[IntArg(-100, 100), Arg(-100, 100), Arg(-1, 1)],
|
1718
|
+
atol=1e-10,
|
1719
|
+
)
|
1720
|
+
|
1721
|
+
def test_legenp_complex_2(self):
|
1722
|
+
def clpnm(n, m, z):
|
1723
|
+
try:
|
1724
|
+
with suppress_warnings() as sup:
|
1725
|
+
sup.filter(category=DeprecationWarning)
|
1726
|
+
return sc.clpmn(m.real, n.real, z, type=2)[0][-1,-1]
|
1727
|
+
except ValueError:
|
1728
|
+
return np.nan
|
1729
|
+
|
1730
|
+
def legenp(n, m, z):
|
1731
|
+
if abs(z) < 1e-15:
|
1732
|
+
# mpmath has bad performance here
|
1733
|
+
return np.nan
|
1734
|
+
return exception_to_nan(mpmath.legenp)(int(n.real), int(m.real), z, type=2)
|
1735
|
+
|
1736
|
+
# mpmath is quite slow here
|
1737
|
+
x = np.array([-2, -0.99, -0.5, 0, 1e-5, 0.5, 0.99, 20, 2e3])
|
1738
|
+
y = np.array([-1e3, -0.5, 0.5, 1.3])
|
1739
|
+
z = (x[:,None] + 1j*y[None,:]).ravel()
|
1740
|
+
|
1741
|
+
assert_mpmath_equal(
|
1742
|
+
clpnm,
|
1743
|
+
legenp,
|
1744
|
+
[FixedArg([-2, -1, 0, 1, 2, 10]),
|
1745
|
+
FixedArg([-2, -1, 0, 1, 2, 10]),
|
1746
|
+
FixedArg(z)],
|
1747
|
+
rtol=1e-6,
|
1748
|
+
n=500,
|
1749
|
+
)
|
1750
|
+
|
1751
|
+
def test_legenp_complex_3(self):
|
1752
|
+
def clpnm(n, m, z):
|
1753
|
+
try:
|
1754
|
+
with suppress_warnings() as sup:
|
1755
|
+
sup.filter(category=DeprecationWarning)
|
1756
|
+
return sc.clpmn(m.real, n.real, z, type=3)[0][-1,-1]
|
1757
|
+
except ValueError:
|
1758
|
+
return np.nan
|
1759
|
+
|
1760
|
+
def legenp(n, m, z):
|
1761
|
+
if abs(z) < 1e-15:
|
1762
|
+
# mpmath has bad performance here
|
1763
|
+
return np.nan
|
1764
|
+
return exception_to_nan(mpmath.legenp)(int(n.real), int(m.real), z, type=3)
|
1765
|
+
|
1766
|
+
# mpmath is quite slow here
|
1767
|
+
x = np.array([-2, -0.99, -0.5, 0, 1e-5, 0.5, 0.99, 20, 2e3])
|
1768
|
+
y = np.array([-1e3, -0.5, 0.5, 1.3])
|
1769
|
+
z = (x[:,None] + 1j*y[None,:]).ravel()
|
1770
|
+
|
1771
|
+
assert_mpmath_equal(
|
1772
|
+
clpnm,
|
1773
|
+
legenp,
|
1774
|
+
[FixedArg([-2, -1, 0, 1, 2, 10]),
|
1775
|
+
FixedArg([-2, -1, 0, 1, 2, 10]),
|
1776
|
+
FixedArg(z)],
|
1777
|
+
rtol=1e-6,
|
1778
|
+
n=500,
|
1779
|
+
)
|
1780
|
+
|
1781
|
+
@pytest.mark.xfail(run=False, reason="apparently picks wrong function at |z| > 1")
|
1782
|
+
def test_legenq(self):
|
1783
|
+
def lqnm(n, m, z):
|
1784
|
+
return sc.lqmn(m, n, z)[0][-1,-1]
|
1785
|
+
|
1786
|
+
def legenq(n, m, z):
|
1787
|
+
if abs(z) < 1e-15:
|
1788
|
+
# mpmath has bad performance here
|
1789
|
+
return np.nan
|
1790
|
+
return exception_to_nan(mpmath.legenq)(n, m, z, type=2)
|
1791
|
+
|
1792
|
+
assert_mpmath_equal(
|
1793
|
+
lqnm,
|
1794
|
+
legenq,
|
1795
|
+
[IntArg(0, 100), IntArg(0, 100), Arg()],
|
1796
|
+
)
|
1797
|
+
|
1798
|
+
@nonfunctional_tooslow
|
1799
|
+
def test_legenq_complex(self):
|
1800
|
+
def lqnm(n, m, z):
|
1801
|
+
return sc.lqmn(int(m.real), int(n.real), z)[0][-1,-1]
|
1802
|
+
|
1803
|
+
def legenq(n, m, z):
|
1804
|
+
if abs(z) < 1e-15:
|
1805
|
+
# mpmath has bad performance here
|
1806
|
+
return np.nan
|
1807
|
+
return exception_to_nan(mpmath.legenq)(int(n.real), int(m.real), z, type=2)
|
1808
|
+
|
1809
|
+
assert_mpmath_equal(
|
1810
|
+
lqnm,
|
1811
|
+
legenq,
|
1812
|
+
[IntArg(0, 100), IntArg(0, 100), ComplexArg()],
|
1813
|
+
n=100,
|
1814
|
+
)
|
1815
|
+
|
1816
|
+
def test_lgam1p(self):
|
1817
|
+
def param_filter(x):
|
1818
|
+
# Filter the poles
|
1819
|
+
return np.where((np.floor(x) == x) & (x <= 0), False, True)
|
1820
|
+
|
1821
|
+
def mp_lgam1p(z):
|
1822
|
+
# The real part of loggamma is log(|gamma(z)|)
|
1823
|
+
return mpmath.loggamma(1 + z).real
|
1824
|
+
|
1825
|
+
assert_mpmath_equal(
|
1826
|
+
_lgam1p,
|
1827
|
+
mp_lgam1p,
|
1828
|
+
[Arg()],
|
1829
|
+
rtol=1e-13,
|
1830
|
+
dps=100,
|
1831
|
+
param_filter=param_filter,
|
1832
|
+
)
|
1833
|
+
|
1834
|
+
def test_loggamma(self):
|
1835
|
+
def mpmath_loggamma(z):
|
1836
|
+
try:
|
1837
|
+
res = mpmath.loggamma(z)
|
1838
|
+
except ValueError:
|
1839
|
+
res = complex(np.nan, np.nan)
|
1840
|
+
return res
|
1841
|
+
|
1842
|
+
assert_mpmath_equal(
|
1843
|
+
sc.loggamma,
|
1844
|
+
mpmath_loggamma,
|
1845
|
+
[ComplexArg()],
|
1846
|
+
nan_ok=False,
|
1847
|
+
distinguish_nan_and_inf=False,
|
1848
|
+
rtol=5e-14,
|
1849
|
+
)
|
1850
|
+
|
1851
|
+
@pytest.mark.xfail(run=False)
|
1852
|
+
def test_pcfd(self):
|
1853
|
+
def pcfd(v, x):
|
1854
|
+
return sc.pbdv(v, x)[0]
|
1855
|
+
assert_mpmath_equal(
|
1856
|
+
pcfd,
|
1857
|
+
exception_to_nan(lambda v, x: mpmath.pcfd(v, x, **HYPERKW)),
|
1858
|
+
[Arg(), Arg()],
|
1859
|
+
)
|
1860
|
+
|
1861
|
+
@pytest.mark.xfail(run=False, reason="it's not the same as the mpmath function --- "
|
1862
|
+
"maybe different definition?")
|
1863
|
+
def test_pcfv(self):
|
1864
|
+
def pcfv(v, x):
|
1865
|
+
return sc.pbvv(v, x)[0]
|
1866
|
+
assert_mpmath_equal(
|
1867
|
+
pcfv,
|
1868
|
+
lambda v, x: time_limited()(exception_to_nan(mpmath.pcfv))(v, x, **HYPERKW),
|
1869
|
+
[Arg(), Arg()],
|
1870
|
+
n=1000,
|
1871
|
+
)
|
1872
|
+
|
1873
|
+
def test_pcfw(self):
|
1874
|
+
def pcfw(a, x):
|
1875
|
+
return sc.pbwa(a, x)[0]
|
1876
|
+
|
1877
|
+
def dpcfw(a, x):
|
1878
|
+
return sc.pbwa(a, x)[1]
|
1879
|
+
|
1880
|
+
def mpmath_dpcfw(a, x):
|
1881
|
+
return mpmath.diff(mpmath.pcfw, (a, x), (0, 1))
|
1882
|
+
|
1883
|
+
# The Zhang and Jin implementation only uses Taylor series and
|
1884
|
+
# is thus accurate in only a very small range.
|
1885
|
+
assert_mpmath_equal(
|
1886
|
+
pcfw,
|
1887
|
+
mpmath.pcfw,
|
1888
|
+
[Arg(-5, 5), Arg(-5, 5)],
|
1889
|
+
rtol=2e-8,
|
1890
|
+
n=100,
|
1891
|
+
)
|
1892
|
+
|
1893
|
+
assert_mpmath_equal(
|
1894
|
+
dpcfw,
|
1895
|
+
mpmath_dpcfw,
|
1896
|
+
[Arg(-5, 5), Arg(-5, 5)],
|
1897
|
+
rtol=2e-9,
|
1898
|
+
n=100,
|
1899
|
+
)
|
1900
|
+
|
1901
|
+
@pytest.mark.xfail(run=False,
|
1902
|
+
reason="issues at large arguments (atol OK, rtol not) "
|
1903
|
+
"and <eps-close to z=0")
|
1904
|
+
def test_polygamma(self):
|
1905
|
+
assert_mpmath_equal(
|
1906
|
+
sc.polygamma,
|
1907
|
+
time_limited()(exception_to_nan(mpmath.polygamma)),
|
1908
|
+
[IntArg(0, 1000), Arg()],
|
1909
|
+
)
|
1910
|
+
|
1911
|
+
def test_rgamma(self):
|
1912
|
+
assert_mpmath_equal(
|
1913
|
+
sc.rgamma,
|
1914
|
+
mpmath.rgamma,
|
1915
|
+
[Arg(-8000, np.inf)],
|
1916
|
+
n=5000,
|
1917
|
+
nan_ok=False,
|
1918
|
+
ignore_inf_sign=True,
|
1919
|
+
)
|
1920
|
+
|
1921
|
+
def test_rgamma_complex(self):
|
1922
|
+
assert_mpmath_equal(
|
1923
|
+
sc.rgamma,
|
1924
|
+
exception_to_nan(mpmath.rgamma),
|
1925
|
+
[ComplexArg()],
|
1926
|
+
rtol=5e-13,
|
1927
|
+
)
|
1928
|
+
|
1929
|
+
@pytest.mark.xfail(reason=("see gh-3551 for bad points on 32 bit "
|
1930
|
+
"systems and gh-8095 for another bad "
|
1931
|
+
"point"))
|
1932
|
+
def test_rf(self):
|
1933
|
+
if _pep440.parse(mpmath.__version__) >= _pep440.Version("1.0.0"):
|
1934
|
+
# no workarounds needed
|
1935
|
+
mppoch = mpmath.rf
|
1936
|
+
else:
|
1937
|
+
def mppoch(a, m):
|
1938
|
+
# deal with cases where the result in double precision
|
1939
|
+
# hits exactly a non-positive integer, but the
|
1940
|
+
# corresponding extended-precision mpf floats don't
|
1941
|
+
if float(a + m) == int(a + m) and float(a + m) <= 0:
|
1942
|
+
a = mpmath.mpf(a)
|
1943
|
+
m = int(a + m) - a
|
1944
|
+
return mpmath.rf(a, m)
|
1945
|
+
|
1946
|
+
assert_mpmath_equal(sc.poch, mppoch, [Arg(), Arg()], dps=400)
|
1947
|
+
|
1948
|
+
def test_sinpi(self):
|
1949
|
+
eps = np.finfo(float).eps
|
1950
|
+
assert_mpmath_equal(
|
1951
|
+
_sinpi,
|
1952
|
+
mpmath.sinpi,
|
1953
|
+
[Arg()],
|
1954
|
+
nan_ok=False,
|
1955
|
+
rtol=2*eps,
|
1956
|
+
)
|
1957
|
+
|
1958
|
+
def test_sinpi_complex(self):
|
1959
|
+
assert_mpmath_equal(
|
1960
|
+
_sinpi,
|
1961
|
+
mpmath.sinpi,
|
1962
|
+
[ComplexArg()],
|
1963
|
+
nan_ok=False,
|
1964
|
+
rtol=2e-14,
|
1965
|
+
)
|
1966
|
+
|
1967
|
+
def test_shi(self):
|
1968
|
+
def shi(x):
|
1969
|
+
return sc.shichi(x)[0]
|
1970
|
+
assert_mpmath_equal(shi, mpmath.shi, [Arg()])
|
1971
|
+
# check asymptotic series cross-over
|
1972
|
+
assert_mpmath_equal(shi, mpmath.shi, [FixedArg([88 - 1e-9, 88, 88 + 1e-9])])
|
1973
|
+
|
1974
|
+
def test_shi_complex(self):
|
1975
|
+
def shi(z):
|
1976
|
+
return sc.shichi(z)[0]
|
1977
|
+
# shi oscillates as Im[z] -> +- inf, so limit range
|
1978
|
+
assert_mpmath_equal(
|
1979
|
+
shi,
|
1980
|
+
mpmath.shi,
|
1981
|
+
[ComplexArg(complex(-np.inf, -1e8), complex(np.inf, 1e8))],
|
1982
|
+
rtol=1e-12,
|
1983
|
+
)
|
1984
|
+
|
1985
|
+
def test_si(self):
|
1986
|
+
def si(x):
|
1987
|
+
return sc.sici(x)[0]
|
1988
|
+
assert_mpmath_equal(si, mpmath.si, [Arg()])
|
1989
|
+
|
1990
|
+
def test_si_complex(self):
|
1991
|
+
def si(z):
|
1992
|
+
return sc.sici(z)[0]
|
1993
|
+
# si oscillates as Re[z] -> +- inf, so limit range
|
1994
|
+
assert_mpmath_equal(
|
1995
|
+
si,
|
1996
|
+
mpmath.si,
|
1997
|
+
[ComplexArg(complex(-1e8, -np.inf), complex(1e8, np.inf))],
|
1998
|
+
rtol=1e-12,
|
1999
|
+
)
|
2000
|
+
|
2001
|
+
def test_spence(self):
|
2002
|
+
# mpmath uses a different convention for the dilogarithm
|
2003
|
+
def dilog(x):
|
2004
|
+
return mpmath.polylog(2, 1 - x)
|
2005
|
+
# Spence has a branch cut on the negative real axis
|
2006
|
+
assert_mpmath_equal(
|
2007
|
+
sc.spence,
|
2008
|
+
exception_to_nan(dilog),
|
2009
|
+
[Arg(0, np.inf)],
|
2010
|
+
rtol=1e-14,
|
2011
|
+
)
|
2012
|
+
|
2013
|
+
def test_spence_complex(self):
|
2014
|
+
def dilog(z):
|
2015
|
+
return mpmath.polylog(2, 1 - z)
|
2016
|
+
assert_mpmath_equal(
|
2017
|
+
sc.spence,
|
2018
|
+
exception_to_nan(dilog),
|
2019
|
+
[ComplexArg()],
|
2020
|
+
rtol=1e-14,
|
2021
|
+
)
|
2022
|
+
|
2023
|
+
def test_spherharm(self):
|
2024
|
+
def spherharm(l, m, theta, phi):
|
2025
|
+
if m > l:
|
2026
|
+
return np.nan
|
2027
|
+
with suppress_warnings() as sup:
|
2028
|
+
sup.filter(category=DeprecationWarning)
|
2029
|
+
return sc.sph_harm(m, l, phi, theta)
|
2030
|
+
assert_mpmath_equal(
|
2031
|
+
spherharm,
|
2032
|
+
mpmath.spherharm,
|
2033
|
+
[IntArg(0, 100), IntArg(0, 100), Arg(a=0, b=pi), Arg(a=0, b=2*pi)],
|
2034
|
+
atol=1e-8,
|
2035
|
+
n=6000,
|
2036
|
+
dps=150,
|
2037
|
+
)
|
2038
|
+
|
2039
|
+
def test_struveh(self):
|
2040
|
+
assert_mpmath_equal(
|
2041
|
+
sc.struve,
|
2042
|
+
exception_to_nan(mpmath.struveh),
|
2043
|
+
[Arg(-1e4, 1e4), Arg(0, 1e4)],
|
2044
|
+
rtol=5e-10,
|
2045
|
+
)
|
2046
|
+
|
2047
|
+
def test_struvel(self):
|
2048
|
+
def mp_struvel(v, z):
|
2049
|
+
if v < 0 and z < -v and abs(v) > 1000:
|
2050
|
+
# larger DPS needed for correct results
|
2051
|
+
old_dps = mpmath.mp.dps
|
2052
|
+
try:
|
2053
|
+
mpmath.mp.dps = 500
|
2054
|
+
return mpmath.struvel(v, z)
|
2055
|
+
finally:
|
2056
|
+
mpmath.mp.dps = old_dps
|
2057
|
+
return mpmath.struvel(v, z)
|
2058
|
+
|
2059
|
+
assert_mpmath_equal(
|
2060
|
+
sc.modstruve,
|
2061
|
+
exception_to_nan(mp_struvel),
|
2062
|
+
[Arg(-1e4, 1e4), Arg(0, 1e4)],
|
2063
|
+
rtol=5e-10,
|
2064
|
+
ignore_inf_sign=True,
|
2065
|
+
)
|
2066
|
+
|
2067
|
+
def test_wrightomega_real(self):
|
2068
|
+
def mpmath_wrightomega_real(x):
|
2069
|
+
return mpmath.lambertw(mpmath.exp(x), mpmath.mpf('-0.5'))
|
2070
|
+
|
2071
|
+
# For x < -1000 the Wright Omega function is just 0 to double
|
2072
|
+
# precision, and for x > 1e21 it is just x to double
|
2073
|
+
# precision.
|
2074
|
+
assert_mpmath_equal(
|
2075
|
+
sc.wrightomega,
|
2076
|
+
mpmath_wrightomega_real,
|
2077
|
+
[Arg(-1000, 1e21)],
|
2078
|
+
rtol=5e-15,
|
2079
|
+
atol=0,
|
2080
|
+
nan_ok=False,
|
2081
|
+
)
|
2082
|
+
|
2083
|
+
def test_wrightomega(self):
|
2084
|
+
assert_mpmath_equal(
|
2085
|
+
sc.wrightomega,
|
2086
|
+
lambda z: _mpmath_wrightomega(z, 25),
|
2087
|
+
[ComplexArg()],
|
2088
|
+
rtol=1e-14,
|
2089
|
+
nan_ok=False,
|
2090
|
+
)
|
2091
|
+
|
2092
|
+
def test_hurwitz_zeta(self):
|
2093
|
+
assert_mpmath_equal(
|
2094
|
+
sc.zeta,
|
2095
|
+
exception_to_nan(mpmath.zeta),
|
2096
|
+
[Arg(a=1, b=1e10, inclusive_a=False), Arg(a=0, inclusive_a=False)],
|
2097
|
+
)
|
2098
|
+
|
2099
|
+
def test_riemann_zeta(self):
|
2100
|
+
assert_mpmath_equal(
|
2101
|
+
sc.zeta,
|
2102
|
+
lambda x: mpmath.zeta(x) if x != 1 else mpmath.inf,
|
2103
|
+
[Arg(-100, 100)],
|
2104
|
+
nan_ok=False,
|
2105
|
+
rtol=5e-13,
|
2106
|
+
)
|
2107
|
+
|
2108
|
+
def test_zetac(self):
|
2109
|
+
assert_mpmath_equal(
|
2110
|
+
sc.zetac,
|
2111
|
+
lambda x: mpmath.zeta(x) - 1 if x != 1 else mpmath.inf,
|
2112
|
+
[Arg(-100, 100)],
|
2113
|
+
nan_ok=False,
|
2114
|
+
dps=45,
|
2115
|
+
rtol=5e-13,
|
2116
|
+
)
|
2117
|
+
|
2118
|
+
def test_boxcox(self):
|
2119
|
+
|
2120
|
+
def mp_boxcox(x, lmbda):
|
2121
|
+
x = mpmath.mp.mpf(x)
|
2122
|
+
lmbda = mpmath.mp.mpf(lmbda)
|
2123
|
+
if lmbda == 0:
|
2124
|
+
return mpmath.mp.log(x)
|
2125
|
+
else:
|
2126
|
+
return mpmath.mp.powm1(x, lmbda) / lmbda
|
2127
|
+
|
2128
|
+
assert_mpmath_equal(
|
2129
|
+
sc.boxcox,
|
2130
|
+
exception_to_nan(mp_boxcox),
|
2131
|
+
[Arg(a=0, inclusive_a=False), Arg()],
|
2132
|
+
n=200,
|
2133
|
+
dps=60,
|
2134
|
+
rtol=1e-13,
|
2135
|
+
)
|
2136
|
+
|
2137
|
+
def test_boxcox1p(self):
|
2138
|
+
|
2139
|
+
def mp_boxcox1p(x, lmbda):
|
2140
|
+
x = mpmath.mp.mpf(x)
|
2141
|
+
lmbda = mpmath.mp.mpf(lmbda)
|
2142
|
+
one = mpmath.mp.mpf(1)
|
2143
|
+
if lmbda == 0:
|
2144
|
+
return mpmath.mp.log(one + x)
|
2145
|
+
else:
|
2146
|
+
return mpmath.mp.powm1(one + x, lmbda) / lmbda
|
2147
|
+
|
2148
|
+
assert_mpmath_equal(
|
2149
|
+
sc.boxcox1p,
|
2150
|
+
exception_to_nan(mp_boxcox1p),
|
2151
|
+
[Arg(a=-1, inclusive_a=False), Arg()],
|
2152
|
+
n=200,
|
2153
|
+
dps=60,
|
2154
|
+
rtol=1e-13,
|
2155
|
+
)
|
2156
|
+
|
2157
|
+
def test_spherical_jn(self):
|
2158
|
+
def mp_spherical_jn(n, z):
|
2159
|
+
arg = mpmath.mpmathify(z)
|
2160
|
+
out = (mpmath.besselj(n + mpmath.mpf(1)/2, arg) /
|
2161
|
+
mpmath.sqrt(2*arg/mpmath.pi))
|
2162
|
+
if arg.imag == 0:
|
2163
|
+
return out.real
|
2164
|
+
else:
|
2165
|
+
return out
|
2166
|
+
|
2167
|
+
assert_mpmath_equal(
|
2168
|
+
lambda n, z: sc.spherical_jn(int(n), z),
|
2169
|
+
exception_to_nan(mp_spherical_jn),
|
2170
|
+
[IntArg(0, 200), Arg(-1e8, 1e8)],
|
2171
|
+
dps=300,
|
2172
|
+
# underflow of `spherical_jn` is a bit premature; see gh-21629
|
2173
|
+
param_filter=(None, lambda z: np.abs(z) > 1e-20),
|
2174
|
+
)
|
2175
|
+
|
2176
|
+
def test_spherical_jn_complex(self):
|
2177
|
+
def mp_spherical_jn(n, z):
|
2178
|
+
arg = mpmath.mpmathify(z)
|
2179
|
+
out = (mpmath.besselj(n + mpmath.mpf(1)/2, arg) /
|
2180
|
+
mpmath.sqrt(2*arg/mpmath.pi))
|
2181
|
+
if arg.imag == 0:
|
2182
|
+
return out.real
|
2183
|
+
else:
|
2184
|
+
return out
|
2185
|
+
|
2186
|
+
assert_mpmath_equal(
|
2187
|
+
lambda n, z: sc.spherical_jn(int(n.real), z),
|
2188
|
+
exception_to_nan(mp_spherical_jn),
|
2189
|
+
[IntArg(0, 200), ComplexArg()]
|
2190
|
+
)
|
2191
|
+
|
2192
|
+
def test_spherical_yn(self):
|
2193
|
+
def mp_spherical_yn(n, z):
|
2194
|
+
arg = mpmath.mpmathify(z)
|
2195
|
+
out = (mpmath.bessely(n + mpmath.mpf(1)/2, arg) /
|
2196
|
+
mpmath.sqrt(2*arg/mpmath.pi))
|
2197
|
+
if arg.imag == 0:
|
2198
|
+
return out.real
|
2199
|
+
else:
|
2200
|
+
return out
|
2201
|
+
|
2202
|
+
assert_mpmath_equal(
|
2203
|
+
lambda n, z: sc.spherical_yn(int(n), z),
|
2204
|
+
exception_to_nan(mp_spherical_yn),
|
2205
|
+
[IntArg(0, 200), Arg(-1e10, 1e10)],
|
2206
|
+
dps=100,
|
2207
|
+
)
|
2208
|
+
|
2209
|
+
def test_spherical_yn_complex(self):
|
2210
|
+
def mp_spherical_yn(n, z):
|
2211
|
+
arg = mpmath.mpmathify(z)
|
2212
|
+
out = (mpmath.bessely(n + mpmath.mpf(1)/2, arg) /
|
2213
|
+
mpmath.sqrt(2*arg/mpmath.pi))
|
2214
|
+
if arg.imag == 0:
|
2215
|
+
return out.real
|
2216
|
+
else:
|
2217
|
+
return out
|
2218
|
+
|
2219
|
+
assert_mpmath_equal(
|
2220
|
+
lambda n, z: sc.spherical_yn(int(n.real), z),
|
2221
|
+
exception_to_nan(mp_spherical_yn),
|
2222
|
+
[IntArg(0, 200), ComplexArg()],
|
2223
|
+
)
|
2224
|
+
|
2225
|
+
def test_spherical_in(self):
|
2226
|
+
def mp_spherical_in(n, z):
|
2227
|
+
arg = mpmath.mpmathify(z)
|
2228
|
+
out = (mpmath.besseli(n + mpmath.mpf(1)/2, arg) /
|
2229
|
+
mpmath.sqrt(2*arg/mpmath.pi))
|
2230
|
+
if arg.imag == 0:
|
2231
|
+
return out.real
|
2232
|
+
else:
|
2233
|
+
return out
|
2234
|
+
|
2235
|
+
assert_mpmath_equal(
|
2236
|
+
lambda n, z: sc.spherical_in(int(n), z),
|
2237
|
+
exception_to_nan(mp_spherical_in),
|
2238
|
+
[IntArg(0, 200), Arg()],
|
2239
|
+
dps=200,
|
2240
|
+
atol=10**(-278),
|
2241
|
+
)
|
2242
|
+
|
2243
|
+
def test_spherical_in_complex(self):
|
2244
|
+
def mp_spherical_in(n, z):
|
2245
|
+
arg = mpmath.mpmathify(z)
|
2246
|
+
out = (mpmath.besseli(n + mpmath.mpf(1)/2, arg) /
|
2247
|
+
mpmath.sqrt(2*arg/mpmath.pi))
|
2248
|
+
if arg.imag == 0:
|
2249
|
+
return out.real
|
2250
|
+
else:
|
2251
|
+
return out
|
2252
|
+
|
2253
|
+
assert_mpmath_equal(
|
2254
|
+
lambda n, z: sc.spherical_in(int(n.real), z),
|
2255
|
+
exception_to_nan(mp_spherical_in),
|
2256
|
+
[IntArg(0, 200), ComplexArg()],
|
2257
|
+
)
|
2258
|
+
|
2259
|
+
def test_spherical_kn(self):
|
2260
|
+
def mp_spherical_kn(n, z):
|
2261
|
+
arg = mpmath.mpmathify(z)
|
2262
|
+
out = (mpmath.besselk(n + mpmath.mpf(1)/2, arg) /
|
2263
|
+
mpmath.sqrt(2*arg/mpmath.pi))
|
2264
|
+
if mpmath.mpmathify(z).imag == 0:
|
2265
|
+
return out.real
|
2266
|
+
else:
|
2267
|
+
return out
|
2268
|
+
|
2269
|
+
assert_mpmath_equal(
|
2270
|
+
lambda n, z: sc.spherical_kn(int(n), z),
|
2271
|
+
exception_to_nan(mp_spherical_kn),
|
2272
|
+
[IntArg(0, 150), Arg()],
|
2273
|
+
dps=100,
|
2274
|
+
)
|
2275
|
+
|
2276
|
+
@pytest.mark.xfail(run=False,
|
2277
|
+
reason="Accuracy issues near z = -1 inherited from kv.")
|
2278
|
+
def test_spherical_kn_complex(self):
|
2279
|
+
def mp_spherical_kn(n, z):
|
2280
|
+
arg = mpmath.mpmathify(z)
|
2281
|
+
out = (mpmath.besselk(n + mpmath.mpf(1)/2, arg) /
|
2282
|
+
mpmath.sqrt(2*arg/mpmath.pi))
|
2283
|
+
if arg.imag == 0:
|
2284
|
+
return out.real
|
2285
|
+
else:
|
2286
|
+
return out
|
2287
|
+
|
2288
|
+
assert_mpmath_equal(
|
2289
|
+
lambda n, z: sc.spherical_kn(int(n.real), z),
|
2290
|
+
exception_to_nan(mp_spherical_kn),
|
2291
|
+
[IntArg(0, 200), ComplexArg()],
|
2292
|
+
dps=200,
|
2293
|
+
)
|