Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +2 -0
- mgm/lib/python3.10/site-packages/numpy/array_api/__pycache__/_creation_functions.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/numpy/array_api/__pycache__/_dtypes.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/numpy/array_api/__pycache__/_elementwise_functions.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/numpy/array_api/__pycache__/_indexing_functions.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/numpy/array_api/__pycache__/_searching_functions.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/numpy/array_api/__pycache__/_sorting_functions.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/numpy/array_api/__pycache__/_utility_functions.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/numpy/array_api/__pycache__/linalg.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/numpy/array_api/tests/__pycache__/__init__.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/numpy/array_api/tests/__pycache__/test_manipulation_functions.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/numpy/random/__init__.pyi +72 -0
- mgm/lib/python3.10/site-packages/numpy/random/_generator.cpython-310-x86_64-linux-gnu.so +3 -0
- mgm/lib/python3.10/site-packages/numpy/random/_generator.pyi +681 -0
- mgm/lib/python3.10/site-packages/numpy/random/_mt19937.pyi +22 -0
- mgm/lib/python3.10/site-packages/numpy/random/_philox.cpython-310-x86_64-linux-gnu.so +3 -0
- mgm/lib/python3.10/site-packages/numpy/random/_philox.pyi +36 -0
- mgm/lib/python3.10/site-packages/numpy/random/_pickle.py +80 -0
- mgm/lib/python3.10/site-packages/numpy/random/mtrand.pyi +571 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/__init__.py +22 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/__pycache__/__init__.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/__pycache__/_internal.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/_internal.py +46 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/common/__pycache__/__init__.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/common/__pycache__/_fft.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/common/__pycache__/_helpers.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/common/__pycache__/_linalg.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/__init__.py +16 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/__pycache__/__init__.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/__pycache__/_aliases.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/__pycache__/_info.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/__pycache__/_typing.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/__pycache__/fft.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/__pycache__/linalg.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/_aliases.py +136 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/_info.py +326 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/_typing.py +46 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/fft.py +36 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/linalg.py +49 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/__init__.py +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/__pycache__/__init__.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/__init__.py +9 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/__pycache__/__init__.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/__pycache__/_aliases.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/__pycache__/_info.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/__pycache__/fft.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/__pycache__/linalg.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/_aliases.py +217 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/_info.py +345 -0
- mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/fft.py +24 -0
.gitattributes
CHANGED
|
@@ -1128,3 +1128,5 @@ mgm/lib/python3.10/site-packages/numpy/random/_bounded_integers.cpython-310-x86_
|
|
| 1128 |
mgm/lib/python3.10/site-packages/numpy/random/_pcg64.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1129 |
mgm/lib/python3.10/site-packages/numpy/random/_mt19937.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1130 |
mgm/lib/python3.10/site-packages/numpy/random/bit_generator.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 1128 |
mgm/lib/python3.10/site-packages/numpy/random/_pcg64.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1129 |
mgm/lib/python3.10/site-packages/numpy/random/_mt19937.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1130 |
mgm/lib/python3.10/site-packages/numpy/random/bit_generator.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1131 |
+
mgm/lib/python3.10/site-packages/numpy/random/_philox.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1132 |
+
mgm/lib/python3.10/site-packages/numpy/random/_generator.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
mgm/lib/python3.10/site-packages/numpy/array_api/__pycache__/_creation_functions.cpython-310.pyc
ADDED
|
Binary file (8.46 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/numpy/array_api/__pycache__/_dtypes.cpython-310.pyc
ADDED
|
Binary file (2.49 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/numpy/array_api/__pycache__/_elementwise_functions.cpython-310.pyc
ADDED
|
Binary file (19.7 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/numpy/array_api/__pycache__/_indexing_functions.cpython-310.pyc
ADDED
|
Binary file (968 Bytes). View file
|
|
|
mgm/lib/python3.10/site-packages/numpy/array_api/__pycache__/_searching_functions.cpython-310.pyc
ADDED
|
Binary file (2.13 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/numpy/array_api/__pycache__/_sorting_functions.cpython-310.pyc
ADDED
|
Binary file (1.55 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/numpy/array_api/__pycache__/_utility_functions.cpython-310.pyc
ADDED
|
Binary file (1.06 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/numpy/array_api/__pycache__/linalg.cpython-310.pyc
ADDED
|
Binary file (13.4 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/numpy/array_api/tests/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (460 Bytes). View file
|
|
|
mgm/lib/python3.10/site-packages/numpy/array_api/tests/__pycache__/test_manipulation_functions.cpython-310.pyc
ADDED
|
Binary file (1.75 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/numpy/random/__init__.pyi
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from numpy._pytesttester import PytestTester
|
| 2 |
+
|
| 3 |
+
from numpy.random._generator import Generator as Generator
|
| 4 |
+
from numpy.random._generator import default_rng as default_rng
|
| 5 |
+
from numpy.random._mt19937 import MT19937 as MT19937
|
| 6 |
+
from numpy.random._pcg64 import (
|
| 7 |
+
PCG64 as PCG64,
|
| 8 |
+
PCG64DXSM as PCG64DXSM,
|
| 9 |
+
)
|
| 10 |
+
from numpy.random._philox import Philox as Philox
|
| 11 |
+
from numpy.random._sfc64 import SFC64 as SFC64
|
| 12 |
+
from numpy.random.bit_generator import BitGenerator as BitGenerator
|
| 13 |
+
from numpy.random.bit_generator import SeedSequence as SeedSequence
|
| 14 |
+
from numpy.random.mtrand import (
|
| 15 |
+
RandomState as RandomState,
|
| 16 |
+
beta as beta,
|
| 17 |
+
binomial as binomial,
|
| 18 |
+
bytes as bytes,
|
| 19 |
+
chisquare as chisquare,
|
| 20 |
+
choice as choice,
|
| 21 |
+
dirichlet as dirichlet,
|
| 22 |
+
exponential as exponential,
|
| 23 |
+
f as f,
|
| 24 |
+
gamma as gamma,
|
| 25 |
+
geometric as geometric,
|
| 26 |
+
get_bit_generator as get_bit_generator,
|
| 27 |
+
get_state as get_state,
|
| 28 |
+
gumbel as gumbel,
|
| 29 |
+
hypergeometric as hypergeometric,
|
| 30 |
+
laplace as laplace,
|
| 31 |
+
logistic as logistic,
|
| 32 |
+
lognormal as lognormal,
|
| 33 |
+
logseries as logseries,
|
| 34 |
+
multinomial as multinomial,
|
| 35 |
+
multivariate_normal as multivariate_normal,
|
| 36 |
+
negative_binomial as negative_binomial,
|
| 37 |
+
noncentral_chisquare as noncentral_chisquare,
|
| 38 |
+
noncentral_f as noncentral_f,
|
| 39 |
+
normal as normal,
|
| 40 |
+
pareto as pareto,
|
| 41 |
+
permutation as permutation,
|
| 42 |
+
poisson as poisson,
|
| 43 |
+
power as power,
|
| 44 |
+
rand as rand,
|
| 45 |
+
randint as randint,
|
| 46 |
+
randn as randn,
|
| 47 |
+
random as random,
|
| 48 |
+
random_integers as random_integers,
|
| 49 |
+
random_sample as random_sample,
|
| 50 |
+
ranf as ranf,
|
| 51 |
+
rayleigh as rayleigh,
|
| 52 |
+
sample as sample,
|
| 53 |
+
seed as seed,
|
| 54 |
+
set_bit_generator as set_bit_generator,
|
| 55 |
+
set_state as set_state,
|
| 56 |
+
shuffle as shuffle,
|
| 57 |
+
standard_cauchy as standard_cauchy,
|
| 58 |
+
standard_exponential as standard_exponential,
|
| 59 |
+
standard_gamma as standard_gamma,
|
| 60 |
+
standard_normal as standard_normal,
|
| 61 |
+
standard_t as standard_t,
|
| 62 |
+
triangular as triangular,
|
| 63 |
+
uniform as uniform,
|
| 64 |
+
vonmises as vonmises,
|
| 65 |
+
wald as wald,
|
| 66 |
+
weibull as weibull,
|
| 67 |
+
zipf as zipf,
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
__all__: list[str]
|
| 71 |
+
__path__: list[str]
|
| 72 |
+
test: PytestTester
|
mgm/lib/python3.10/site-packages/numpy/random/_generator.cpython-310-x86_64-linux-gnu.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:605a4ece82853cac92e920eb9a8a6da2c4ef739e6f96e3cc1bf4aed71fe14e5f
|
| 3 |
+
size 976328
|
mgm/lib/python3.10/site-packages/numpy/random/_generator.pyi
ADDED
|
@@ -0,0 +1,681 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Callable
|
| 2 |
+
from typing import Any, Union, overload, TypeVar, Literal
|
| 3 |
+
|
| 4 |
+
from numpy import (
|
| 5 |
+
bool_,
|
| 6 |
+
dtype,
|
| 7 |
+
float32,
|
| 8 |
+
float64,
|
| 9 |
+
int8,
|
| 10 |
+
int16,
|
| 11 |
+
int32,
|
| 12 |
+
int64,
|
| 13 |
+
int_,
|
| 14 |
+
ndarray,
|
| 15 |
+
uint,
|
| 16 |
+
uint8,
|
| 17 |
+
uint16,
|
| 18 |
+
uint32,
|
| 19 |
+
uint64,
|
| 20 |
+
)
|
| 21 |
+
from numpy.random import BitGenerator, SeedSequence
|
| 22 |
+
from numpy._typing import (
|
| 23 |
+
ArrayLike,
|
| 24 |
+
_ArrayLikeFloat_co,
|
| 25 |
+
_ArrayLikeInt_co,
|
| 26 |
+
_DoubleCodes,
|
| 27 |
+
_DTypeLikeBool,
|
| 28 |
+
_DTypeLikeInt,
|
| 29 |
+
_DTypeLikeUInt,
|
| 30 |
+
_Float32Codes,
|
| 31 |
+
_Float64Codes,
|
| 32 |
+
_FloatLike_co,
|
| 33 |
+
_Int8Codes,
|
| 34 |
+
_Int16Codes,
|
| 35 |
+
_Int32Codes,
|
| 36 |
+
_Int64Codes,
|
| 37 |
+
_IntCodes,
|
| 38 |
+
_ShapeLike,
|
| 39 |
+
_SingleCodes,
|
| 40 |
+
_SupportsDType,
|
| 41 |
+
_UInt8Codes,
|
| 42 |
+
_UInt16Codes,
|
| 43 |
+
_UInt32Codes,
|
| 44 |
+
_UInt64Codes,
|
| 45 |
+
_UIntCodes,
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
_ArrayType = TypeVar("_ArrayType", bound=ndarray[Any, Any])
|
| 49 |
+
|
| 50 |
+
_DTypeLikeFloat32 = Union[
|
| 51 |
+
dtype[float32],
|
| 52 |
+
_SupportsDType[dtype[float32]],
|
| 53 |
+
type[float32],
|
| 54 |
+
_Float32Codes,
|
| 55 |
+
_SingleCodes,
|
| 56 |
+
]
|
| 57 |
+
|
| 58 |
+
_DTypeLikeFloat64 = Union[
|
| 59 |
+
dtype[float64],
|
| 60 |
+
_SupportsDType[dtype[float64]],
|
| 61 |
+
type[float],
|
| 62 |
+
type[float64],
|
| 63 |
+
_Float64Codes,
|
| 64 |
+
_DoubleCodes,
|
| 65 |
+
]
|
| 66 |
+
|
| 67 |
+
class Generator:
|
| 68 |
+
def __init__(self, bit_generator: BitGenerator) -> None: ...
|
| 69 |
+
def __repr__(self) -> str: ...
|
| 70 |
+
def __str__(self) -> str: ...
|
| 71 |
+
def __getstate__(self) -> dict[str, Any]: ...
|
| 72 |
+
def __setstate__(self, state: dict[str, Any]) -> None: ...
|
| 73 |
+
def __reduce__(self) -> tuple[Callable[[str], Generator], tuple[str], dict[str, Any]]: ...
|
| 74 |
+
@property
|
| 75 |
+
def bit_generator(self) -> BitGenerator: ...
|
| 76 |
+
def spawn(self, n_children: int) -> list[Generator]: ...
|
| 77 |
+
def bytes(self, length: int) -> bytes: ...
|
| 78 |
+
@overload
|
| 79 |
+
def standard_normal( # type: ignore[misc]
|
| 80 |
+
self,
|
| 81 |
+
size: None = ...,
|
| 82 |
+
dtype: _DTypeLikeFloat32 | _DTypeLikeFloat64 = ...,
|
| 83 |
+
out: None = ...,
|
| 84 |
+
) -> float: ...
|
| 85 |
+
@overload
|
| 86 |
+
def standard_normal( # type: ignore[misc]
|
| 87 |
+
self,
|
| 88 |
+
size: _ShapeLike = ...,
|
| 89 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 90 |
+
@overload
|
| 91 |
+
def standard_normal( # type: ignore[misc]
|
| 92 |
+
self,
|
| 93 |
+
*,
|
| 94 |
+
out: ndarray[Any, dtype[float64]] = ...,
|
| 95 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 96 |
+
@overload
|
| 97 |
+
def standard_normal( # type: ignore[misc]
|
| 98 |
+
self,
|
| 99 |
+
size: _ShapeLike = ...,
|
| 100 |
+
dtype: _DTypeLikeFloat32 = ...,
|
| 101 |
+
out: None | ndarray[Any, dtype[float32]] = ...,
|
| 102 |
+
) -> ndarray[Any, dtype[float32]]: ...
|
| 103 |
+
@overload
|
| 104 |
+
def standard_normal( # type: ignore[misc]
|
| 105 |
+
self,
|
| 106 |
+
size: _ShapeLike = ...,
|
| 107 |
+
dtype: _DTypeLikeFloat64 = ...,
|
| 108 |
+
out: None | ndarray[Any, dtype[float64]] = ...,
|
| 109 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 110 |
+
@overload
|
| 111 |
+
def permutation(self, x: int, axis: int = ...) -> ndarray[Any, dtype[int64]]: ...
|
| 112 |
+
@overload
|
| 113 |
+
def permutation(self, x: ArrayLike, axis: int = ...) -> ndarray[Any, Any]: ...
|
| 114 |
+
@overload
|
| 115 |
+
def standard_exponential( # type: ignore[misc]
|
| 116 |
+
self,
|
| 117 |
+
size: None = ...,
|
| 118 |
+
dtype: _DTypeLikeFloat32 | _DTypeLikeFloat64 = ...,
|
| 119 |
+
method: Literal["zig", "inv"] = ...,
|
| 120 |
+
out: None = ...,
|
| 121 |
+
) -> float: ...
|
| 122 |
+
@overload
|
| 123 |
+
def standard_exponential(
|
| 124 |
+
self,
|
| 125 |
+
size: _ShapeLike = ...,
|
| 126 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 127 |
+
@overload
|
| 128 |
+
def standard_exponential(
|
| 129 |
+
self,
|
| 130 |
+
*,
|
| 131 |
+
out: ndarray[Any, dtype[float64]] = ...,
|
| 132 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 133 |
+
@overload
|
| 134 |
+
def standard_exponential(
|
| 135 |
+
self,
|
| 136 |
+
size: _ShapeLike = ...,
|
| 137 |
+
*,
|
| 138 |
+
method: Literal["zig", "inv"] = ...,
|
| 139 |
+
out: None | ndarray[Any, dtype[float64]] = ...,
|
| 140 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 141 |
+
@overload
|
| 142 |
+
def standard_exponential(
|
| 143 |
+
self,
|
| 144 |
+
size: _ShapeLike = ...,
|
| 145 |
+
dtype: _DTypeLikeFloat32 = ...,
|
| 146 |
+
method: Literal["zig", "inv"] = ...,
|
| 147 |
+
out: None | ndarray[Any, dtype[float32]] = ...,
|
| 148 |
+
) -> ndarray[Any, dtype[float32]]: ...
|
| 149 |
+
@overload
|
| 150 |
+
def standard_exponential(
|
| 151 |
+
self,
|
| 152 |
+
size: _ShapeLike = ...,
|
| 153 |
+
dtype: _DTypeLikeFloat64 = ...,
|
| 154 |
+
method: Literal["zig", "inv"] = ...,
|
| 155 |
+
out: None | ndarray[Any, dtype[float64]] = ...,
|
| 156 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 157 |
+
@overload
|
| 158 |
+
def random( # type: ignore[misc]
|
| 159 |
+
self,
|
| 160 |
+
size: None = ...,
|
| 161 |
+
dtype: _DTypeLikeFloat32 | _DTypeLikeFloat64 = ...,
|
| 162 |
+
out: None = ...,
|
| 163 |
+
) -> float: ...
|
| 164 |
+
@overload
|
| 165 |
+
def random(
|
| 166 |
+
self,
|
| 167 |
+
*,
|
| 168 |
+
out: ndarray[Any, dtype[float64]] = ...,
|
| 169 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 170 |
+
@overload
|
| 171 |
+
def random(
|
| 172 |
+
self,
|
| 173 |
+
size: _ShapeLike = ...,
|
| 174 |
+
*,
|
| 175 |
+
out: None | ndarray[Any, dtype[float64]] = ...,
|
| 176 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 177 |
+
@overload
|
| 178 |
+
def random(
|
| 179 |
+
self,
|
| 180 |
+
size: _ShapeLike = ...,
|
| 181 |
+
dtype: _DTypeLikeFloat32 = ...,
|
| 182 |
+
out: None | ndarray[Any, dtype[float32]] = ...,
|
| 183 |
+
) -> ndarray[Any, dtype[float32]]: ...
|
| 184 |
+
@overload
|
| 185 |
+
def random(
|
| 186 |
+
self,
|
| 187 |
+
size: _ShapeLike = ...,
|
| 188 |
+
dtype: _DTypeLikeFloat64 = ...,
|
| 189 |
+
out: None | ndarray[Any, dtype[float64]] = ...,
|
| 190 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 191 |
+
@overload
|
| 192 |
+
def beta(
|
| 193 |
+
self,
|
| 194 |
+
a: _FloatLike_co,
|
| 195 |
+
b: _FloatLike_co,
|
| 196 |
+
size: None = ...,
|
| 197 |
+
) -> float: ... # type: ignore[misc]
|
| 198 |
+
@overload
|
| 199 |
+
def beta(
|
| 200 |
+
self, a: _ArrayLikeFloat_co, b: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 201 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 202 |
+
@overload
|
| 203 |
+
def exponential(self, scale: _FloatLike_co = ..., size: None = ...) -> float: ... # type: ignore[misc]
|
| 204 |
+
@overload
|
| 205 |
+
def exponential(
|
| 206 |
+
self, scale: _ArrayLikeFloat_co = ..., size: None | _ShapeLike = ...
|
| 207 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 208 |
+
@overload
|
| 209 |
+
def integers( # type: ignore[misc]
|
| 210 |
+
self,
|
| 211 |
+
low: int,
|
| 212 |
+
high: None | int = ...,
|
| 213 |
+
) -> int: ...
|
| 214 |
+
@overload
|
| 215 |
+
def integers( # type: ignore[misc]
|
| 216 |
+
self,
|
| 217 |
+
low: int,
|
| 218 |
+
high: None | int = ...,
|
| 219 |
+
size: None = ...,
|
| 220 |
+
dtype: _DTypeLikeBool = ...,
|
| 221 |
+
endpoint: bool = ...,
|
| 222 |
+
) -> bool: ...
|
| 223 |
+
@overload
|
| 224 |
+
def integers( # type: ignore[misc]
|
| 225 |
+
self,
|
| 226 |
+
low: int,
|
| 227 |
+
high: None | int = ...,
|
| 228 |
+
size: None = ...,
|
| 229 |
+
dtype: _DTypeLikeInt | _DTypeLikeUInt = ...,
|
| 230 |
+
endpoint: bool = ...,
|
| 231 |
+
) -> int: ...
|
| 232 |
+
@overload
|
| 233 |
+
def integers( # type: ignore[misc]
|
| 234 |
+
self,
|
| 235 |
+
low: _ArrayLikeInt_co,
|
| 236 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 237 |
+
size: None | _ShapeLike = ...,
|
| 238 |
+
) -> ndarray[Any, dtype[int64]]: ...
|
| 239 |
+
@overload
|
| 240 |
+
def integers( # type: ignore[misc]
|
| 241 |
+
self,
|
| 242 |
+
low: _ArrayLikeInt_co,
|
| 243 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 244 |
+
size: None | _ShapeLike = ...,
|
| 245 |
+
dtype: _DTypeLikeBool = ...,
|
| 246 |
+
endpoint: bool = ...,
|
| 247 |
+
) -> ndarray[Any, dtype[bool_]]: ...
|
| 248 |
+
@overload
|
| 249 |
+
def integers( # type: ignore[misc]
|
| 250 |
+
self,
|
| 251 |
+
low: _ArrayLikeInt_co,
|
| 252 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 253 |
+
size: None | _ShapeLike = ...,
|
| 254 |
+
dtype: dtype[int8] | type[int8] | _Int8Codes | _SupportsDType[dtype[int8]] = ...,
|
| 255 |
+
endpoint: bool = ...,
|
| 256 |
+
) -> ndarray[Any, dtype[int8]]: ...
|
| 257 |
+
@overload
|
| 258 |
+
def integers( # type: ignore[misc]
|
| 259 |
+
self,
|
| 260 |
+
low: _ArrayLikeInt_co,
|
| 261 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 262 |
+
size: None | _ShapeLike = ...,
|
| 263 |
+
dtype: dtype[int16] | type[int16] | _Int16Codes | _SupportsDType[dtype[int16]] = ...,
|
| 264 |
+
endpoint: bool = ...,
|
| 265 |
+
) -> ndarray[Any, dtype[int16]]: ...
|
| 266 |
+
@overload
|
| 267 |
+
def integers( # type: ignore[misc]
|
| 268 |
+
self,
|
| 269 |
+
low: _ArrayLikeInt_co,
|
| 270 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 271 |
+
size: None | _ShapeLike = ...,
|
| 272 |
+
dtype: dtype[int32] | type[int32] | _Int32Codes | _SupportsDType[dtype[int32]] = ...,
|
| 273 |
+
endpoint: bool = ...,
|
| 274 |
+
) -> ndarray[Any, dtype[int32]]: ...
|
| 275 |
+
@overload
|
| 276 |
+
def integers( # type: ignore[misc]
|
| 277 |
+
self,
|
| 278 |
+
low: _ArrayLikeInt_co,
|
| 279 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 280 |
+
size: None | _ShapeLike = ...,
|
| 281 |
+
dtype: None | dtype[int64] | type[int64] | _Int64Codes | _SupportsDType[dtype[int64]] = ...,
|
| 282 |
+
endpoint: bool = ...,
|
| 283 |
+
) -> ndarray[Any, dtype[int64]]: ...
|
| 284 |
+
@overload
|
| 285 |
+
def integers( # type: ignore[misc]
|
| 286 |
+
self,
|
| 287 |
+
low: _ArrayLikeInt_co,
|
| 288 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 289 |
+
size: None | _ShapeLike = ...,
|
| 290 |
+
dtype: dtype[uint8] | type[uint8] | _UInt8Codes | _SupportsDType[dtype[uint8]] = ...,
|
| 291 |
+
endpoint: bool = ...,
|
| 292 |
+
) -> ndarray[Any, dtype[uint8]]: ...
|
| 293 |
+
@overload
|
| 294 |
+
def integers( # type: ignore[misc]
|
| 295 |
+
self,
|
| 296 |
+
low: _ArrayLikeInt_co,
|
| 297 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 298 |
+
size: None | _ShapeLike = ...,
|
| 299 |
+
dtype: dtype[uint16] | type[uint16] | _UInt16Codes | _SupportsDType[dtype[uint16]] = ...,
|
| 300 |
+
endpoint: bool = ...,
|
| 301 |
+
) -> ndarray[Any, dtype[uint16]]: ...
|
| 302 |
+
@overload
|
| 303 |
+
def integers( # type: ignore[misc]
|
| 304 |
+
self,
|
| 305 |
+
low: _ArrayLikeInt_co,
|
| 306 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 307 |
+
size: None | _ShapeLike = ...,
|
| 308 |
+
dtype: dtype[uint32] | type[uint32] | _UInt32Codes | _SupportsDType[dtype[uint32]] = ...,
|
| 309 |
+
endpoint: bool = ...,
|
| 310 |
+
) -> ndarray[Any, dtype[uint32]]: ...
|
| 311 |
+
@overload
|
| 312 |
+
def integers( # type: ignore[misc]
|
| 313 |
+
self,
|
| 314 |
+
low: _ArrayLikeInt_co,
|
| 315 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 316 |
+
size: None | _ShapeLike = ...,
|
| 317 |
+
dtype: dtype[uint64] | type[uint64] | _UInt64Codes | _SupportsDType[dtype[uint64]] = ...,
|
| 318 |
+
endpoint: bool = ...,
|
| 319 |
+
) -> ndarray[Any, dtype[uint64]]: ...
|
| 320 |
+
@overload
|
| 321 |
+
def integers( # type: ignore[misc]
|
| 322 |
+
self,
|
| 323 |
+
low: _ArrayLikeInt_co,
|
| 324 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 325 |
+
size: None | _ShapeLike = ...,
|
| 326 |
+
dtype: dtype[int_] | type[int] | type[int_] | _IntCodes | _SupportsDType[dtype[int_]] = ...,
|
| 327 |
+
endpoint: bool = ...,
|
| 328 |
+
) -> ndarray[Any, dtype[int_]]: ...
|
| 329 |
+
@overload
|
| 330 |
+
def integers( # type: ignore[misc]
|
| 331 |
+
self,
|
| 332 |
+
low: _ArrayLikeInt_co,
|
| 333 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 334 |
+
size: None | _ShapeLike = ...,
|
| 335 |
+
dtype: dtype[uint] | type[uint] | _UIntCodes | _SupportsDType[dtype[uint]] = ...,
|
| 336 |
+
endpoint: bool = ...,
|
| 337 |
+
) -> ndarray[Any, dtype[uint]]: ...
|
| 338 |
+
# TODO: Use a TypeVar _T here to get away from Any output? Should be int->ndarray[Any,dtype[int64]], ArrayLike[_T] -> _T | ndarray[Any,Any]
|
| 339 |
+
@overload
|
| 340 |
+
def choice(
|
| 341 |
+
self,
|
| 342 |
+
a: int,
|
| 343 |
+
size: None = ...,
|
| 344 |
+
replace: bool = ...,
|
| 345 |
+
p: None | _ArrayLikeFloat_co = ...,
|
| 346 |
+
axis: int = ...,
|
| 347 |
+
shuffle: bool = ...,
|
| 348 |
+
) -> int: ...
|
| 349 |
+
@overload
|
| 350 |
+
def choice(
|
| 351 |
+
self,
|
| 352 |
+
a: int,
|
| 353 |
+
size: _ShapeLike = ...,
|
| 354 |
+
replace: bool = ...,
|
| 355 |
+
p: None | _ArrayLikeFloat_co = ...,
|
| 356 |
+
axis: int = ...,
|
| 357 |
+
shuffle: bool = ...,
|
| 358 |
+
) -> ndarray[Any, dtype[int64]]: ...
|
| 359 |
+
@overload
|
| 360 |
+
def choice(
|
| 361 |
+
self,
|
| 362 |
+
a: ArrayLike,
|
| 363 |
+
size: None = ...,
|
| 364 |
+
replace: bool = ...,
|
| 365 |
+
p: None | _ArrayLikeFloat_co = ...,
|
| 366 |
+
axis: int = ...,
|
| 367 |
+
shuffle: bool = ...,
|
| 368 |
+
) -> Any: ...
|
| 369 |
+
@overload
|
| 370 |
+
def choice(
|
| 371 |
+
self,
|
| 372 |
+
a: ArrayLike,
|
| 373 |
+
size: _ShapeLike = ...,
|
| 374 |
+
replace: bool = ...,
|
| 375 |
+
p: None | _ArrayLikeFloat_co = ...,
|
| 376 |
+
axis: int = ...,
|
| 377 |
+
shuffle: bool = ...,
|
| 378 |
+
) -> ndarray[Any, Any]: ...
|
| 379 |
+
@overload
|
| 380 |
+
def uniform(
|
| 381 |
+
self,
|
| 382 |
+
low: _FloatLike_co = ...,
|
| 383 |
+
high: _FloatLike_co = ...,
|
| 384 |
+
size: None = ...,
|
| 385 |
+
) -> float: ... # type: ignore[misc]
|
| 386 |
+
@overload
|
| 387 |
+
def uniform(
|
| 388 |
+
self,
|
| 389 |
+
low: _ArrayLikeFloat_co = ...,
|
| 390 |
+
high: _ArrayLikeFloat_co = ...,
|
| 391 |
+
size: None | _ShapeLike = ...,
|
| 392 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 393 |
+
@overload
|
| 394 |
+
def normal(
|
| 395 |
+
self,
|
| 396 |
+
loc: _FloatLike_co = ...,
|
| 397 |
+
scale: _FloatLike_co = ...,
|
| 398 |
+
size: None = ...,
|
| 399 |
+
) -> float: ... # type: ignore[misc]
|
| 400 |
+
@overload
|
| 401 |
+
def normal(
|
| 402 |
+
self,
|
| 403 |
+
loc: _ArrayLikeFloat_co = ...,
|
| 404 |
+
scale: _ArrayLikeFloat_co = ...,
|
| 405 |
+
size: None | _ShapeLike = ...,
|
| 406 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 407 |
+
@overload
|
| 408 |
+
def standard_gamma( # type: ignore[misc]
|
| 409 |
+
self,
|
| 410 |
+
shape: _FloatLike_co,
|
| 411 |
+
size: None = ...,
|
| 412 |
+
dtype: _DTypeLikeFloat32 | _DTypeLikeFloat64 = ...,
|
| 413 |
+
out: None = ...,
|
| 414 |
+
) -> float: ...
|
| 415 |
+
@overload
|
| 416 |
+
def standard_gamma(
|
| 417 |
+
self,
|
| 418 |
+
shape: _ArrayLikeFloat_co,
|
| 419 |
+
size: None | _ShapeLike = ...,
|
| 420 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 421 |
+
@overload
|
| 422 |
+
def standard_gamma(
|
| 423 |
+
self,
|
| 424 |
+
shape: _ArrayLikeFloat_co,
|
| 425 |
+
*,
|
| 426 |
+
out: ndarray[Any, dtype[float64]] = ...,
|
| 427 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 428 |
+
@overload
|
| 429 |
+
def standard_gamma(
|
| 430 |
+
self,
|
| 431 |
+
shape: _ArrayLikeFloat_co,
|
| 432 |
+
size: None | _ShapeLike = ...,
|
| 433 |
+
dtype: _DTypeLikeFloat32 = ...,
|
| 434 |
+
out: None | ndarray[Any, dtype[float32]] = ...,
|
| 435 |
+
) -> ndarray[Any, dtype[float32]]: ...
|
| 436 |
+
@overload
|
| 437 |
+
def standard_gamma(
|
| 438 |
+
self,
|
| 439 |
+
shape: _ArrayLikeFloat_co,
|
| 440 |
+
size: None | _ShapeLike = ...,
|
| 441 |
+
dtype: _DTypeLikeFloat64 = ...,
|
| 442 |
+
out: None | ndarray[Any, dtype[float64]] = ...,
|
| 443 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 444 |
+
@overload
|
| 445 |
+
def gamma(self, shape: _FloatLike_co, scale: _FloatLike_co = ..., size: None = ...) -> float: ... # type: ignore[misc]
|
| 446 |
+
@overload
|
| 447 |
+
def gamma(
|
| 448 |
+
self,
|
| 449 |
+
shape: _ArrayLikeFloat_co,
|
| 450 |
+
scale: _ArrayLikeFloat_co = ...,
|
| 451 |
+
size: None | _ShapeLike = ...,
|
| 452 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 453 |
+
@overload
|
| 454 |
+
def f(self, dfnum: _FloatLike_co, dfden: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
|
| 455 |
+
@overload
|
| 456 |
+
def f(
|
| 457 |
+
self, dfnum: _ArrayLikeFloat_co, dfden: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 458 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 459 |
+
@overload
|
| 460 |
+
def noncentral_f(self, dfnum: _FloatLike_co, dfden: _FloatLike_co, nonc: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
|
| 461 |
+
@overload
|
| 462 |
+
def noncentral_f(
|
| 463 |
+
self,
|
| 464 |
+
dfnum: _ArrayLikeFloat_co,
|
| 465 |
+
dfden: _ArrayLikeFloat_co,
|
| 466 |
+
nonc: _ArrayLikeFloat_co,
|
| 467 |
+
size: None | _ShapeLike = ...,
|
| 468 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 469 |
+
@overload
|
| 470 |
+
def chisquare(self, df: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
|
| 471 |
+
@overload
|
| 472 |
+
def chisquare(
|
| 473 |
+
self, df: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 474 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 475 |
+
@overload
|
| 476 |
+
def noncentral_chisquare(self, df: _FloatLike_co, nonc: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
|
| 477 |
+
@overload
|
| 478 |
+
def noncentral_chisquare(
|
| 479 |
+
self, df: _ArrayLikeFloat_co, nonc: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 480 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 481 |
+
@overload
|
| 482 |
+
def standard_t(self, df: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
|
| 483 |
+
@overload
|
| 484 |
+
def standard_t(
|
| 485 |
+
self, df: _ArrayLikeFloat_co, size: None = ...
|
| 486 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 487 |
+
@overload
|
| 488 |
+
def standard_t(
|
| 489 |
+
self, df: _ArrayLikeFloat_co, size: _ShapeLike = ...
|
| 490 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 491 |
+
@overload
|
| 492 |
+
def vonmises(self, mu: _FloatLike_co, kappa: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
|
| 493 |
+
@overload
|
| 494 |
+
def vonmises(
|
| 495 |
+
self, mu: _ArrayLikeFloat_co, kappa: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 496 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 497 |
+
@overload
|
| 498 |
+
def pareto(self, a: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
|
| 499 |
+
@overload
|
| 500 |
+
def pareto(
|
| 501 |
+
self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 502 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 503 |
+
@overload
|
| 504 |
+
def weibull(self, a: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
|
| 505 |
+
@overload
|
| 506 |
+
def weibull(
|
| 507 |
+
self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 508 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 509 |
+
@overload
|
| 510 |
+
def power(self, a: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
|
| 511 |
+
@overload
|
| 512 |
+
def power(
|
| 513 |
+
self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 514 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 515 |
+
@overload
|
| 516 |
+
def standard_cauchy(self, size: None = ...) -> float: ... # type: ignore[misc]
|
| 517 |
+
@overload
|
| 518 |
+
def standard_cauchy(self, size: _ShapeLike = ...) -> ndarray[Any, dtype[float64]]: ...
|
| 519 |
+
@overload
|
| 520 |
+
def laplace(
|
| 521 |
+
self,
|
| 522 |
+
loc: _FloatLike_co = ...,
|
| 523 |
+
scale: _FloatLike_co = ...,
|
| 524 |
+
size: None = ...,
|
| 525 |
+
) -> float: ... # type: ignore[misc]
|
| 526 |
+
@overload
|
| 527 |
+
def laplace(
|
| 528 |
+
self,
|
| 529 |
+
loc: _ArrayLikeFloat_co = ...,
|
| 530 |
+
scale: _ArrayLikeFloat_co = ...,
|
| 531 |
+
size: None | _ShapeLike = ...,
|
| 532 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 533 |
+
@overload
|
| 534 |
+
def gumbel(
|
| 535 |
+
self,
|
| 536 |
+
loc: _FloatLike_co = ...,
|
| 537 |
+
scale: _FloatLike_co = ...,
|
| 538 |
+
size: None = ...,
|
| 539 |
+
) -> float: ... # type: ignore[misc]
|
| 540 |
+
@overload
|
| 541 |
+
def gumbel(
|
| 542 |
+
self,
|
| 543 |
+
loc: _ArrayLikeFloat_co = ...,
|
| 544 |
+
scale: _ArrayLikeFloat_co = ...,
|
| 545 |
+
size: None | _ShapeLike = ...,
|
| 546 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 547 |
+
@overload
|
| 548 |
+
def logistic(
|
| 549 |
+
self,
|
| 550 |
+
loc: _FloatLike_co = ...,
|
| 551 |
+
scale: _FloatLike_co = ...,
|
| 552 |
+
size: None = ...,
|
| 553 |
+
) -> float: ... # type: ignore[misc]
|
| 554 |
+
@overload
|
| 555 |
+
def logistic(
|
| 556 |
+
self,
|
| 557 |
+
loc: _ArrayLikeFloat_co = ...,
|
| 558 |
+
scale: _ArrayLikeFloat_co = ...,
|
| 559 |
+
size: None | _ShapeLike = ...,
|
| 560 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 561 |
+
@overload
|
| 562 |
+
def lognormal(
|
| 563 |
+
self,
|
| 564 |
+
mean: _FloatLike_co = ...,
|
| 565 |
+
sigma: _FloatLike_co = ...,
|
| 566 |
+
size: None = ...,
|
| 567 |
+
) -> float: ... # type: ignore[misc]
|
| 568 |
+
@overload
|
| 569 |
+
def lognormal(
|
| 570 |
+
self,
|
| 571 |
+
mean: _ArrayLikeFloat_co = ...,
|
| 572 |
+
sigma: _ArrayLikeFloat_co = ...,
|
| 573 |
+
size: None | _ShapeLike = ...,
|
| 574 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 575 |
+
@overload
|
| 576 |
+
def rayleigh(self, scale: _FloatLike_co = ..., size: None = ...) -> float: ... # type: ignore[misc]
|
| 577 |
+
@overload
|
| 578 |
+
def rayleigh(
|
| 579 |
+
self, scale: _ArrayLikeFloat_co = ..., size: None | _ShapeLike = ...
|
| 580 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 581 |
+
@overload
|
| 582 |
+
def wald(self, mean: _FloatLike_co, scale: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
|
| 583 |
+
@overload
|
| 584 |
+
def wald(
|
| 585 |
+
self, mean: _ArrayLikeFloat_co, scale: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 586 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 587 |
+
@overload
|
| 588 |
+
def triangular(
|
| 589 |
+
self,
|
| 590 |
+
left: _FloatLike_co,
|
| 591 |
+
mode: _FloatLike_co,
|
| 592 |
+
right: _FloatLike_co,
|
| 593 |
+
size: None = ...,
|
| 594 |
+
) -> float: ... # type: ignore[misc]
|
| 595 |
+
@overload
|
| 596 |
+
def triangular(
|
| 597 |
+
self,
|
| 598 |
+
left: _ArrayLikeFloat_co,
|
| 599 |
+
mode: _ArrayLikeFloat_co,
|
| 600 |
+
right: _ArrayLikeFloat_co,
|
| 601 |
+
size: None | _ShapeLike = ...,
|
| 602 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 603 |
+
@overload
|
| 604 |
+
def binomial(self, n: int, p: _FloatLike_co, size: None = ...) -> int: ... # type: ignore[misc]
|
| 605 |
+
@overload
|
| 606 |
+
def binomial(
|
| 607 |
+
self, n: _ArrayLikeInt_co, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 608 |
+
) -> ndarray[Any, dtype[int64]]: ...
|
| 609 |
+
@overload
|
| 610 |
+
def negative_binomial(self, n: _FloatLike_co, p: _FloatLike_co, size: None = ...) -> int: ... # type: ignore[misc]
|
| 611 |
+
@overload
|
| 612 |
+
def negative_binomial(
|
| 613 |
+
self, n: _ArrayLikeFloat_co, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 614 |
+
) -> ndarray[Any, dtype[int64]]: ...
|
| 615 |
+
@overload
|
| 616 |
+
def poisson(self, lam: _FloatLike_co = ..., size: None = ...) -> int: ... # type: ignore[misc]
|
| 617 |
+
@overload
|
| 618 |
+
def poisson(
|
| 619 |
+
self, lam: _ArrayLikeFloat_co = ..., size: None | _ShapeLike = ...
|
| 620 |
+
) -> ndarray[Any, dtype[int64]]: ...
|
| 621 |
+
@overload
|
| 622 |
+
def zipf(self, a: _FloatLike_co, size: None = ...) -> int: ... # type: ignore[misc]
|
| 623 |
+
@overload
|
| 624 |
+
def zipf(
|
| 625 |
+
self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 626 |
+
) -> ndarray[Any, dtype[int64]]: ...
|
| 627 |
+
@overload
|
| 628 |
+
def geometric(self, p: _FloatLike_co, size: None = ...) -> int: ... # type: ignore[misc]
|
| 629 |
+
@overload
|
| 630 |
+
def geometric(
|
| 631 |
+
self, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 632 |
+
) -> ndarray[Any, dtype[int64]]: ...
|
| 633 |
+
@overload
|
| 634 |
+
def hypergeometric(self, ngood: int, nbad: int, nsample: int, size: None = ...) -> int: ... # type: ignore[misc]
|
| 635 |
+
@overload
|
| 636 |
+
def hypergeometric(
|
| 637 |
+
self,
|
| 638 |
+
ngood: _ArrayLikeInt_co,
|
| 639 |
+
nbad: _ArrayLikeInt_co,
|
| 640 |
+
nsample: _ArrayLikeInt_co,
|
| 641 |
+
size: None | _ShapeLike = ...,
|
| 642 |
+
) -> ndarray[Any, dtype[int64]]: ...
|
| 643 |
+
@overload
|
| 644 |
+
def logseries(self, p: _FloatLike_co, size: None = ...) -> int: ... # type: ignore[misc]
|
| 645 |
+
@overload
|
| 646 |
+
def logseries(
|
| 647 |
+
self, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 648 |
+
) -> ndarray[Any, dtype[int64]]: ...
|
| 649 |
+
def multivariate_normal(
|
| 650 |
+
self,
|
| 651 |
+
mean: _ArrayLikeFloat_co,
|
| 652 |
+
cov: _ArrayLikeFloat_co,
|
| 653 |
+
size: None | _ShapeLike = ...,
|
| 654 |
+
check_valid: Literal["warn", "raise", "ignore"] = ...,
|
| 655 |
+
tol: float = ...,
|
| 656 |
+
*,
|
| 657 |
+
method: Literal["svd", "eigh", "cholesky"] = ...,
|
| 658 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 659 |
+
def multinomial(
|
| 660 |
+
self, n: _ArrayLikeInt_co,
|
| 661 |
+
pvals: _ArrayLikeFloat_co,
|
| 662 |
+
size: None | _ShapeLike = ...
|
| 663 |
+
) -> ndarray[Any, dtype[int64]]: ...
|
| 664 |
+
def multivariate_hypergeometric(
|
| 665 |
+
self,
|
| 666 |
+
colors: _ArrayLikeInt_co,
|
| 667 |
+
nsample: int,
|
| 668 |
+
size: None | _ShapeLike = ...,
|
| 669 |
+
method: Literal["marginals", "count"] = ...,
|
| 670 |
+
) -> ndarray[Any, dtype[int64]]: ...
|
| 671 |
+
def dirichlet(
|
| 672 |
+
self, alpha: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 673 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 674 |
+
def permuted(
|
| 675 |
+
self, x: ArrayLike, *, axis: None | int = ..., out: None | ndarray[Any, Any] = ...
|
| 676 |
+
) -> ndarray[Any, Any]: ...
|
| 677 |
+
def shuffle(self, x: ArrayLike, axis: int = ...) -> None: ...
|
| 678 |
+
|
| 679 |
+
def default_rng(
|
| 680 |
+
seed: None | _ArrayLikeInt_co | SeedSequence | BitGenerator | Generator = ...
|
| 681 |
+
) -> Generator: ...
|
mgm/lib/python3.10/site-packages/numpy/random/_mt19937.pyi
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, TypedDict
|
| 2 |
+
|
| 3 |
+
from numpy import dtype, ndarray, uint32
|
| 4 |
+
from numpy.random.bit_generator import BitGenerator, SeedSequence
|
| 5 |
+
from numpy._typing import _ArrayLikeInt_co
|
| 6 |
+
|
| 7 |
+
class _MT19937Internal(TypedDict):
|
| 8 |
+
key: ndarray[Any, dtype[uint32]]
|
| 9 |
+
pos: int
|
| 10 |
+
|
| 11 |
+
class _MT19937State(TypedDict):
|
| 12 |
+
bit_generator: str
|
| 13 |
+
state: _MT19937Internal
|
| 14 |
+
|
| 15 |
+
class MT19937(BitGenerator):
|
| 16 |
+
def __init__(self, seed: None | _ArrayLikeInt_co | SeedSequence = ...) -> None: ...
|
| 17 |
+
def _legacy_seeding(self, seed: _ArrayLikeInt_co) -> None: ...
|
| 18 |
+
def jumped(self, jumps: int = ...) -> MT19937: ...
|
| 19 |
+
@property
|
| 20 |
+
def state(self) -> _MT19937State: ...
|
| 21 |
+
@state.setter
|
| 22 |
+
def state(self, value: _MT19937State) -> None: ...
|
mgm/lib/python3.10/site-packages/numpy/random/_philox.cpython-310-x86_64-linux-gnu.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:278070939f2017a7ed1ae91833add65251e6f70e72b9d37964eb30bc383f6b05
|
| 3 |
+
size 107384
|
mgm/lib/python3.10/site-packages/numpy/random/_philox.pyi
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, TypedDict
|
| 2 |
+
|
| 3 |
+
from numpy import dtype, ndarray, uint64
|
| 4 |
+
from numpy.random.bit_generator import BitGenerator, SeedSequence
|
| 5 |
+
from numpy._typing import _ArrayLikeInt_co
|
| 6 |
+
|
| 7 |
+
class _PhiloxInternal(TypedDict):
|
| 8 |
+
counter: ndarray[Any, dtype[uint64]]
|
| 9 |
+
key: ndarray[Any, dtype[uint64]]
|
| 10 |
+
|
| 11 |
+
class _PhiloxState(TypedDict):
|
| 12 |
+
bit_generator: str
|
| 13 |
+
state: _PhiloxInternal
|
| 14 |
+
buffer: ndarray[Any, dtype[uint64]]
|
| 15 |
+
buffer_pos: int
|
| 16 |
+
has_uint32: int
|
| 17 |
+
uinteger: int
|
| 18 |
+
|
| 19 |
+
class Philox(BitGenerator):
|
| 20 |
+
def __init__(
|
| 21 |
+
self,
|
| 22 |
+
seed: None | _ArrayLikeInt_co | SeedSequence = ...,
|
| 23 |
+
counter: None | _ArrayLikeInt_co = ...,
|
| 24 |
+
key: None | _ArrayLikeInt_co = ...,
|
| 25 |
+
) -> None: ...
|
| 26 |
+
@property
|
| 27 |
+
def state(
|
| 28 |
+
self,
|
| 29 |
+
) -> _PhiloxState: ...
|
| 30 |
+
@state.setter
|
| 31 |
+
def state(
|
| 32 |
+
self,
|
| 33 |
+
value: _PhiloxState,
|
| 34 |
+
) -> None: ...
|
| 35 |
+
def jumped(self, jumps: int = ...) -> Philox: ...
|
| 36 |
+
def advance(self, delta: int) -> Philox: ...
|
mgm/lib/python3.10/site-packages/numpy/random/_pickle.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .mtrand import RandomState
|
| 2 |
+
from ._philox import Philox
|
| 3 |
+
from ._pcg64 import PCG64, PCG64DXSM
|
| 4 |
+
from ._sfc64 import SFC64
|
| 5 |
+
|
| 6 |
+
from ._generator import Generator
|
| 7 |
+
from ._mt19937 import MT19937
|
| 8 |
+
|
| 9 |
+
BitGenerators = {'MT19937': MT19937,
|
| 10 |
+
'PCG64': PCG64,
|
| 11 |
+
'PCG64DXSM': PCG64DXSM,
|
| 12 |
+
'Philox': Philox,
|
| 13 |
+
'SFC64': SFC64,
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def __bit_generator_ctor(bit_generator_name='MT19937'):
|
| 18 |
+
"""
|
| 19 |
+
Pickling helper function that returns a bit generator object
|
| 20 |
+
|
| 21 |
+
Parameters
|
| 22 |
+
----------
|
| 23 |
+
bit_generator_name : str
|
| 24 |
+
String containing the name of the BitGenerator
|
| 25 |
+
|
| 26 |
+
Returns
|
| 27 |
+
-------
|
| 28 |
+
bit_generator : BitGenerator
|
| 29 |
+
BitGenerator instance
|
| 30 |
+
"""
|
| 31 |
+
if bit_generator_name in BitGenerators:
|
| 32 |
+
bit_generator = BitGenerators[bit_generator_name]
|
| 33 |
+
else:
|
| 34 |
+
raise ValueError(str(bit_generator_name) + ' is not a known '
|
| 35 |
+
'BitGenerator module.')
|
| 36 |
+
|
| 37 |
+
return bit_generator()
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def __generator_ctor(bit_generator_name="MT19937",
|
| 41 |
+
bit_generator_ctor=__bit_generator_ctor):
|
| 42 |
+
"""
|
| 43 |
+
Pickling helper function that returns a Generator object
|
| 44 |
+
|
| 45 |
+
Parameters
|
| 46 |
+
----------
|
| 47 |
+
bit_generator_name : str
|
| 48 |
+
String containing the core BitGenerator's name
|
| 49 |
+
bit_generator_ctor : callable, optional
|
| 50 |
+
Callable function that takes bit_generator_name as its only argument
|
| 51 |
+
and returns an instantized bit generator.
|
| 52 |
+
|
| 53 |
+
Returns
|
| 54 |
+
-------
|
| 55 |
+
rg : Generator
|
| 56 |
+
Generator using the named core BitGenerator
|
| 57 |
+
"""
|
| 58 |
+
return Generator(bit_generator_ctor(bit_generator_name))
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def __randomstate_ctor(bit_generator_name="MT19937",
|
| 62 |
+
bit_generator_ctor=__bit_generator_ctor):
|
| 63 |
+
"""
|
| 64 |
+
Pickling helper function that returns a legacy RandomState-like object
|
| 65 |
+
|
| 66 |
+
Parameters
|
| 67 |
+
----------
|
| 68 |
+
bit_generator_name : str
|
| 69 |
+
String containing the core BitGenerator's name
|
| 70 |
+
bit_generator_ctor : callable, optional
|
| 71 |
+
Callable function that takes bit_generator_name as its only argument
|
| 72 |
+
and returns an instantized bit generator.
|
| 73 |
+
|
| 74 |
+
Returns
|
| 75 |
+
-------
|
| 76 |
+
rs : RandomState
|
| 77 |
+
Legacy RandomState using the named core BitGenerator
|
| 78 |
+
"""
|
| 79 |
+
|
| 80 |
+
return RandomState(bit_generator_ctor(bit_generator_name))
|
mgm/lib/python3.10/site-packages/numpy/random/mtrand.pyi
ADDED
|
@@ -0,0 +1,571 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import builtins
|
| 2 |
+
from collections.abc import Callable
|
| 3 |
+
from typing import Any, Union, overload, Literal
|
| 4 |
+
|
| 5 |
+
from numpy import (
|
| 6 |
+
bool_,
|
| 7 |
+
dtype,
|
| 8 |
+
float32,
|
| 9 |
+
float64,
|
| 10 |
+
int8,
|
| 11 |
+
int16,
|
| 12 |
+
int32,
|
| 13 |
+
int64,
|
| 14 |
+
int_,
|
| 15 |
+
ndarray,
|
| 16 |
+
uint,
|
| 17 |
+
uint8,
|
| 18 |
+
uint16,
|
| 19 |
+
uint32,
|
| 20 |
+
uint64,
|
| 21 |
+
)
|
| 22 |
+
from numpy.random.bit_generator import BitGenerator
|
| 23 |
+
from numpy._typing import (
|
| 24 |
+
ArrayLike,
|
| 25 |
+
_ArrayLikeFloat_co,
|
| 26 |
+
_ArrayLikeInt_co,
|
| 27 |
+
_DoubleCodes,
|
| 28 |
+
_DTypeLikeBool,
|
| 29 |
+
_DTypeLikeInt,
|
| 30 |
+
_DTypeLikeUInt,
|
| 31 |
+
_Float32Codes,
|
| 32 |
+
_Float64Codes,
|
| 33 |
+
_Int8Codes,
|
| 34 |
+
_Int16Codes,
|
| 35 |
+
_Int32Codes,
|
| 36 |
+
_Int64Codes,
|
| 37 |
+
_IntCodes,
|
| 38 |
+
_ShapeLike,
|
| 39 |
+
_SingleCodes,
|
| 40 |
+
_SupportsDType,
|
| 41 |
+
_UInt8Codes,
|
| 42 |
+
_UInt16Codes,
|
| 43 |
+
_UInt32Codes,
|
| 44 |
+
_UInt64Codes,
|
| 45 |
+
_UIntCodes,
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
_DTypeLikeFloat32 = Union[
|
| 49 |
+
dtype[float32],
|
| 50 |
+
_SupportsDType[dtype[float32]],
|
| 51 |
+
type[float32],
|
| 52 |
+
_Float32Codes,
|
| 53 |
+
_SingleCodes,
|
| 54 |
+
]
|
| 55 |
+
|
| 56 |
+
_DTypeLikeFloat64 = Union[
|
| 57 |
+
dtype[float64],
|
| 58 |
+
_SupportsDType[dtype[float64]],
|
| 59 |
+
type[float],
|
| 60 |
+
type[float64],
|
| 61 |
+
_Float64Codes,
|
| 62 |
+
_DoubleCodes,
|
| 63 |
+
]
|
| 64 |
+
|
| 65 |
+
class RandomState:
|
| 66 |
+
_bit_generator: BitGenerator
|
| 67 |
+
def __init__(self, seed: None | _ArrayLikeInt_co | BitGenerator = ...) -> None: ...
|
| 68 |
+
def __repr__(self) -> str: ...
|
| 69 |
+
def __str__(self) -> str: ...
|
| 70 |
+
def __getstate__(self) -> dict[str, Any]: ...
|
| 71 |
+
def __setstate__(self, state: dict[str, Any]) -> None: ...
|
| 72 |
+
def __reduce__(self) -> tuple[Callable[[str], RandomState], tuple[str], dict[str, Any]]: ...
|
| 73 |
+
def seed(self, seed: None | _ArrayLikeFloat_co = ...) -> None: ...
|
| 74 |
+
@overload
|
| 75 |
+
def get_state(self, legacy: Literal[False] = ...) -> dict[str, Any]: ...
|
| 76 |
+
@overload
|
| 77 |
+
def get_state(
|
| 78 |
+
self, legacy: Literal[True] = ...
|
| 79 |
+
) -> dict[str, Any] | tuple[str, ndarray[Any, dtype[uint32]], int, int, float]: ...
|
| 80 |
+
def set_state(
|
| 81 |
+
self, state: dict[str, Any] | tuple[str, ndarray[Any, dtype[uint32]], int, int, float]
|
| 82 |
+
) -> None: ...
|
| 83 |
+
@overload
|
| 84 |
+
def random_sample(self, size: None = ...) -> float: ... # type: ignore[misc]
|
| 85 |
+
@overload
|
| 86 |
+
def random_sample(self, size: _ShapeLike = ...) -> ndarray[Any, dtype[float64]]: ...
|
| 87 |
+
@overload
|
| 88 |
+
def random(self, size: None = ...) -> float: ... # type: ignore[misc]
|
| 89 |
+
@overload
|
| 90 |
+
def random(self, size: _ShapeLike = ...) -> ndarray[Any, dtype[float64]]: ...
|
| 91 |
+
@overload
|
| 92 |
+
def beta(self, a: float, b: float, size: None = ...) -> float: ... # type: ignore[misc]
|
| 93 |
+
@overload
|
| 94 |
+
def beta(
|
| 95 |
+
self, a: _ArrayLikeFloat_co, b: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 96 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 97 |
+
@overload
|
| 98 |
+
def exponential(self, scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc]
|
| 99 |
+
@overload
|
| 100 |
+
def exponential(
|
| 101 |
+
self, scale: _ArrayLikeFloat_co = ..., size: None | _ShapeLike = ...
|
| 102 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 103 |
+
@overload
|
| 104 |
+
def standard_exponential(self, size: None = ...) -> float: ... # type: ignore[misc]
|
| 105 |
+
@overload
|
| 106 |
+
def standard_exponential(self, size: _ShapeLike = ...) -> ndarray[Any, dtype[float64]]: ...
|
| 107 |
+
@overload
|
| 108 |
+
def tomaxint(self, size: None = ...) -> int: ... # type: ignore[misc]
|
| 109 |
+
@overload
|
| 110 |
+
def tomaxint(self, size: _ShapeLike = ...) -> ndarray[Any, dtype[int_]]: ...
|
| 111 |
+
@overload
|
| 112 |
+
def randint( # type: ignore[misc]
|
| 113 |
+
self,
|
| 114 |
+
low: int,
|
| 115 |
+
high: None | int = ...,
|
| 116 |
+
) -> int: ...
|
| 117 |
+
@overload
|
| 118 |
+
def randint( # type: ignore[misc]
|
| 119 |
+
self,
|
| 120 |
+
low: int,
|
| 121 |
+
high: None | int = ...,
|
| 122 |
+
size: None = ...,
|
| 123 |
+
dtype: _DTypeLikeBool = ...,
|
| 124 |
+
) -> bool: ...
|
| 125 |
+
@overload
|
| 126 |
+
def randint( # type: ignore[misc]
|
| 127 |
+
self,
|
| 128 |
+
low: int,
|
| 129 |
+
high: None | int = ...,
|
| 130 |
+
size: None = ...,
|
| 131 |
+
dtype: _DTypeLikeInt | _DTypeLikeUInt = ...,
|
| 132 |
+
) -> int: ...
|
| 133 |
+
@overload
|
| 134 |
+
def randint( # type: ignore[misc]
|
| 135 |
+
self,
|
| 136 |
+
low: _ArrayLikeInt_co,
|
| 137 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 138 |
+
size: None | _ShapeLike = ...,
|
| 139 |
+
) -> ndarray[Any, dtype[int_]]: ...
|
| 140 |
+
@overload
|
| 141 |
+
def randint( # type: ignore[misc]
|
| 142 |
+
self,
|
| 143 |
+
low: _ArrayLikeInt_co,
|
| 144 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 145 |
+
size: None | _ShapeLike = ...,
|
| 146 |
+
dtype: _DTypeLikeBool = ...,
|
| 147 |
+
) -> ndarray[Any, dtype[bool_]]: ...
|
| 148 |
+
@overload
|
| 149 |
+
def randint( # type: ignore[misc]
|
| 150 |
+
self,
|
| 151 |
+
low: _ArrayLikeInt_co,
|
| 152 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 153 |
+
size: None | _ShapeLike = ...,
|
| 154 |
+
dtype: dtype[int8] | type[int8] | _Int8Codes | _SupportsDType[dtype[int8]] = ...,
|
| 155 |
+
) -> ndarray[Any, dtype[int8]]: ...
|
| 156 |
+
@overload
|
| 157 |
+
def randint( # type: ignore[misc]
|
| 158 |
+
self,
|
| 159 |
+
low: _ArrayLikeInt_co,
|
| 160 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 161 |
+
size: None | _ShapeLike = ...,
|
| 162 |
+
dtype: dtype[int16] | type[int16] | _Int16Codes | _SupportsDType[dtype[int16]] = ...,
|
| 163 |
+
) -> ndarray[Any, dtype[int16]]: ...
|
| 164 |
+
@overload
|
| 165 |
+
def randint( # type: ignore[misc]
|
| 166 |
+
self,
|
| 167 |
+
low: _ArrayLikeInt_co,
|
| 168 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 169 |
+
size: None | _ShapeLike = ...,
|
| 170 |
+
dtype: dtype[int32] | type[int32] | _Int32Codes | _SupportsDType[dtype[int32]] = ...,
|
| 171 |
+
) -> ndarray[Any, dtype[int32]]: ...
|
| 172 |
+
@overload
|
| 173 |
+
def randint( # type: ignore[misc]
|
| 174 |
+
self,
|
| 175 |
+
low: _ArrayLikeInt_co,
|
| 176 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 177 |
+
size: None | _ShapeLike = ...,
|
| 178 |
+
dtype: None | dtype[int64] | type[int64] | _Int64Codes | _SupportsDType[dtype[int64]] = ...,
|
| 179 |
+
) -> ndarray[Any, dtype[int64]]: ...
|
| 180 |
+
@overload
|
| 181 |
+
def randint( # type: ignore[misc]
|
| 182 |
+
self,
|
| 183 |
+
low: _ArrayLikeInt_co,
|
| 184 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 185 |
+
size: None | _ShapeLike = ...,
|
| 186 |
+
dtype: dtype[uint8] | type[uint8] | _UInt8Codes | _SupportsDType[dtype[uint8]] = ...,
|
| 187 |
+
) -> ndarray[Any, dtype[uint8]]: ...
|
| 188 |
+
@overload
|
| 189 |
+
def randint( # type: ignore[misc]
|
| 190 |
+
self,
|
| 191 |
+
low: _ArrayLikeInt_co,
|
| 192 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 193 |
+
size: None | _ShapeLike = ...,
|
| 194 |
+
dtype: dtype[uint16] | type[uint16] | _UInt16Codes | _SupportsDType[dtype[uint16]] = ...,
|
| 195 |
+
) -> ndarray[Any, dtype[uint16]]: ...
|
| 196 |
+
@overload
|
| 197 |
+
def randint( # type: ignore[misc]
|
| 198 |
+
self,
|
| 199 |
+
low: _ArrayLikeInt_co,
|
| 200 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 201 |
+
size: None | _ShapeLike = ...,
|
| 202 |
+
dtype: dtype[uint32] | type[uint32] | _UInt32Codes | _SupportsDType[dtype[uint32]] = ...,
|
| 203 |
+
) -> ndarray[Any, dtype[uint32]]: ...
|
| 204 |
+
@overload
|
| 205 |
+
def randint( # type: ignore[misc]
|
| 206 |
+
self,
|
| 207 |
+
low: _ArrayLikeInt_co,
|
| 208 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 209 |
+
size: None | _ShapeLike = ...,
|
| 210 |
+
dtype: dtype[uint64] | type[uint64] | _UInt64Codes | _SupportsDType[dtype[uint64]] = ...,
|
| 211 |
+
) -> ndarray[Any, dtype[uint64]]: ...
|
| 212 |
+
@overload
|
| 213 |
+
def randint( # type: ignore[misc]
|
| 214 |
+
self,
|
| 215 |
+
low: _ArrayLikeInt_co,
|
| 216 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 217 |
+
size: None | _ShapeLike = ...,
|
| 218 |
+
dtype: dtype[int_] | type[int] | type[int_] | _IntCodes | _SupportsDType[dtype[int_]] = ...,
|
| 219 |
+
) -> ndarray[Any, dtype[int_]]: ...
|
| 220 |
+
@overload
|
| 221 |
+
def randint( # type: ignore[misc]
|
| 222 |
+
self,
|
| 223 |
+
low: _ArrayLikeInt_co,
|
| 224 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 225 |
+
size: None | _ShapeLike = ...,
|
| 226 |
+
dtype: dtype[uint] | type[uint] | _UIntCodes | _SupportsDType[dtype[uint]] = ...,
|
| 227 |
+
) -> ndarray[Any, dtype[uint]]: ...
|
| 228 |
+
def bytes(self, length: int) -> builtins.bytes: ...
|
| 229 |
+
@overload
|
| 230 |
+
def choice(
|
| 231 |
+
self,
|
| 232 |
+
a: int,
|
| 233 |
+
size: None = ...,
|
| 234 |
+
replace: bool = ...,
|
| 235 |
+
p: None | _ArrayLikeFloat_co = ...,
|
| 236 |
+
) -> int: ...
|
| 237 |
+
@overload
|
| 238 |
+
def choice(
|
| 239 |
+
self,
|
| 240 |
+
a: int,
|
| 241 |
+
size: _ShapeLike = ...,
|
| 242 |
+
replace: bool = ...,
|
| 243 |
+
p: None | _ArrayLikeFloat_co = ...,
|
| 244 |
+
) -> ndarray[Any, dtype[int_]]: ...
|
| 245 |
+
@overload
|
| 246 |
+
def choice(
|
| 247 |
+
self,
|
| 248 |
+
a: ArrayLike,
|
| 249 |
+
size: None = ...,
|
| 250 |
+
replace: bool = ...,
|
| 251 |
+
p: None | _ArrayLikeFloat_co = ...,
|
| 252 |
+
) -> Any: ...
|
| 253 |
+
@overload
|
| 254 |
+
def choice(
|
| 255 |
+
self,
|
| 256 |
+
a: ArrayLike,
|
| 257 |
+
size: _ShapeLike = ...,
|
| 258 |
+
replace: bool = ...,
|
| 259 |
+
p: None | _ArrayLikeFloat_co = ...,
|
| 260 |
+
) -> ndarray[Any, Any]: ...
|
| 261 |
+
@overload
|
| 262 |
+
def uniform(self, low: float = ..., high: float = ..., size: None = ...) -> float: ... # type: ignore[misc]
|
| 263 |
+
@overload
|
| 264 |
+
def uniform(
|
| 265 |
+
self,
|
| 266 |
+
low: _ArrayLikeFloat_co = ...,
|
| 267 |
+
high: _ArrayLikeFloat_co = ...,
|
| 268 |
+
size: None | _ShapeLike = ...,
|
| 269 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 270 |
+
@overload
|
| 271 |
+
def rand(self) -> float: ...
|
| 272 |
+
@overload
|
| 273 |
+
def rand(self, *args: int) -> ndarray[Any, dtype[float64]]: ...
|
| 274 |
+
@overload
|
| 275 |
+
def randn(self) -> float: ...
|
| 276 |
+
@overload
|
| 277 |
+
def randn(self, *args: int) -> ndarray[Any, dtype[float64]]: ...
|
| 278 |
+
@overload
|
| 279 |
+
def random_integers(self, low: int, high: None | int = ..., size: None = ...) -> int: ... # type: ignore[misc]
|
| 280 |
+
@overload
|
| 281 |
+
def random_integers(
|
| 282 |
+
self,
|
| 283 |
+
low: _ArrayLikeInt_co,
|
| 284 |
+
high: None | _ArrayLikeInt_co = ...,
|
| 285 |
+
size: None | _ShapeLike = ...,
|
| 286 |
+
) -> ndarray[Any, dtype[int_]]: ...
|
| 287 |
+
@overload
|
| 288 |
+
def standard_normal(self, size: None = ...) -> float: ... # type: ignore[misc]
|
| 289 |
+
@overload
|
| 290 |
+
def standard_normal( # type: ignore[misc]
|
| 291 |
+
self, size: _ShapeLike = ...
|
| 292 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 293 |
+
@overload
|
| 294 |
+
def normal(self, loc: float = ..., scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc]
|
| 295 |
+
@overload
|
| 296 |
+
def normal(
|
| 297 |
+
self,
|
| 298 |
+
loc: _ArrayLikeFloat_co = ...,
|
| 299 |
+
scale: _ArrayLikeFloat_co = ...,
|
| 300 |
+
size: None | _ShapeLike = ...,
|
| 301 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 302 |
+
@overload
|
| 303 |
+
def standard_gamma( # type: ignore[misc]
|
| 304 |
+
self,
|
| 305 |
+
shape: float,
|
| 306 |
+
size: None = ...,
|
| 307 |
+
) -> float: ...
|
| 308 |
+
@overload
|
| 309 |
+
def standard_gamma(
|
| 310 |
+
self,
|
| 311 |
+
shape: _ArrayLikeFloat_co,
|
| 312 |
+
size: None | _ShapeLike = ...,
|
| 313 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 314 |
+
@overload
|
| 315 |
+
def gamma(self, shape: float, scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc]
|
| 316 |
+
@overload
|
| 317 |
+
def gamma(
|
| 318 |
+
self,
|
| 319 |
+
shape: _ArrayLikeFloat_co,
|
| 320 |
+
scale: _ArrayLikeFloat_co = ...,
|
| 321 |
+
size: None | _ShapeLike = ...,
|
| 322 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 323 |
+
@overload
|
| 324 |
+
def f(self, dfnum: float, dfden: float, size: None = ...) -> float: ... # type: ignore[misc]
|
| 325 |
+
@overload
|
| 326 |
+
def f(
|
| 327 |
+
self, dfnum: _ArrayLikeFloat_co, dfden: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 328 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 329 |
+
@overload
|
| 330 |
+
def noncentral_f(self, dfnum: float, dfden: float, nonc: float, size: None = ...) -> float: ... # type: ignore[misc]
|
| 331 |
+
@overload
|
| 332 |
+
def noncentral_f(
|
| 333 |
+
self,
|
| 334 |
+
dfnum: _ArrayLikeFloat_co,
|
| 335 |
+
dfden: _ArrayLikeFloat_co,
|
| 336 |
+
nonc: _ArrayLikeFloat_co,
|
| 337 |
+
size: None | _ShapeLike = ...,
|
| 338 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 339 |
+
@overload
|
| 340 |
+
def chisquare(self, df: float, size: None = ...) -> float: ... # type: ignore[misc]
|
| 341 |
+
@overload
|
| 342 |
+
def chisquare(
|
| 343 |
+
self, df: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 344 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 345 |
+
@overload
|
| 346 |
+
def noncentral_chisquare(self, df: float, nonc: float, size: None = ...) -> float: ... # type: ignore[misc]
|
| 347 |
+
@overload
|
| 348 |
+
def noncentral_chisquare(
|
| 349 |
+
self, df: _ArrayLikeFloat_co, nonc: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 350 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 351 |
+
@overload
|
| 352 |
+
def standard_t(self, df: float, size: None = ...) -> float: ... # type: ignore[misc]
|
| 353 |
+
@overload
|
| 354 |
+
def standard_t(
|
| 355 |
+
self, df: _ArrayLikeFloat_co, size: None = ...
|
| 356 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 357 |
+
@overload
|
| 358 |
+
def standard_t(
|
| 359 |
+
self, df: _ArrayLikeFloat_co, size: _ShapeLike = ...
|
| 360 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 361 |
+
@overload
|
| 362 |
+
def vonmises(self, mu: float, kappa: float, size: None = ...) -> float: ... # type: ignore[misc]
|
| 363 |
+
@overload
|
| 364 |
+
def vonmises(
|
| 365 |
+
self, mu: _ArrayLikeFloat_co, kappa: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 366 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 367 |
+
@overload
|
| 368 |
+
def pareto(self, a: float, size: None = ...) -> float: ... # type: ignore[misc]
|
| 369 |
+
@overload
|
| 370 |
+
def pareto(
|
| 371 |
+
self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 372 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 373 |
+
@overload
|
| 374 |
+
def weibull(self, a: float, size: None = ...) -> float: ... # type: ignore[misc]
|
| 375 |
+
@overload
|
| 376 |
+
def weibull(
|
| 377 |
+
self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 378 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 379 |
+
@overload
|
| 380 |
+
def power(self, a: float, size: None = ...) -> float: ... # type: ignore[misc]
|
| 381 |
+
@overload
|
| 382 |
+
def power(
|
| 383 |
+
self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 384 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 385 |
+
@overload
|
| 386 |
+
def standard_cauchy(self, size: None = ...) -> float: ... # type: ignore[misc]
|
| 387 |
+
@overload
|
| 388 |
+
def standard_cauchy(self, size: _ShapeLike = ...) -> ndarray[Any, dtype[float64]]: ...
|
| 389 |
+
@overload
|
| 390 |
+
def laplace(self, loc: float = ..., scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc]
|
| 391 |
+
@overload
|
| 392 |
+
def laplace(
|
| 393 |
+
self,
|
| 394 |
+
loc: _ArrayLikeFloat_co = ...,
|
| 395 |
+
scale: _ArrayLikeFloat_co = ...,
|
| 396 |
+
size: None | _ShapeLike = ...,
|
| 397 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 398 |
+
@overload
|
| 399 |
+
def gumbel(self, loc: float = ..., scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc]
|
| 400 |
+
@overload
|
| 401 |
+
def gumbel(
|
| 402 |
+
self,
|
| 403 |
+
loc: _ArrayLikeFloat_co = ...,
|
| 404 |
+
scale: _ArrayLikeFloat_co = ...,
|
| 405 |
+
size: None | _ShapeLike = ...,
|
| 406 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 407 |
+
@overload
|
| 408 |
+
def logistic(self, loc: float = ..., scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc]
|
| 409 |
+
@overload
|
| 410 |
+
def logistic(
|
| 411 |
+
self,
|
| 412 |
+
loc: _ArrayLikeFloat_co = ...,
|
| 413 |
+
scale: _ArrayLikeFloat_co = ...,
|
| 414 |
+
size: None | _ShapeLike = ...,
|
| 415 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 416 |
+
@overload
|
| 417 |
+
def lognormal(self, mean: float = ..., sigma: float = ..., size: None = ...) -> float: ... # type: ignore[misc]
|
| 418 |
+
@overload
|
| 419 |
+
def lognormal(
|
| 420 |
+
self,
|
| 421 |
+
mean: _ArrayLikeFloat_co = ...,
|
| 422 |
+
sigma: _ArrayLikeFloat_co = ...,
|
| 423 |
+
size: None | _ShapeLike = ...,
|
| 424 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 425 |
+
@overload
|
| 426 |
+
def rayleigh(self, scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc]
|
| 427 |
+
@overload
|
| 428 |
+
def rayleigh(
|
| 429 |
+
self, scale: _ArrayLikeFloat_co = ..., size: None | _ShapeLike = ...
|
| 430 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 431 |
+
@overload
|
| 432 |
+
def wald(self, mean: float, scale: float, size: None = ...) -> float: ... # type: ignore[misc]
|
| 433 |
+
@overload
|
| 434 |
+
def wald(
|
| 435 |
+
self, mean: _ArrayLikeFloat_co, scale: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 436 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 437 |
+
@overload
|
| 438 |
+
def triangular(self, left: float, mode: float, right: float, size: None = ...) -> float: ... # type: ignore[misc]
|
| 439 |
+
@overload
|
| 440 |
+
def triangular(
|
| 441 |
+
self,
|
| 442 |
+
left: _ArrayLikeFloat_co,
|
| 443 |
+
mode: _ArrayLikeFloat_co,
|
| 444 |
+
right: _ArrayLikeFloat_co,
|
| 445 |
+
size: None | _ShapeLike = ...,
|
| 446 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 447 |
+
@overload
|
| 448 |
+
def binomial(self, n: int, p: float, size: None = ...) -> int: ... # type: ignore[misc]
|
| 449 |
+
@overload
|
| 450 |
+
def binomial(
|
| 451 |
+
self, n: _ArrayLikeInt_co, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 452 |
+
) -> ndarray[Any, dtype[int_]]: ...
|
| 453 |
+
@overload
|
| 454 |
+
def negative_binomial(self, n: float, p: float, size: None = ...) -> int: ... # type: ignore[misc]
|
| 455 |
+
@overload
|
| 456 |
+
def negative_binomial(
|
| 457 |
+
self, n: _ArrayLikeFloat_co, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 458 |
+
) -> ndarray[Any, dtype[int_]]: ...
|
| 459 |
+
@overload
|
| 460 |
+
def poisson(self, lam: float = ..., size: None = ...) -> int: ... # type: ignore[misc]
|
| 461 |
+
@overload
|
| 462 |
+
def poisson(
|
| 463 |
+
self, lam: _ArrayLikeFloat_co = ..., size: None | _ShapeLike = ...
|
| 464 |
+
) -> ndarray[Any, dtype[int_]]: ...
|
| 465 |
+
@overload
|
| 466 |
+
def zipf(self, a: float, size: None = ...) -> int: ... # type: ignore[misc]
|
| 467 |
+
@overload
|
| 468 |
+
def zipf(
|
| 469 |
+
self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 470 |
+
) -> ndarray[Any, dtype[int_]]: ...
|
| 471 |
+
@overload
|
| 472 |
+
def geometric(self, p: float, size: None = ...) -> int: ... # type: ignore[misc]
|
| 473 |
+
@overload
|
| 474 |
+
def geometric(
|
| 475 |
+
self, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 476 |
+
) -> ndarray[Any, dtype[int_]]: ...
|
| 477 |
+
@overload
|
| 478 |
+
def hypergeometric(self, ngood: int, nbad: int, nsample: int, size: None = ...) -> int: ... # type: ignore[misc]
|
| 479 |
+
@overload
|
| 480 |
+
def hypergeometric(
|
| 481 |
+
self,
|
| 482 |
+
ngood: _ArrayLikeInt_co,
|
| 483 |
+
nbad: _ArrayLikeInt_co,
|
| 484 |
+
nsample: _ArrayLikeInt_co,
|
| 485 |
+
size: None | _ShapeLike = ...,
|
| 486 |
+
) -> ndarray[Any, dtype[int_]]: ...
|
| 487 |
+
@overload
|
| 488 |
+
def logseries(self, p: float, size: None = ...) -> int: ... # type: ignore[misc]
|
| 489 |
+
@overload
|
| 490 |
+
def logseries(
|
| 491 |
+
self, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 492 |
+
) -> ndarray[Any, dtype[int_]]: ...
|
| 493 |
+
def multivariate_normal(
|
| 494 |
+
self,
|
| 495 |
+
mean: _ArrayLikeFloat_co,
|
| 496 |
+
cov: _ArrayLikeFloat_co,
|
| 497 |
+
size: None | _ShapeLike = ...,
|
| 498 |
+
check_valid: Literal["warn", "raise", "ignore"] = ...,
|
| 499 |
+
tol: float = ...,
|
| 500 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 501 |
+
def multinomial(
|
| 502 |
+
self, n: _ArrayLikeInt_co, pvals: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 503 |
+
) -> ndarray[Any, dtype[int_]]: ...
|
| 504 |
+
def dirichlet(
|
| 505 |
+
self, alpha: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
|
| 506 |
+
) -> ndarray[Any, dtype[float64]]: ...
|
| 507 |
+
def shuffle(self, x: ArrayLike) -> None: ...
|
| 508 |
+
@overload
|
| 509 |
+
def permutation(self, x: int) -> ndarray[Any, dtype[int_]]: ...
|
| 510 |
+
@overload
|
| 511 |
+
def permutation(self, x: ArrayLike) -> ndarray[Any, Any]: ...
|
| 512 |
+
|
| 513 |
+
_rand: RandomState
|
| 514 |
+
|
| 515 |
+
beta = _rand.beta
|
| 516 |
+
binomial = _rand.binomial
|
| 517 |
+
bytes = _rand.bytes
|
| 518 |
+
chisquare = _rand.chisquare
|
| 519 |
+
choice = _rand.choice
|
| 520 |
+
dirichlet = _rand.dirichlet
|
| 521 |
+
exponential = _rand.exponential
|
| 522 |
+
f = _rand.f
|
| 523 |
+
gamma = _rand.gamma
|
| 524 |
+
get_state = _rand.get_state
|
| 525 |
+
geometric = _rand.geometric
|
| 526 |
+
gumbel = _rand.gumbel
|
| 527 |
+
hypergeometric = _rand.hypergeometric
|
| 528 |
+
laplace = _rand.laplace
|
| 529 |
+
logistic = _rand.logistic
|
| 530 |
+
lognormal = _rand.lognormal
|
| 531 |
+
logseries = _rand.logseries
|
| 532 |
+
multinomial = _rand.multinomial
|
| 533 |
+
multivariate_normal = _rand.multivariate_normal
|
| 534 |
+
negative_binomial = _rand.negative_binomial
|
| 535 |
+
noncentral_chisquare = _rand.noncentral_chisquare
|
| 536 |
+
noncentral_f = _rand.noncentral_f
|
| 537 |
+
normal = _rand.normal
|
| 538 |
+
pareto = _rand.pareto
|
| 539 |
+
permutation = _rand.permutation
|
| 540 |
+
poisson = _rand.poisson
|
| 541 |
+
power = _rand.power
|
| 542 |
+
rand = _rand.rand
|
| 543 |
+
randint = _rand.randint
|
| 544 |
+
randn = _rand.randn
|
| 545 |
+
random = _rand.random
|
| 546 |
+
random_integers = _rand.random_integers
|
| 547 |
+
random_sample = _rand.random_sample
|
| 548 |
+
rayleigh = _rand.rayleigh
|
| 549 |
+
seed = _rand.seed
|
| 550 |
+
set_state = _rand.set_state
|
| 551 |
+
shuffle = _rand.shuffle
|
| 552 |
+
standard_cauchy = _rand.standard_cauchy
|
| 553 |
+
standard_exponential = _rand.standard_exponential
|
| 554 |
+
standard_gamma = _rand.standard_gamma
|
| 555 |
+
standard_normal = _rand.standard_normal
|
| 556 |
+
standard_t = _rand.standard_t
|
| 557 |
+
triangular = _rand.triangular
|
| 558 |
+
uniform = _rand.uniform
|
| 559 |
+
vonmises = _rand.vonmises
|
| 560 |
+
wald = _rand.wald
|
| 561 |
+
weibull = _rand.weibull
|
| 562 |
+
zipf = _rand.zipf
|
| 563 |
+
# Two legacy that are trivial wrappers around random_sample
|
| 564 |
+
sample = _rand.random_sample
|
| 565 |
+
ranf = _rand.random_sample
|
| 566 |
+
|
| 567 |
+
def set_bit_generator(bitgen: BitGenerator) -> None:
|
| 568 |
+
...
|
| 569 |
+
|
| 570 |
+
def get_bit_generator() -> BitGenerator:
|
| 571 |
+
...
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/__init__.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
NumPy Array API compatibility library
|
| 3 |
+
|
| 4 |
+
This is a small wrapper around NumPy and CuPy that is compatible with the
|
| 5 |
+
Array API standard https://data-apis.org/array-api/latest/. See also NEP 47
|
| 6 |
+
https://numpy.org/neps/nep-0047-array-api-standard.html.
|
| 7 |
+
|
| 8 |
+
Unlike array_api_strict, this is not a strict minimal implementation of the
|
| 9 |
+
Array API, but rather just an extension of the main NumPy namespace with
|
| 10 |
+
changes needed to be compliant with the Array API. See
|
| 11 |
+
https://numpy.org/doc/stable/reference/array_api.html for a full list of
|
| 12 |
+
changes. In particular, unlike array_api_strict, this package does not use a
|
| 13 |
+
separate Array object, but rather just uses numpy.ndarray directly.
|
| 14 |
+
|
| 15 |
+
Library authors using the Array API may wish to test against array_api_strict
|
| 16 |
+
to ensure they are not using functionality outside of the standard, but prefer
|
| 17 |
+
this implementation for the default when working with NumPy arrays.
|
| 18 |
+
|
| 19 |
+
"""
|
| 20 |
+
__version__ = '1.9.1'
|
| 21 |
+
|
| 22 |
+
from .common import * # noqa: F401, F403
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (1.14 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/__pycache__/_internal.cpython-310.pyc
ADDED
|
Binary file (1.5 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/_internal.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Internal helpers
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from functools import wraps
|
| 6 |
+
from inspect import signature
|
| 7 |
+
|
| 8 |
+
def get_xp(xp):
|
| 9 |
+
"""
|
| 10 |
+
Decorator to automatically replace xp with the corresponding array module.
|
| 11 |
+
|
| 12 |
+
Use like
|
| 13 |
+
|
| 14 |
+
import numpy as np
|
| 15 |
+
|
| 16 |
+
@get_xp(np)
|
| 17 |
+
def func(x, /, xp, kwarg=None):
|
| 18 |
+
return xp.func(x, kwarg=kwarg)
|
| 19 |
+
|
| 20 |
+
Note that xp must be a keyword argument and come after all non-keyword
|
| 21 |
+
arguments.
|
| 22 |
+
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
def inner(f):
|
| 26 |
+
@wraps(f)
|
| 27 |
+
def wrapped_f(*args, **kwargs):
|
| 28 |
+
return f(*args, xp=xp, **kwargs)
|
| 29 |
+
|
| 30 |
+
sig = signature(f)
|
| 31 |
+
new_sig = sig.replace(
|
| 32 |
+
parameters=[sig.parameters[i] for i in sig.parameters if i != "xp"]
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
if wrapped_f.__doc__ is None:
|
| 36 |
+
wrapped_f.__doc__ = f"""\
|
| 37 |
+
Array API compatibility wrapper for {f.__name__}.
|
| 38 |
+
|
| 39 |
+
See the corresponding documentation in NumPy/CuPy and/or the array API
|
| 40 |
+
specification for more details.
|
| 41 |
+
|
| 42 |
+
"""
|
| 43 |
+
wrapped_f.__signature__ = new_sig
|
| 44 |
+
return wrapped_f
|
| 45 |
+
|
| 46 |
+
return inner
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/common/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (208 Bytes). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/common/__pycache__/_fft.cpython-310.pyc
ADDED
|
Binary file (3.27 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/common/__pycache__/_helpers.cpython-310.pyc
ADDED
|
Binary file (19.4 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/common/__pycache__/_linalg.cpython-310.pyc
ADDED
|
Binary file (5.83 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/__init__.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from cupy import * # noqa: F403
|
| 2 |
+
|
| 3 |
+
# from cupy import * doesn't overwrite these builtin names
|
| 4 |
+
from cupy import abs, max, min, round # noqa: F401
|
| 5 |
+
|
| 6 |
+
# These imports may overwrite names from the import * above.
|
| 7 |
+
from ._aliases import * # noqa: F403
|
| 8 |
+
|
| 9 |
+
# See the comment in the numpy __init__.py
|
| 10 |
+
__import__(__package__ + '.linalg')
|
| 11 |
+
|
| 12 |
+
__import__(__package__ + '.fft')
|
| 13 |
+
|
| 14 |
+
from ..common._helpers import * # noqa: F401,F403
|
| 15 |
+
|
| 16 |
+
__array_api_version__ = '2023.12'
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (435 Bytes). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/__pycache__/_aliases.cpython-310.pyc
ADDED
|
Binary file (3.03 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/__pycache__/_info.cpython-310.pyc
ADDED
|
Binary file (8.94 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/__pycache__/_typing.cpython-310.pyc
ADDED
|
Binary file (719 Bytes). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/__pycache__/fft.cpython-310.pyc
ADDED
|
Binary file (770 Bytes). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/__pycache__/linalg.cpython-310.pyc
ADDED
|
Binary file (1.04 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/_aliases.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import cupy as cp
|
| 4 |
+
|
| 5 |
+
from ..common import _aliases
|
| 6 |
+
from .._internal import get_xp
|
| 7 |
+
|
| 8 |
+
from ._info import __array_namespace_info__
|
| 9 |
+
|
| 10 |
+
from typing import TYPE_CHECKING
|
| 11 |
+
if TYPE_CHECKING:
|
| 12 |
+
from typing import Optional, Union
|
| 13 |
+
from ._typing import ndarray, Device, Dtype, NestedSequence, SupportsBufferProtocol
|
| 14 |
+
|
| 15 |
+
bool = cp.bool_
|
| 16 |
+
|
| 17 |
+
# Basic renames
|
| 18 |
+
acos = cp.arccos
|
| 19 |
+
acosh = cp.arccosh
|
| 20 |
+
asin = cp.arcsin
|
| 21 |
+
asinh = cp.arcsinh
|
| 22 |
+
atan = cp.arctan
|
| 23 |
+
atan2 = cp.arctan2
|
| 24 |
+
atanh = cp.arctanh
|
| 25 |
+
bitwise_left_shift = cp.left_shift
|
| 26 |
+
bitwise_invert = cp.invert
|
| 27 |
+
bitwise_right_shift = cp.right_shift
|
| 28 |
+
concat = cp.concatenate
|
| 29 |
+
pow = cp.power
|
| 30 |
+
|
| 31 |
+
arange = get_xp(cp)(_aliases.arange)
|
| 32 |
+
empty = get_xp(cp)(_aliases.empty)
|
| 33 |
+
empty_like = get_xp(cp)(_aliases.empty_like)
|
| 34 |
+
eye = get_xp(cp)(_aliases.eye)
|
| 35 |
+
full = get_xp(cp)(_aliases.full)
|
| 36 |
+
full_like = get_xp(cp)(_aliases.full_like)
|
| 37 |
+
linspace = get_xp(cp)(_aliases.linspace)
|
| 38 |
+
ones = get_xp(cp)(_aliases.ones)
|
| 39 |
+
ones_like = get_xp(cp)(_aliases.ones_like)
|
| 40 |
+
zeros = get_xp(cp)(_aliases.zeros)
|
| 41 |
+
zeros_like = get_xp(cp)(_aliases.zeros_like)
|
| 42 |
+
UniqueAllResult = get_xp(cp)(_aliases.UniqueAllResult)
|
| 43 |
+
UniqueCountsResult = get_xp(cp)(_aliases.UniqueCountsResult)
|
| 44 |
+
UniqueInverseResult = get_xp(cp)(_aliases.UniqueInverseResult)
|
| 45 |
+
unique_all = get_xp(cp)(_aliases.unique_all)
|
| 46 |
+
unique_counts = get_xp(cp)(_aliases.unique_counts)
|
| 47 |
+
unique_inverse = get_xp(cp)(_aliases.unique_inverse)
|
| 48 |
+
unique_values = get_xp(cp)(_aliases.unique_values)
|
| 49 |
+
astype = _aliases.astype
|
| 50 |
+
std = get_xp(cp)(_aliases.std)
|
| 51 |
+
var = get_xp(cp)(_aliases.var)
|
| 52 |
+
cumulative_sum = get_xp(cp)(_aliases.cumulative_sum)
|
| 53 |
+
clip = get_xp(cp)(_aliases.clip)
|
| 54 |
+
permute_dims = get_xp(cp)(_aliases.permute_dims)
|
| 55 |
+
reshape = get_xp(cp)(_aliases.reshape)
|
| 56 |
+
argsort = get_xp(cp)(_aliases.argsort)
|
| 57 |
+
sort = get_xp(cp)(_aliases.sort)
|
| 58 |
+
nonzero = get_xp(cp)(_aliases.nonzero)
|
| 59 |
+
ceil = get_xp(cp)(_aliases.ceil)
|
| 60 |
+
floor = get_xp(cp)(_aliases.floor)
|
| 61 |
+
trunc = get_xp(cp)(_aliases.trunc)
|
| 62 |
+
matmul = get_xp(cp)(_aliases.matmul)
|
| 63 |
+
matrix_transpose = get_xp(cp)(_aliases.matrix_transpose)
|
| 64 |
+
tensordot = get_xp(cp)(_aliases.tensordot)
|
| 65 |
+
sign = get_xp(cp)(_aliases.sign)
|
| 66 |
+
|
| 67 |
+
_copy_default = object()
|
| 68 |
+
|
| 69 |
+
# asarray also adds the copy keyword, which is not present in numpy 1.0.
|
| 70 |
+
def asarray(
|
| 71 |
+
obj: Union[
|
| 72 |
+
ndarray,
|
| 73 |
+
bool,
|
| 74 |
+
int,
|
| 75 |
+
float,
|
| 76 |
+
NestedSequence[bool | int | float],
|
| 77 |
+
SupportsBufferProtocol,
|
| 78 |
+
],
|
| 79 |
+
/,
|
| 80 |
+
*,
|
| 81 |
+
dtype: Optional[Dtype] = None,
|
| 82 |
+
device: Optional[Device] = None,
|
| 83 |
+
copy: Optional[bool] = _copy_default,
|
| 84 |
+
**kwargs,
|
| 85 |
+
) -> ndarray:
|
| 86 |
+
"""
|
| 87 |
+
Array API compatibility wrapper for asarray().
|
| 88 |
+
|
| 89 |
+
See the corresponding documentation in the array library and/or the array API
|
| 90 |
+
specification for more details.
|
| 91 |
+
"""
|
| 92 |
+
with cp.cuda.Device(device):
|
| 93 |
+
# cupy is like NumPy 1.26 (except without _CopyMode). See the comments
|
| 94 |
+
# in asarray in numpy/_aliases.py.
|
| 95 |
+
if copy is not _copy_default:
|
| 96 |
+
# A future version of CuPy will change the meaning of copy=False
|
| 97 |
+
# to mean no-copy. We don't know for certain what version it will
|
| 98 |
+
# be yet, so to avoid breaking that version, we use a different
|
| 99 |
+
# default value for copy so asarray(obj) with no copy kwarg will
|
| 100 |
+
# always do the copy-if-needed behavior.
|
| 101 |
+
|
| 102 |
+
# This will still need to be updated to remove the
|
| 103 |
+
# NotImplementedError for copy=False, but at least this won't
|
| 104 |
+
# break the default or existing behavior.
|
| 105 |
+
if copy is None:
|
| 106 |
+
copy = False
|
| 107 |
+
elif copy is False:
|
| 108 |
+
raise NotImplementedError("asarray(copy=False) is not yet supported in cupy")
|
| 109 |
+
kwargs['copy'] = copy
|
| 110 |
+
|
| 111 |
+
return cp.array(obj, dtype=dtype, **kwargs)
|
| 112 |
+
|
| 113 |
+
# These functions are completely new here. If the library already has them
|
| 114 |
+
# (i.e., numpy 2.0), use the library version instead of our wrapper.
|
| 115 |
+
if hasattr(cp, 'vecdot'):
|
| 116 |
+
vecdot = cp.vecdot
|
| 117 |
+
else:
|
| 118 |
+
vecdot = get_xp(cp)(_aliases.vecdot)
|
| 119 |
+
|
| 120 |
+
if hasattr(cp, 'isdtype'):
|
| 121 |
+
isdtype = cp.isdtype
|
| 122 |
+
else:
|
| 123 |
+
isdtype = get_xp(cp)(_aliases.isdtype)
|
| 124 |
+
|
| 125 |
+
if hasattr(cp, 'unstack'):
|
| 126 |
+
unstack = cp.unstack
|
| 127 |
+
else:
|
| 128 |
+
unstack = get_xp(cp)(_aliases.unstack)
|
| 129 |
+
|
| 130 |
+
__all__ = _aliases.__all__ + ['__array_namespace_info__', 'asarray', 'bool',
|
| 131 |
+
'acos', 'acosh', 'asin', 'asinh', 'atan',
|
| 132 |
+
'atan2', 'atanh', 'bitwise_left_shift',
|
| 133 |
+
'bitwise_invert', 'bitwise_right_shift',
|
| 134 |
+
'concat', 'pow', 'sign']
|
| 135 |
+
|
| 136 |
+
_all_ignore = ['cp', 'get_xp']
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/_info.py
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Array API Inspection namespace
|
| 3 |
+
|
| 4 |
+
This is the namespace for inspection functions as defined by the array API
|
| 5 |
+
standard. See
|
| 6 |
+
https://data-apis.org/array-api/latest/API_specification/inspection.html for
|
| 7 |
+
more details.
|
| 8 |
+
|
| 9 |
+
"""
|
| 10 |
+
from cupy import (
|
| 11 |
+
dtype,
|
| 12 |
+
cuda,
|
| 13 |
+
bool_ as bool,
|
| 14 |
+
intp,
|
| 15 |
+
int8,
|
| 16 |
+
int16,
|
| 17 |
+
int32,
|
| 18 |
+
int64,
|
| 19 |
+
uint8,
|
| 20 |
+
uint16,
|
| 21 |
+
uint32,
|
| 22 |
+
uint64,
|
| 23 |
+
float32,
|
| 24 |
+
float64,
|
| 25 |
+
complex64,
|
| 26 |
+
complex128,
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
class __array_namespace_info__:
|
| 30 |
+
"""
|
| 31 |
+
Get the array API inspection namespace for CuPy.
|
| 32 |
+
|
| 33 |
+
The array API inspection namespace defines the following functions:
|
| 34 |
+
|
| 35 |
+
- capabilities()
|
| 36 |
+
- default_device()
|
| 37 |
+
- default_dtypes()
|
| 38 |
+
- dtypes()
|
| 39 |
+
- devices()
|
| 40 |
+
|
| 41 |
+
See
|
| 42 |
+
https://data-apis.org/array-api/latest/API_specification/inspection.html
|
| 43 |
+
for more details.
|
| 44 |
+
|
| 45 |
+
Returns
|
| 46 |
+
-------
|
| 47 |
+
info : ModuleType
|
| 48 |
+
The array API inspection namespace for CuPy.
|
| 49 |
+
|
| 50 |
+
Examples
|
| 51 |
+
--------
|
| 52 |
+
>>> info = np.__array_namespace_info__()
|
| 53 |
+
>>> info.default_dtypes()
|
| 54 |
+
{'real floating': cupy.float64,
|
| 55 |
+
'complex floating': cupy.complex128,
|
| 56 |
+
'integral': cupy.int64,
|
| 57 |
+
'indexing': cupy.int64}
|
| 58 |
+
|
| 59 |
+
"""
|
| 60 |
+
|
| 61 |
+
__module__ = 'cupy'
|
| 62 |
+
|
| 63 |
+
def capabilities(self):
|
| 64 |
+
"""
|
| 65 |
+
Return a dictionary of array API library capabilities.
|
| 66 |
+
|
| 67 |
+
The resulting dictionary has the following keys:
|
| 68 |
+
|
| 69 |
+
- **"boolean indexing"**: boolean indicating whether an array library
|
| 70 |
+
supports boolean indexing. Always ``True`` for CuPy.
|
| 71 |
+
|
| 72 |
+
- **"data-dependent shapes"**: boolean indicating whether an array
|
| 73 |
+
library supports data-dependent output shapes. Always ``True`` for
|
| 74 |
+
CuPy.
|
| 75 |
+
|
| 76 |
+
See
|
| 77 |
+
https://data-apis.org/array-api/latest/API_specification/generated/array_api.info.capabilities.html
|
| 78 |
+
for more details.
|
| 79 |
+
|
| 80 |
+
See Also
|
| 81 |
+
--------
|
| 82 |
+
__array_namespace_info__.default_device,
|
| 83 |
+
__array_namespace_info__.default_dtypes,
|
| 84 |
+
__array_namespace_info__.dtypes,
|
| 85 |
+
__array_namespace_info__.devices
|
| 86 |
+
|
| 87 |
+
Returns
|
| 88 |
+
-------
|
| 89 |
+
capabilities : dict
|
| 90 |
+
A dictionary of array API library capabilities.
|
| 91 |
+
|
| 92 |
+
Examples
|
| 93 |
+
--------
|
| 94 |
+
>>> info = xp.__array_namespace_info__()
|
| 95 |
+
>>> info.capabilities()
|
| 96 |
+
{'boolean indexing': True,
|
| 97 |
+
'data-dependent shapes': True}
|
| 98 |
+
|
| 99 |
+
"""
|
| 100 |
+
return {
|
| 101 |
+
"boolean indexing": True,
|
| 102 |
+
"data-dependent shapes": True,
|
| 103 |
+
# 'max rank' will be part of the 2024.12 standard
|
| 104 |
+
# "max rank": 64,
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
def default_device(self):
|
| 108 |
+
"""
|
| 109 |
+
The default device used for new CuPy arrays.
|
| 110 |
+
|
| 111 |
+
See Also
|
| 112 |
+
--------
|
| 113 |
+
__array_namespace_info__.capabilities,
|
| 114 |
+
__array_namespace_info__.default_dtypes,
|
| 115 |
+
__array_namespace_info__.dtypes,
|
| 116 |
+
__array_namespace_info__.devices
|
| 117 |
+
|
| 118 |
+
Returns
|
| 119 |
+
-------
|
| 120 |
+
device : str
|
| 121 |
+
The default device used for new CuPy arrays.
|
| 122 |
+
|
| 123 |
+
Examples
|
| 124 |
+
--------
|
| 125 |
+
>>> info = xp.__array_namespace_info__()
|
| 126 |
+
>>> info.default_device()
|
| 127 |
+
Device(0)
|
| 128 |
+
|
| 129 |
+
"""
|
| 130 |
+
return cuda.Device(0)
|
| 131 |
+
|
| 132 |
+
def default_dtypes(self, *, device=None):
|
| 133 |
+
"""
|
| 134 |
+
The default data types used for new CuPy arrays.
|
| 135 |
+
|
| 136 |
+
For CuPy, this always returns the following dictionary:
|
| 137 |
+
|
| 138 |
+
- **"real floating"**: ``cupy.float64``
|
| 139 |
+
- **"complex floating"**: ``cupy.complex128``
|
| 140 |
+
- **"integral"**: ``cupy.intp``
|
| 141 |
+
- **"indexing"**: ``cupy.intp``
|
| 142 |
+
|
| 143 |
+
Parameters
|
| 144 |
+
----------
|
| 145 |
+
device : str, optional
|
| 146 |
+
The device to get the default data types for.
|
| 147 |
+
|
| 148 |
+
Returns
|
| 149 |
+
-------
|
| 150 |
+
dtypes : dict
|
| 151 |
+
A dictionary describing the default data types used for new CuPy
|
| 152 |
+
arrays.
|
| 153 |
+
|
| 154 |
+
See Also
|
| 155 |
+
--------
|
| 156 |
+
__array_namespace_info__.capabilities,
|
| 157 |
+
__array_namespace_info__.default_device,
|
| 158 |
+
__array_namespace_info__.dtypes,
|
| 159 |
+
__array_namespace_info__.devices
|
| 160 |
+
|
| 161 |
+
Examples
|
| 162 |
+
--------
|
| 163 |
+
>>> info = xp.__array_namespace_info__()
|
| 164 |
+
>>> info.default_dtypes()
|
| 165 |
+
{'real floating': cupy.float64,
|
| 166 |
+
'complex floating': cupy.complex128,
|
| 167 |
+
'integral': cupy.int64,
|
| 168 |
+
'indexing': cupy.int64}
|
| 169 |
+
|
| 170 |
+
"""
|
| 171 |
+
# TODO: Does this depend on device?
|
| 172 |
+
return {
|
| 173 |
+
"real floating": dtype(float64),
|
| 174 |
+
"complex floating": dtype(complex128),
|
| 175 |
+
"integral": dtype(intp),
|
| 176 |
+
"indexing": dtype(intp),
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
def dtypes(self, *, device=None, kind=None):
|
| 180 |
+
"""
|
| 181 |
+
The array API data types supported by CuPy.
|
| 182 |
+
|
| 183 |
+
Note that this function only returns data types that are defined by
|
| 184 |
+
the array API.
|
| 185 |
+
|
| 186 |
+
Parameters
|
| 187 |
+
----------
|
| 188 |
+
device : str, optional
|
| 189 |
+
The device to get the data types for.
|
| 190 |
+
kind : str or tuple of str, optional
|
| 191 |
+
The kind of data types to return. If ``None``, all data types are
|
| 192 |
+
returned. If a string, only data types of that kind are returned.
|
| 193 |
+
If a tuple, a dictionary containing the union of the given kinds
|
| 194 |
+
is returned. The following kinds are supported:
|
| 195 |
+
|
| 196 |
+
- ``'bool'``: boolean data types (i.e., ``bool``).
|
| 197 |
+
- ``'signed integer'``: signed integer data types (i.e., ``int8``,
|
| 198 |
+
``int16``, ``int32``, ``int64``).
|
| 199 |
+
- ``'unsigned integer'``: unsigned integer data types (i.e.,
|
| 200 |
+
``uint8``, ``uint16``, ``uint32``, ``uint64``).
|
| 201 |
+
- ``'integral'``: integer data types. Shorthand for ``('signed
|
| 202 |
+
integer', 'unsigned integer')``.
|
| 203 |
+
- ``'real floating'``: real-valued floating-point data types
|
| 204 |
+
(i.e., ``float32``, ``float64``).
|
| 205 |
+
- ``'complex floating'``: complex floating-point data types (i.e.,
|
| 206 |
+
``complex64``, ``complex128``).
|
| 207 |
+
- ``'numeric'``: numeric data types. Shorthand for ``('integral',
|
| 208 |
+
'real floating', 'complex floating')``.
|
| 209 |
+
|
| 210 |
+
Returns
|
| 211 |
+
-------
|
| 212 |
+
dtypes : dict
|
| 213 |
+
A dictionary mapping the names of data types to the corresponding
|
| 214 |
+
CuPy data types.
|
| 215 |
+
|
| 216 |
+
See Also
|
| 217 |
+
--------
|
| 218 |
+
__array_namespace_info__.capabilities,
|
| 219 |
+
__array_namespace_info__.default_device,
|
| 220 |
+
__array_namespace_info__.default_dtypes,
|
| 221 |
+
__array_namespace_info__.devices
|
| 222 |
+
|
| 223 |
+
Examples
|
| 224 |
+
--------
|
| 225 |
+
>>> info = xp.__array_namespace_info__()
|
| 226 |
+
>>> info.dtypes(kind='signed integer')
|
| 227 |
+
{'int8': cupy.int8,
|
| 228 |
+
'int16': cupy.int16,
|
| 229 |
+
'int32': cupy.int32,
|
| 230 |
+
'int64': cupy.int64}
|
| 231 |
+
|
| 232 |
+
"""
|
| 233 |
+
# TODO: Does this depend on device?
|
| 234 |
+
if kind is None:
|
| 235 |
+
return {
|
| 236 |
+
"bool": dtype(bool),
|
| 237 |
+
"int8": dtype(int8),
|
| 238 |
+
"int16": dtype(int16),
|
| 239 |
+
"int32": dtype(int32),
|
| 240 |
+
"int64": dtype(int64),
|
| 241 |
+
"uint8": dtype(uint8),
|
| 242 |
+
"uint16": dtype(uint16),
|
| 243 |
+
"uint32": dtype(uint32),
|
| 244 |
+
"uint64": dtype(uint64),
|
| 245 |
+
"float32": dtype(float32),
|
| 246 |
+
"float64": dtype(float64),
|
| 247 |
+
"complex64": dtype(complex64),
|
| 248 |
+
"complex128": dtype(complex128),
|
| 249 |
+
}
|
| 250 |
+
if kind == "bool":
|
| 251 |
+
return {"bool": bool}
|
| 252 |
+
if kind == "signed integer":
|
| 253 |
+
return {
|
| 254 |
+
"int8": dtype(int8),
|
| 255 |
+
"int16": dtype(int16),
|
| 256 |
+
"int32": dtype(int32),
|
| 257 |
+
"int64": dtype(int64),
|
| 258 |
+
}
|
| 259 |
+
if kind == "unsigned integer":
|
| 260 |
+
return {
|
| 261 |
+
"uint8": dtype(uint8),
|
| 262 |
+
"uint16": dtype(uint16),
|
| 263 |
+
"uint32": dtype(uint32),
|
| 264 |
+
"uint64": dtype(uint64),
|
| 265 |
+
}
|
| 266 |
+
if kind == "integral":
|
| 267 |
+
return {
|
| 268 |
+
"int8": dtype(int8),
|
| 269 |
+
"int16": dtype(int16),
|
| 270 |
+
"int32": dtype(int32),
|
| 271 |
+
"int64": dtype(int64),
|
| 272 |
+
"uint8": dtype(uint8),
|
| 273 |
+
"uint16": dtype(uint16),
|
| 274 |
+
"uint32": dtype(uint32),
|
| 275 |
+
"uint64": dtype(uint64),
|
| 276 |
+
}
|
| 277 |
+
if kind == "real floating":
|
| 278 |
+
return {
|
| 279 |
+
"float32": dtype(float32),
|
| 280 |
+
"float64": dtype(float64),
|
| 281 |
+
}
|
| 282 |
+
if kind == "complex floating":
|
| 283 |
+
return {
|
| 284 |
+
"complex64": dtype(complex64),
|
| 285 |
+
"complex128": dtype(complex128),
|
| 286 |
+
}
|
| 287 |
+
if kind == "numeric":
|
| 288 |
+
return {
|
| 289 |
+
"int8": dtype(int8),
|
| 290 |
+
"int16": dtype(int16),
|
| 291 |
+
"int32": dtype(int32),
|
| 292 |
+
"int64": dtype(int64),
|
| 293 |
+
"uint8": dtype(uint8),
|
| 294 |
+
"uint16": dtype(uint16),
|
| 295 |
+
"uint32": dtype(uint32),
|
| 296 |
+
"uint64": dtype(uint64),
|
| 297 |
+
"float32": dtype(float32),
|
| 298 |
+
"float64": dtype(float64),
|
| 299 |
+
"complex64": dtype(complex64),
|
| 300 |
+
"complex128": dtype(complex128),
|
| 301 |
+
}
|
| 302 |
+
if isinstance(kind, tuple):
|
| 303 |
+
res = {}
|
| 304 |
+
for k in kind:
|
| 305 |
+
res.update(self.dtypes(kind=k))
|
| 306 |
+
return res
|
| 307 |
+
raise ValueError(f"unsupported kind: {kind!r}")
|
| 308 |
+
|
| 309 |
+
def devices(self):
|
| 310 |
+
"""
|
| 311 |
+
The devices supported by CuPy.
|
| 312 |
+
|
| 313 |
+
Returns
|
| 314 |
+
-------
|
| 315 |
+
devices : list of str
|
| 316 |
+
The devices supported by CuPy.
|
| 317 |
+
|
| 318 |
+
See Also
|
| 319 |
+
--------
|
| 320 |
+
__array_namespace_info__.capabilities,
|
| 321 |
+
__array_namespace_info__.default_device,
|
| 322 |
+
__array_namespace_info__.default_dtypes,
|
| 323 |
+
__array_namespace_info__.dtypes
|
| 324 |
+
|
| 325 |
+
"""
|
| 326 |
+
return [cuda.Device(i) for i in range(cuda.runtime.getDeviceCount())]
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/_typing.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
__all__ = [
|
| 4 |
+
"ndarray",
|
| 5 |
+
"Device",
|
| 6 |
+
"Dtype",
|
| 7 |
+
]
|
| 8 |
+
|
| 9 |
+
import sys
|
| 10 |
+
from typing import (
|
| 11 |
+
Union,
|
| 12 |
+
TYPE_CHECKING,
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
from cupy import (
|
| 16 |
+
ndarray,
|
| 17 |
+
dtype,
|
| 18 |
+
int8,
|
| 19 |
+
int16,
|
| 20 |
+
int32,
|
| 21 |
+
int64,
|
| 22 |
+
uint8,
|
| 23 |
+
uint16,
|
| 24 |
+
uint32,
|
| 25 |
+
uint64,
|
| 26 |
+
float32,
|
| 27 |
+
float64,
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
from cupy.cuda.device import Device
|
| 31 |
+
|
| 32 |
+
if TYPE_CHECKING or sys.version_info >= (3, 9):
|
| 33 |
+
Dtype = dtype[Union[
|
| 34 |
+
int8,
|
| 35 |
+
int16,
|
| 36 |
+
int32,
|
| 37 |
+
int64,
|
| 38 |
+
uint8,
|
| 39 |
+
uint16,
|
| 40 |
+
uint32,
|
| 41 |
+
uint64,
|
| 42 |
+
float32,
|
| 43 |
+
float64,
|
| 44 |
+
]]
|
| 45 |
+
else:
|
| 46 |
+
Dtype = dtype
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/fft.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from cupy.fft import * # noqa: F403
|
| 2 |
+
# cupy.fft doesn't have __all__. If it is added, replace this with
|
| 3 |
+
#
|
| 4 |
+
# from cupy.fft import __all__ as linalg_all
|
| 5 |
+
_n = {}
|
| 6 |
+
exec('from cupy.fft import *', _n)
|
| 7 |
+
del _n['__builtins__']
|
| 8 |
+
fft_all = list(_n)
|
| 9 |
+
del _n
|
| 10 |
+
|
| 11 |
+
from ..common import _fft
|
| 12 |
+
from .._internal import get_xp
|
| 13 |
+
|
| 14 |
+
import cupy as cp
|
| 15 |
+
|
| 16 |
+
fft = get_xp(cp)(_fft.fft)
|
| 17 |
+
ifft = get_xp(cp)(_fft.ifft)
|
| 18 |
+
fftn = get_xp(cp)(_fft.fftn)
|
| 19 |
+
ifftn = get_xp(cp)(_fft.ifftn)
|
| 20 |
+
rfft = get_xp(cp)(_fft.rfft)
|
| 21 |
+
irfft = get_xp(cp)(_fft.irfft)
|
| 22 |
+
rfftn = get_xp(cp)(_fft.rfftn)
|
| 23 |
+
irfftn = get_xp(cp)(_fft.irfftn)
|
| 24 |
+
hfft = get_xp(cp)(_fft.hfft)
|
| 25 |
+
ihfft = get_xp(cp)(_fft.ihfft)
|
| 26 |
+
fftfreq = get_xp(cp)(_fft.fftfreq)
|
| 27 |
+
rfftfreq = get_xp(cp)(_fft.rfftfreq)
|
| 28 |
+
fftshift = get_xp(cp)(_fft.fftshift)
|
| 29 |
+
ifftshift = get_xp(cp)(_fft.ifftshift)
|
| 30 |
+
|
| 31 |
+
__all__ = fft_all + _fft.__all__
|
| 32 |
+
|
| 33 |
+
del get_xp
|
| 34 |
+
del cp
|
| 35 |
+
del fft_all
|
| 36 |
+
del _fft
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/cupy/linalg.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from cupy.linalg import * # noqa: F403
|
| 2 |
+
# cupy.linalg doesn't have __all__. If it is added, replace this with
|
| 3 |
+
#
|
| 4 |
+
# from cupy.linalg import __all__ as linalg_all
|
| 5 |
+
_n = {}
|
| 6 |
+
exec('from cupy.linalg import *', _n)
|
| 7 |
+
del _n['__builtins__']
|
| 8 |
+
linalg_all = list(_n)
|
| 9 |
+
del _n
|
| 10 |
+
|
| 11 |
+
from ..common import _linalg
|
| 12 |
+
from .._internal import get_xp
|
| 13 |
+
|
| 14 |
+
import cupy as cp
|
| 15 |
+
|
| 16 |
+
# These functions are in both the main and linalg namespaces
|
| 17 |
+
from ._aliases import matmul, matrix_transpose, tensordot, vecdot # noqa: F401
|
| 18 |
+
|
| 19 |
+
cross = get_xp(cp)(_linalg.cross)
|
| 20 |
+
outer = get_xp(cp)(_linalg.outer)
|
| 21 |
+
EighResult = _linalg.EighResult
|
| 22 |
+
QRResult = _linalg.QRResult
|
| 23 |
+
SlogdetResult = _linalg.SlogdetResult
|
| 24 |
+
SVDResult = _linalg.SVDResult
|
| 25 |
+
eigh = get_xp(cp)(_linalg.eigh)
|
| 26 |
+
qr = get_xp(cp)(_linalg.qr)
|
| 27 |
+
slogdet = get_xp(cp)(_linalg.slogdet)
|
| 28 |
+
svd = get_xp(cp)(_linalg.svd)
|
| 29 |
+
cholesky = get_xp(cp)(_linalg.cholesky)
|
| 30 |
+
matrix_rank = get_xp(cp)(_linalg.matrix_rank)
|
| 31 |
+
pinv = get_xp(cp)(_linalg.pinv)
|
| 32 |
+
matrix_norm = get_xp(cp)(_linalg.matrix_norm)
|
| 33 |
+
svdvals = get_xp(cp)(_linalg.svdvals)
|
| 34 |
+
diagonal = get_xp(cp)(_linalg.diagonal)
|
| 35 |
+
trace = get_xp(cp)(_linalg.trace)
|
| 36 |
+
|
| 37 |
+
# These functions are completely new here. If the library already has them
|
| 38 |
+
# (i.e., numpy 2.0), use the library version instead of our wrapper.
|
| 39 |
+
if hasattr(cp.linalg, 'vector_norm'):
|
| 40 |
+
vector_norm = cp.linalg.vector_norm
|
| 41 |
+
else:
|
| 42 |
+
vector_norm = get_xp(cp)(_linalg.vector_norm)
|
| 43 |
+
|
| 44 |
+
__all__ = linalg_all + _linalg.__all__
|
| 45 |
+
|
| 46 |
+
del get_xp
|
| 47 |
+
del cp
|
| 48 |
+
del linalg_all
|
| 49 |
+
del _linalg
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/__init__.py
ADDED
|
File without changes
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (181 Bytes). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/__init__.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from dask.array import * # noqa: F403
|
| 2 |
+
|
| 3 |
+
# These imports may overwrite names from the import * above.
|
| 4 |
+
from ._aliases import * # noqa: F403
|
| 5 |
+
|
| 6 |
+
__array_api_version__ = '2023.12'
|
| 7 |
+
|
| 8 |
+
__import__(__package__ + '.linalg')
|
| 9 |
+
__import__(__package__ + '.fft')
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (345 Bytes). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/__pycache__/_aliases.cpython-310.pyc
ADDED
|
Binary file (4.85 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/__pycache__/_info.cpython-310.pyc
ADDED
|
Binary file (9.22 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/__pycache__/fft.cpython-310.pyc
ADDED
|
Binary file (678 Bytes). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/__pycache__/linalg.cpython-310.pyc
ADDED
|
Binary file (1.98 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/_aliases.py
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from ...common import _aliases
|
| 4 |
+
from ...common._helpers import _check_device
|
| 5 |
+
|
| 6 |
+
from ..._internal import get_xp
|
| 7 |
+
|
| 8 |
+
from ._info import __array_namespace_info__
|
| 9 |
+
|
| 10 |
+
import numpy as np
|
| 11 |
+
from numpy import (
|
| 12 |
+
# Dtypes
|
| 13 |
+
iinfo,
|
| 14 |
+
finfo,
|
| 15 |
+
bool_ as bool,
|
| 16 |
+
float32,
|
| 17 |
+
float64,
|
| 18 |
+
int8,
|
| 19 |
+
int16,
|
| 20 |
+
int32,
|
| 21 |
+
int64,
|
| 22 |
+
uint8,
|
| 23 |
+
uint16,
|
| 24 |
+
uint32,
|
| 25 |
+
uint64,
|
| 26 |
+
complex64,
|
| 27 |
+
complex128,
|
| 28 |
+
can_cast,
|
| 29 |
+
result_type,
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
from typing import TYPE_CHECKING
|
| 33 |
+
if TYPE_CHECKING:
|
| 34 |
+
from typing import Optional, Union
|
| 35 |
+
|
| 36 |
+
from ...common._typing import Device, Dtype, Array, NestedSequence, SupportsBufferProtocol
|
| 37 |
+
|
| 38 |
+
import dask.array as da
|
| 39 |
+
|
| 40 |
+
isdtype = get_xp(np)(_aliases.isdtype)
|
| 41 |
+
unstack = get_xp(da)(_aliases.unstack)
|
| 42 |
+
astype = _aliases.astype
|
| 43 |
+
|
| 44 |
+
# Common aliases
|
| 45 |
+
|
| 46 |
+
# This arange func is modified from the common one to
|
| 47 |
+
# not pass stop/step as keyword arguments, which will cause
|
| 48 |
+
# an error with dask
|
| 49 |
+
|
| 50 |
+
# TODO: delete the xp stuff, it shouldn't be necessary
|
| 51 |
+
def _dask_arange(
|
| 52 |
+
start: Union[int, float],
|
| 53 |
+
/,
|
| 54 |
+
stop: Optional[Union[int, float]] = None,
|
| 55 |
+
step: Union[int, float] = 1,
|
| 56 |
+
*,
|
| 57 |
+
xp,
|
| 58 |
+
dtype: Optional[Dtype] = None,
|
| 59 |
+
device: Optional[Device] = None,
|
| 60 |
+
**kwargs,
|
| 61 |
+
) -> Array:
|
| 62 |
+
_check_device(xp, device)
|
| 63 |
+
args = [start]
|
| 64 |
+
if stop is not None:
|
| 65 |
+
args.append(stop)
|
| 66 |
+
else:
|
| 67 |
+
# stop is None, so start is actually stop
|
| 68 |
+
# prepend the default value for start which is 0
|
| 69 |
+
args.insert(0, 0)
|
| 70 |
+
args.append(step)
|
| 71 |
+
return xp.arange(*args, dtype=dtype, **kwargs)
|
| 72 |
+
|
| 73 |
+
arange = get_xp(da)(_dask_arange)
|
| 74 |
+
eye = get_xp(da)(_aliases.eye)
|
| 75 |
+
|
| 76 |
+
linspace = get_xp(da)(_aliases.linspace)
|
| 77 |
+
eye = get_xp(da)(_aliases.eye)
|
| 78 |
+
UniqueAllResult = get_xp(da)(_aliases.UniqueAllResult)
|
| 79 |
+
UniqueCountsResult = get_xp(da)(_aliases.UniqueCountsResult)
|
| 80 |
+
UniqueInverseResult = get_xp(da)(_aliases.UniqueInverseResult)
|
| 81 |
+
unique_all = get_xp(da)(_aliases.unique_all)
|
| 82 |
+
unique_counts = get_xp(da)(_aliases.unique_counts)
|
| 83 |
+
unique_inverse = get_xp(da)(_aliases.unique_inverse)
|
| 84 |
+
unique_values = get_xp(da)(_aliases.unique_values)
|
| 85 |
+
permute_dims = get_xp(da)(_aliases.permute_dims)
|
| 86 |
+
std = get_xp(da)(_aliases.std)
|
| 87 |
+
var = get_xp(da)(_aliases.var)
|
| 88 |
+
cumulative_sum = get_xp(da)(_aliases.cumulative_sum)
|
| 89 |
+
empty = get_xp(da)(_aliases.empty)
|
| 90 |
+
empty_like = get_xp(da)(_aliases.empty_like)
|
| 91 |
+
full = get_xp(da)(_aliases.full)
|
| 92 |
+
full_like = get_xp(da)(_aliases.full_like)
|
| 93 |
+
ones = get_xp(da)(_aliases.ones)
|
| 94 |
+
ones_like = get_xp(da)(_aliases.ones_like)
|
| 95 |
+
zeros = get_xp(da)(_aliases.zeros)
|
| 96 |
+
zeros_like = get_xp(da)(_aliases.zeros_like)
|
| 97 |
+
reshape = get_xp(da)(_aliases.reshape)
|
| 98 |
+
matrix_transpose = get_xp(da)(_aliases.matrix_transpose)
|
| 99 |
+
vecdot = get_xp(da)(_aliases.vecdot)
|
| 100 |
+
|
| 101 |
+
nonzero = get_xp(da)(_aliases.nonzero)
|
| 102 |
+
ceil = get_xp(np)(_aliases.ceil)
|
| 103 |
+
floor = get_xp(np)(_aliases.floor)
|
| 104 |
+
trunc = get_xp(np)(_aliases.trunc)
|
| 105 |
+
matmul = get_xp(np)(_aliases.matmul)
|
| 106 |
+
tensordot = get_xp(np)(_aliases.tensordot)
|
| 107 |
+
sign = get_xp(np)(_aliases.sign)
|
| 108 |
+
|
| 109 |
+
# asarray also adds the copy keyword, which is not present in numpy 1.0.
|
| 110 |
+
def asarray(
|
| 111 |
+
obj: Union[
|
| 112 |
+
Array,
|
| 113 |
+
bool,
|
| 114 |
+
int,
|
| 115 |
+
float,
|
| 116 |
+
NestedSequence[bool | int | float],
|
| 117 |
+
SupportsBufferProtocol,
|
| 118 |
+
],
|
| 119 |
+
/,
|
| 120 |
+
*,
|
| 121 |
+
dtype: Optional[Dtype] = None,
|
| 122 |
+
device: Optional[Device] = None,
|
| 123 |
+
copy: "Optional[Union[bool, np._CopyMode]]" = None,
|
| 124 |
+
**kwargs,
|
| 125 |
+
) -> Array:
|
| 126 |
+
"""
|
| 127 |
+
Array API compatibility wrapper for asarray().
|
| 128 |
+
|
| 129 |
+
See the corresponding documentation in the array library and/or the array API
|
| 130 |
+
specification for more details.
|
| 131 |
+
"""
|
| 132 |
+
if copy is False:
|
| 133 |
+
# copy=False is not yet implemented in dask
|
| 134 |
+
raise NotImplementedError("copy=False is not yet implemented")
|
| 135 |
+
elif copy is True:
|
| 136 |
+
if isinstance(obj, da.Array) and dtype is None:
|
| 137 |
+
return obj.copy()
|
| 138 |
+
# Go through numpy, since dask copy is no-op by default
|
| 139 |
+
obj = np.array(obj, dtype=dtype, copy=True)
|
| 140 |
+
return da.array(obj, dtype=dtype)
|
| 141 |
+
else:
|
| 142 |
+
if not isinstance(obj, da.Array) or dtype is not None and obj.dtype != dtype:
|
| 143 |
+
obj = np.asarray(obj, dtype=dtype)
|
| 144 |
+
return da.from_array(obj)
|
| 145 |
+
return obj
|
| 146 |
+
|
| 147 |
+
return da.asarray(obj, dtype=dtype, **kwargs)
|
| 148 |
+
|
| 149 |
+
from dask.array import (
|
| 150 |
+
# Element wise aliases
|
| 151 |
+
arccos as acos,
|
| 152 |
+
arccosh as acosh,
|
| 153 |
+
arcsin as asin,
|
| 154 |
+
arcsinh as asinh,
|
| 155 |
+
arctan as atan,
|
| 156 |
+
arctan2 as atan2,
|
| 157 |
+
arctanh as atanh,
|
| 158 |
+
left_shift as bitwise_left_shift,
|
| 159 |
+
right_shift as bitwise_right_shift,
|
| 160 |
+
invert as bitwise_invert,
|
| 161 |
+
power as pow,
|
| 162 |
+
# Other
|
| 163 |
+
concatenate as concat,
|
| 164 |
+
)
|
| 165 |
+
|
| 166 |
+
# dask.array.clip does not work unless all three arguments are provided.
|
| 167 |
+
# Furthermore, the masking workaround in common._aliases.clip cannot work with
|
| 168 |
+
# dask (meaning uint64 promoting to float64 is going to just be unfixed for
|
| 169 |
+
# now).
|
| 170 |
+
@get_xp(da)
|
| 171 |
+
def clip(
|
| 172 |
+
x: Array,
|
| 173 |
+
/,
|
| 174 |
+
min: Optional[Union[int, float, Array]] = None,
|
| 175 |
+
max: Optional[Union[int, float, Array]] = None,
|
| 176 |
+
*,
|
| 177 |
+
xp,
|
| 178 |
+
) -> Array:
|
| 179 |
+
def _isscalar(a):
|
| 180 |
+
return isinstance(a, (int, float, type(None)))
|
| 181 |
+
min_shape = () if _isscalar(min) else min.shape
|
| 182 |
+
max_shape = () if _isscalar(max) else max.shape
|
| 183 |
+
|
| 184 |
+
# TODO: This won't handle dask unknown shapes
|
| 185 |
+
import numpy as np
|
| 186 |
+
result_shape = np.broadcast_shapes(x.shape, min_shape, max_shape)
|
| 187 |
+
|
| 188 |
+
if min is not None:
|
| 189 |
+
min = xp.broadcast_to(xp.asarray(min), result_shape)
|
| 190 |
+
if max is not None:
|
| 191 |
+
max = xp.broadcast_to(xp.asarray(max), result_shape)
|
| 192 |
+
|
| 193 |
+
if min is None and max is None:
|
| 194 |
+
return xp.positive(x)
|
| 195 |
+
|
| 196 |
+
if min is None:
|
| 197 |
+
return astype(xp.minimum(x, max), x.dtype)
|
| 198 |
+
if max is None:
|
| 199 |
+
return astype(xp.maximum(x, min), x.dtype)
|
| 200 |
+
|
| 201 |
+
return astype(xp.minimum(xp.maximum(x, min), max), x.dtype)
|
| 202 |
+
|
| 203 |
+
# exclude these from all since dask.array has no sorting functions
|
| 204 |
+
_da_unsupported = ['sort', 'argsort']
|
| 205 |
+
|
| 206 |
+
_common_aliases = [alias for alias in _aliases.__all__ if alias not in _da_unsupported]
|
| 207 |
+
|
| 208 |
+
__all__ = _common_aliases + ['__array_namespace_info__', 'asarray', 'acos',
|
| 209 |
+
'acosh', 'asin', 'asinh', 'atan', 'atan2',
|
| 210 |
+
'atanh', 'bitwise_left_shift', 'bitwise_invert',
|
| 211 |
+
'bitwise_right_shift', 'concat', 'pow', 'iinfo', 'finfo', 'can_cast',
|
| 212 |
+
'result_type', 'bool', 'float32', 'float64', 'int8', 'int16', 'int32', 'int64',
|
| 213 |
+
'uint8', 'uint16', 'uint32', 'uint64',
|
| 214 |
+
'complex64', 'complex128', 'iinfo', 'finfo',
|
| 215 |
+
'can_cast', 'result_type']
|
| 216 |
+
|
| 217 |
+
_all_ignore = ["get_xp", "da", "np"]
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/_info.py
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Array API Inspection namespace
|
| 3 |
+
|
| 4 |
+
This is the namespace for inspection functions as defined by the array API
|
| 5 |
+
standard. See
|
| 6 |
+
https://data-apis.org/array-api/latest/API_specification/inspection.html for
|
| 7 |
+
more details.
|
| 8 |
+
|
| 9 |
+
"""
|
| 10 |
+
from numpy import (
|
| 11 |
+
dtype,
|
| 12 |
+
bool_ as bool,
|
| 13 |
+
intp,
|
| 14 |
+
int8,
|
| 15 |
+
int16,
|
| 16 |
+
int32,
|
| 17 |
+
int64,
|
| 18 |
+
uint8,
|
| 19 |
+
uint16,
|
| 20 |
+
uint32,
|
| 21 |
+
uint64,
|
| 22 |
+
float32,
|
| 23 |
+
float64,
|
| 24 |
+
complex64,
|
| 25 |
+
complex128,
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
from ...common._helpers import _DASK_DEVICE
|
| 29 |
+
|
| 30 |
+
class __array_namespace_info__:
|
| 31 |
+
"""
|
| 32 |
+
Get the array API inspection namespace for Dask.
|
| 33 |
+
|
| 34 |
+
The array API inspection namespace defines the following functions:
|
| 35 |
+
|
| 36 |
+
- capabilities()
|
| 37 |
+
- default_device()
|
| 38 |
+
- default_dtypes()
|
| 39 |
+
- dtypes()
|
| 40 |
+
- devices()
|
| 41 |
+
|
| 42 |
+
See
|
| 43 |
+
https://data-apis.org/array-api/latest/API_specification/inspection.html
|
| 44 |
+
for more details.
|
| 45 |
+
|
| 46 |
+
Returns
|
| 47 |
+
-------
|
| 48 |
+
info : ModuleType
|
| 49 |
+
The array API inspection namespace for Dask.
|
| 50 |
+
|
| 51 |
+
Examples
|
| 52 |
+
--------
|
| 53 |
+
>>> info = np.__array_namespace_info__()
|
| 54 |
+
>>> info.default_dtypes()
|
| 55 |
+
{'real floating': dask.float64,
|
| 56 |
+
'complex floating': dask.complex128,
|
| 57 |
+
'integral': dask.int64,
|
| 58 |
+
'indexing': dask.int64}
|
| 59 |
+
|
| 60 |
+
"""
|
| 61 |
+
|
| 62 |
+
__module__ = 'dask.array'
|
| 63 |
+
|
| 64 |
+
def capabilities(self):
|
| 65 |
+
"""
|
| 66 |
+
Return a dictionary of array API library capabilities.
|
| 67 |
+
|
| 68 |
+
The resulting dictionary has the following keys:
|
| 69 |
+
|
| 70 |
+
- **"boolean indexing"**: boolean indicating whether an array library
|
| 71 |
+
supports boolean indexing. Always ``False`` for Dask.
|
| 72 |
+
|
| 73 |
+
- **"data-dependent shapes"**: boolean indicating whether an array
|
| 74 |
+
library supports data-dependent output shapes. Always ``False`` for
|
| 75 |
+
Dask.
|
| 76 |
+
|
| 77 |
+
See
|
| 78 |
+
https://data-apis.org/array-api/latest/API_specification/generated/array_api.info.capabilities.html
|
| 79 |
+
for more details.
|
| 80 |
+
|
| 81 |
+
See Also
|
| 82 |
+
--------
|
| 83 |
+
__array_namespace_info__.default_device,
|
| 84 |
+
__array_namespace_info__.default_dtypes,
|
| 85 |
+
__array_namespace_info__.dtypes,
|
| 86 |
+
__array_namespace_info__.devices
|
| 87 |
+
|
| 88 |
+
Returns
|
| 89 |
+
-------
|
| 90 |
+
capabilities : dict
|
| 91 |
+
A dictionary of array API library capabilities.
|
| 92 |
+
|
| 93 |
+
Examples
|
| 94 |
+
--------
|
| 95 |
+
>>> info = np.__array_namespace_info__()
|
| 96 |
+
>>> info.capabilities()
|
| 97 |
+
{'boolean indexing': True,
|
| 98 |
+
'data-dependent shapes': True}
|
| 99 |
+
|
| 100 |
+
"""
|
| 101 |
+
return {
|
| 102 |
+
"boolean indexing": False,
|
| 103 |
+
"data-dependent shapes": False,
|
| 104 |
+
# 'max rank' will be part of the 2024.12 standard
|
| 105 |
+
# "max rank": 64,
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
def default_device(self):
|
| 109 |
+
"""
|
| 110 |
+
The default device used for new Dask arrays.
|
| 111 |
+
|
| 112 |
+
For Dask, this always returns ``'cpu'``.
|
| 113 |
+
|
| 114 |
+
See Also
|
| 115 |
+
--------
|
| 116 |
+
__array_namespace_info__.capabilities,
|
| 117 |
+
__array_namespace_info__.default_dtypes,
|
| 118 |
+
__array_namespace_info__.dtypes,
|
| 119 |
+
__array_namespace_info__.devices
|
| 120 |
+
|
| 121 |
+
Returns
|
| 122 |
+
-------
|
| 123 |
+
device : str
|
| 124 |
+
The default device used for new Dask arrays.
|
| 125 |
+
|
| 126 |
+
Examples
|
| 127 |
+
--------
|
| 128 |
+
>>> info = np.__array_namespace_info__()
|
| 129 |
+
>>> info.default_device()
|
| 130 |
+
'cpu'
|
| 131 |
+
|
| 132 |
+
"""
|
| 133 |
+
return "cpu"
|
| 134 |
+
|
| 135 |
+
def default_dtypes(self, *, device=None):
|
| 136 |
+
"""
|
| 137 |
+
The default data types used for new Dask arrays.
|
| 138 |
+
|
| 139 |
+
For Dask, this always returns the following dictionary:
|
| 140 |
+
|
| 141 |
+
- **"real floating"**: ``numpy.float64``
|
| 142 |
+
- **"complex floating"**: ``numpy.complex128``
|
| 143 |
+
- **"integral"**: ``numpy.intp``
|
| 144 |
+
- **"indexing"**: ``numpy.intp``
|
| 145 |
+
|
| 146 |
+
Parameters
|
| 147 |
+
----------
|
| 148 |
+
device : str, optional
|
| 149 |
+
The device to get the default data types for.
|
| 150 |
+
|
| 151 |
+
Returns
|
| 152 |
+
-------
|
| 153 |
+
dtypes : dict
|
| 154 |
+
A dictionary describing the default data types used for new Dask
|
| 155 |
+
arrays.
|
| 156 |
+
|
| 157 |
+
See Also
|
| 158 |
+
--------
|
| 159 |
+
__array_namespace_info__.capabilities,
|
| 160 |
+
__array_namespace_info__.default_device,
|
| 161 |
+
__array_namespace_info__.dtypes,
|
| 162 |
+
__array_namespace_info__.devices
|
| 163 |
+
|
| 164 |
+
Examples
|
| 165 |
+
--------
|
| 166 |
+
>>> info = np.__array_namespace_info__()
|
| 167 |
+
>>> info.default_dtypes()
|
| 168 |
+
{'real floating': dask.float64,
|
| 169 |
+
'complex floating': dask.complex128,
|
| 170 |
+
'integral': dask.int64,
|
| 171 |
+
'indexing': dask.int64}
|
| 172 |
+
|
| 173 |
+
"""
|
| 174 |
+
if device not in ["cpu", _DASK_DEVICE, None]:
|
| 175 |
+
raise ValueError(
|
| 176 |
+
'Device not understood. Only "cpu" or _DASK_DEVICE is allowed, but received:'
|
| 177 |
+
f' {device}'
|
| 178 |
+
)
|
| 179 |
+
return {
|
| 180 |
+
"real floating": dtype(float64),
|
| 181 |
+
"complex floating": dtype(complex128),
|
| 182 |
+
"integral": dtype(intp),
|
| 183 |
+
"indexing": dtype(intp),
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
def dtypes(self, *, device=None, kind=None):
|
| 187 |
+
"""
|
| 188 |
+
The array API data types supported by Dask.
|
| 189 |
+
|
| 190 |
+
Note that this function only returns data types that are defined by
|
| 191 |
+
the array API.
|
| 192 |
+
|
| 193 |
+
Parameters
|
| 194 |
+
----------
|
| 195 |
+
device : str, optional
|
| 196 |
+
The device to get the data types for.
|
| 197 |
+
kind : str or tuple of str, optional
|
| 198 |
+
The kind of data types to return. If ``None``, all data types are
|
| 199 |
+
returned. If a string, only data types of that kind are returned.
|
| 200 |
+
If a tuple, a dictionary containing the union of the given kinds
|
| 201 |
+
is returned. The following kinds are supported:
|
| 202 |
+
|
| 203 |
+
- ``'bool'``: boolean data types (i.e., ``bool``).
|
| 204 |
+
- ``'signed integer'``: signed integer data types (i.e., ``int8``,
|
| 205 |
+
``int16``, ``int32``, ``int64``).
|
| 206 |
+
- ``'unsigned integer'``: unsigned integer data types (i.e.,
|
| 207 |
+
``uint8``, ``uint16``, ``uint32``, ``uint64``).
|
| 208 |
+
- ``'integral'``: integer data types. Shorthand for ``('signed
|
| 209 |
+
integer', 'unsigned integer')``.
|
| 210 |
+
- ``'real floating'``: real-valued floating-point data types
|
| 211 |
+
(i.e., ``float32``, ``float64``).
|
| 212 |
+
- ``'complex floating'``: complex floating-point data types (i.e.,
|
| 213 |
+
``complex64``, ``complex128``).
|
| 214 |
+
- ``'numeric'``: numeric data types. Shorthand for ``('integral',
|
| 215 |
+
'real floating', 'complex floating')``.
|
| 216 |
+
|
| 217 |
+
Returns
|
| 218 |
+
-------
|
| 219 |
+
dtypes : dict
|
| 220 |
+
A dictionary mapping the names of data types to the corresponding
|
| 221 |
+
Dask data types.
|
| 222 |
+
|
| 223 |
+
See Also
|
| 224 |
+
--------
|
| 225 |
+
__array_namespace_info__.capabilities,
|
| 226 |
+
__array_namespace_info__.default_device,
|
| 227 |
+
__array_namespace_info__.default_dtypes,
|
| 228 |
+
__array_namespace_info__.devices
|
| 229 |
+
|
| 230 |
+
Examples
|
| 231 |
+
--------
|
| 232 |
+
>>> info = np.__array_namespace_info__()
|
| 233 |
+
>>> info.dtypes(kind='signed integer')
|
| 234 |
+
{'int8': dask.int8,
|
| 235 |
+
'int16': dask.int16,
|
| 236 |
+
'int32': dask.int32,
|
| 237 |
+
'int64': dask.int64}
|
| 238 |
+
|
| 239 |
+
"""
|
| 240 |
+
if device not in ["cpu", _DASK_DEVICE, None]:
|
| 241 |
+
raise ValueError(
|
| 242 |
+
'Device not understood. Only "cpu" or _DASK_DEVICE is allowed, but received:'
|
| 243 |
+
f' {device}'
|
| 244 |
+
)
|
| 245 |
+
if kind is None:
|
| 246 |
+
return {
|
| 247 |
+
"bool": dtype(bool),
|
| 248 |
+
"int8": dtype(int8),
|
| 249 |
+
"int16": dtype(int16),
|
| 250 |
+
"int32": dtype(int32),
|
| 251 |
+
"int64": dtype(int64),
|
| 252 |
+
"uint8": dtype(uint8),
|
| 253 |
+
"uint16": dtype(uint16),
|
| 254 |
+
"uint32": dtype(uint32),
|
| 255 |
+
"uint64": dtype(uint64),
|
| 256 |
+
"float32": dtype(float32),
|
| 257 |
+
"float64": dtype(float64),
|
| 258 |
+
"complex64": dtype(complex64),
|
| 259 |
+
"complex128": dtype(complex128),
|
| 260 |
+
}
|
| 261 |
+
if kind == "bool":
|
| 262 |
+
return {"bool": bool}
|
| 263 |
+
if kind == "signed integer":
|
| 264 |
+
return {
|
| 265 |
+
"int8": dtype(int8),
|
| 266 |
+
"int16": dtype(int16),
|
| 267 |
+
"int32": dtype(int32),
|
| 268 |
+
"int64": dtype(int64),
|
| 269 |
+
}
|
| 270 |
+
if kind == "unsigned integer":
|
| 271 |
+
return {
|
| 272 |
+
"uint8": dtype(uint8),
|
| 273 |
+
"uint16": dtype(uint16),
|
| 274 |
+
"uint32": dtype(uint32),
|
| 275 |
+
"uint64": dtype(uint64),
|
| 276 |
+
}
|
| 277 |
+
if kind == "integral":
|
| 278 |
+
return {
|
| 279 |
+
"int8": dtype(int8),
|
| 280 |
+
"int16": dtype(int16),
|
| 281 |
+
"int32": dtype(int32),
|
| 282 |
+
"int64": dtype(int64),
|
| 283 |
+
"uint8": dtype(uint8),
|
| 284 |
+
"uint16": dtype(uint16),
|
| 285 |
+
"uint32": dtype(uint32),
|
| 286 |
+
"uint64": dtype(uint64),
|
| 287 |
+
}
|
| 288 |
+
if kind == "real floating":
|
| 289 |
+
return {
|
| 290 |
+
"float32": dtype(float32),
|
| 291 |
+
"float64": dtype(float64),
|
| 292 |
+
}
|
| 293 |
+
if kind == "complex floating":
|
| 294 |
+
return {
|
| 295 |
+
"complex64": dtype(complex64),
|
| 296 |
+
"complex128": dtype(complex128),
|
| 297 |
+
}
|
| 298 |
+
if kind == "numeric":
|
| 299 |
+
return {
|
| 300 |
+
"int8": dtype(int8),
|
| 301 |
+
"int16": dtype(int16),
|
| 302 |
+
"int32": dtype(int32),
|
| 303 |
+
"int64": dtype(int64),
|
| 304 |
+
"uint8": dtype(uint8),
|
| 305 |
+
"uint16": dtype(uint16),
|
| 306 |
+
"uint32": dtype(uint32),
|
| 307 |
+
"uint64": dtype(uint64),
|
| 308 |
+
"float32": dtype(float32),
|
| 309 |
+
"float64": dtype(float64),
|
| 310 |
+
"complex64": dtype(complex64),
|
| 311 |
+
"complex128": dtype(complex128),
|
| 312 |
+
}
|
| 313 |
+
if isinstance(kind, tuple):
|
| 314 |
+
res = {}
|
| 315 |
+
for k in kind:
|
| 316 |
+
res.update(self.dtypes(kind=k))
|
| 317 |
+
return res
|
| 318 |
+
raise ValueError(f"unsupported kind: {kind!r}")
|
| 319 |
+
|
| 320 |
+
def devices(self):
|
| 321 |
+
"""
|
| 322 |
+
The devices supported by Dask.
|
| 323 |
+
|
| 324 |
+
For Dask, this always returns ``['cpu', DASK_DEVICE]``.
|
| 325 |
+
|
| 326 |
+
Returns
|
| 327 |
+
-------
|
| 328 |
+
devices : list of str
|
| 329 |
+
The devices supported by Dask.
|
| 330 |
+
|
| 331 |
+
See Also
|
| 332 |
+
--------
|
| 333 |
+
__array_namespace_info__.capabilities,
|
| 334 |
+
__array_namespace_info__.default_device,
|
| 335 |
+
__array_namespace_info__.default_dtypes,
|
| 336 |
+
__array_namespace_info__.dtypes
|
| 337 |
+
|
| 338 |
+
Examples
|
| 339 |
+
--------
|
| 340 |
+
>>> info = np.__array_namespace_info__()
|
| 341 |
+
>>> info.devices()
|
| 342 |
+
['cpu', DASK_DEVICE]
|
| 343 |
+
|
| 344 |
+
"""
|
| 345 |
+
return ["cpu", _DASK_DEVICE]
|
mgm/lib/python3.10/site-packages/scipy/_lib/array_api_compat/dask/array/fft.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from dask.array.fft import * # noqa: F403
|
| 2 |
+
# dask.array.fft doesn't have __all__. If it is added, replace this with
|
| 3 |
+
#
|
| 4 |
+
# from dask.array.fft import __all__ as linalg_all
|
| 5 |
+
_n = {}
|
| 6 |
+
exec('from dask.array.fft import *', _n)
|
| 7 |
+
del _n['__builtins__']
|
| 8 |
+
fft_all = list(_n)
|
| 9 |
+
del _n
|
| 10 |
+
|
| 11 |
+
from ...common import _fft
|
| 12 |
+
from ..._internal import get_xp
|
| 13 |
+
|
| 14 |
+
import dask.array as da
|
| 15 |
+
|
| 16 |
+
fftfreq = get_xp(da)(_fft.fftfreq)
|
| 17 |
+
rfftfreq = get_xp(da)(_fft.rfftfreq)
|
| 18 |
+
|
| 19 |
+
__all__ = [elem for elem in fft_all if elem != "annotations"] + ["fftfreq", "rfftfreq"]
|
| 20 |
+
|
| 21 |
+
del get_xp
|
| 22 |
+
del da
|
| 23 |
+
del fft_all
|
| 24 |
+
del _fft
|