ZTWHHH commited on
Commit
ac5f941
·
verified ·
1 Parent(s): 22eaa51

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +13 -0
  2. valley/lib/python3.10/site-packages/numpy/_core/tests/__pycache__/test_numeric.cpython-310.pyc +3 -0
  3. valley/lib/python3.10/site-packages/numpy/_core/tests/__pycache__/test_regression.cpython-310.pyc +3 -0
  4. valley/lib/python3.10/site-packages/numpy/_core/tests/__pycache__/test_ufunc.cpython-310.pyc +3 -0
  5. valley/lib/python3.10/site-packages/numpy/_core/tests/__pycache__/test_umath.cpython-310.pyc +3 -0
  6. valley/lib/python3.10/site-packages/numpy/compat/__init__.py +29 -0
  7. valley/lib/python3.10/site-packages/numpy/compat/__pycache__/__init__.cpython-310.pyc +0 -0
  8. valley/lib/python3.10/site-packages/numpy/compat/__pycache__/py3k.cpython-310.pyc +0 -0
  9. valley/lib/python3.10/site-packages/numpy/compat/py3k.py +145 -0
  10. valley/lib/python3.10/site-packages/numpy/compat/tests/__init__.py +0 -0
  11. valley/lib/python3.10/site-packages/numpy/compat/tests/__pycache__/__init__.cpython-310.pyc +0 -0
  12. valley/lib/python3.10/site-packages/numpy/doc/__pycache__/ufuncs.cpython-310.pyc +0 -0
  13. valley/lib/python3.10/site-packages/numpy/doc/ufuncs.py +138 -0
  14. valley/lib/python3.10/site-packages/numpy/lib/__pycache__/_function_base_impl.cpython-310.pyc +3 -0
  15. valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/__init__.cpython-310.pyc +0 -0
  16. valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/_polybase.cpython-310.pyc +0 -0
  17. valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/chebyshev.cpython-310.pyc +0 -0
  18. valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/hermite.cpython-310.pyc +0 -0
  19. valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/hermite_e.cpython-310.pyc +0 -0
  20. valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/laguerre.cpython-310.pyc +0 -0
  21. valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/legendre.cpython-310.pyc +0 -0
  22. valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/polynomial.cpython-310.pyc +0 -0
  23. valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/polyutils.cpython-310.pyc +0 -0
  24. valley/lib/python3.10/site-packages/numpy/polynomial/tests/__pycache__/__init__.cpython-310.pyc +0 -0
  25. valley/lib/python3.10/site-packages/numpy/polynomial/tests/__pycache__/test_symbol.cpython-310.pyc +0 -0
  26. valley/lib/python3.10/site-packages/numpy/random/LICENSE.md +71 -0
  27. valley/lib/python3.10/site-packages/numpy/random/__init__.pxd +14 -0
  28. valley/lib/python3.10/site-packages/numpy/random/__init__.py +215 -0
  29. valley/lib/python3.10/site-packages/numpy/random/__init__.pyi +71 -0
  30. valley/lib/python3.10/site-packages/numpy/random/_bounded_integers.cpython-310-x86_64-linux-gnu.so +3 -0
  31. valley/lib/python3.10/site-packages/numpy/random/_bounded_integers.pxd +29 -0
  32. valley/lib/python3.10/site-packages/numpy/random/_common.cpython-310-x86_64-linux-gnu.so +3 -0
  33. valley/lib/python3.10/site-packages/numpy/random/_common.pxd +107 -0
  34. valley/lib/python3.10/site-packages/numpy/random/_examples/cffi/__pycache__/extending.cpython-310.pyc +0 -0
  35. valley/lib/python3.10/site-packages/numpy/random/_examples/cffi/__pycache__/parse.cpython-310.pyc +0 -0
  36. valley/lib/python3.10/site-packages/numpy/random/_examples/cffi/extending.py +40 -0
  37. valley/lib/python3.10/site-packages/numpy/random/_examples/cffi/parse.py +54 -0
  38. valley/lib/python3.10/site-packages/numpy/random/_examples/cython/extending.pyx +78 -0
  39. valley/lib/python3.10/site-packages/numpy/random/_examples/cython/extending_distributions.pyx +117 -0
  40. valley/lib/python3.10/site-packages/numpy/random/_examples/cython/meson.build +53 -0
  41. valley/lib/python3.10/site-packages/numpy/random/_examples/numba/__pycache__/extending.cpython-310.pyc +0 -0
  42. valley/lib/python3.10/site-packages/numpy/random/_examples/numba/__pycache__/extending_distributions.cpython-310.pyc +0 -0
  43. valley/lib/python3.10/site-packages/numpy/random/_examples/numba/extending.py +84 -0
  44. valley/lib/python3.10/site-packages/numpy/random/_examples/numba/extending_distributions.py +67 -0
  45. valley/lib/python3.10/site-packages/numpy/random/_generator.cpython-310-x86_64-linux-gnu.so +3 -0
  46. valley/lib/python3.10/site-packages/numpy/random/_generator.pyi +784 -0
  47. valley/lib/python3.10/site-packages/numpy/random/_mt19937.cpython-310-x86_64-linux-gnu.so +3 -0
  48. valley/lib/python3.10/site-packages/numpy/random/_mt19937.pyi +23 -0
  49. valley/lib/python3.10/site-packages/numpy/random/_pcg64.cpython-310-x86_64-linux-gnu.so +3 -0
  50. valley/lib/python3.10/site-packages/numpy/random/_pcg64.pyi +42 -0
.gitattributes CHANGED
@@ -625,3 +625,16 @@ valley/lib/python3.10/site-packages/numpy/_core/_simd.cpython-310-x86_64-linux-g
625
  valley/lib/python3.10/site-packages/numpy/_core/_multiarray_tests.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
626
  valley/lib/python3.10/site-packages/numpy/_core/_multiarray_umath.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
627
  valley/lib/python3.10/site-packages/numpy/linalg/__pycache__/_linalg.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
625
  valley/lib/python3.10/site-packages/numpy/_core/_multiarray_tests.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
626
  valley/lib/python3.10/site-packages/numpy/_core/_multiarray_umath.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
627
  valley/lib/python3.10/site-packages/numpy/linalg/__pycache__/_linalg.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
628
+ valley/lib/python3.10/site-packages/numpy/_core/tests/__pycache__/test_ufunc.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
629
+ valley/lib/python3.10/site-packages/numpy/lib/__pycache__/_function_base_impl.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
630
+ valley/lib/python3.10/site-packages/numpy/_core/tests/__pycache__/test_numeric.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
631
+ valley/lib/python3.10/site-packages/numpy/_core/tests/__pycache__/test_regression.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
632
+ valley/lib/python3.10/site-packages/numpy/random/_bounded_integers.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
633
+ valley/lib/python3.10/site-packages/numpy/random/_philox.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
634
+ valley/lib/python3.10/site-packages/numpy/random/_generator.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
635
+ valley/lib/python3.10/site-packages/numpy/_core/tests/__pycache__/test_umath.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
636
+ valley/lib/python3.10/site-packages/numpy/random/_pcg64.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
637
+ valley/lib/python3.10/site-packages/numpy/random/mtrand.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
638
+ valley/lib/python3.10/site-packages/numpy/random/_mt19937.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
639
+ valley/lib/python3.10/site-packages/numpy/random/_common.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
640
+ valley/lib/python3.10/site-packages/numpy/random/bit_generator.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
valley/lib/python3.10/site-packages/numpy/_core/tests/__pycache__/test_numeric.cpython-310.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b1f25d7d779331547279222b96e569b01dd55024deeaeadbdb7e868277c7a373
3
+ size 129266
valley/lib/python3.10/site-packages/numpy/_core/tests/__pycache__/test_regression.cpython-310.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d93c4f423a656ec3cfd41a896c6029bc7cbc5dbcbe439a7eb311576a887546ea
3
+ size 100837
valley/lib/python3.10/site-packages/numpy/_core/tests/__pycache__/test_ufunc.cpython-310.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae8d94b092b9f08b2fa9bfb0dffb538aaf8f45fbacad90edb952d48c9188afd3
3
+ size 105385
valley/lib/python3.10/site-packages/numpy/_core/tests/__pycache__/test_umath.cpython-310.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:90667d22ef1d926836ef217d8004a47a777d8d1b3c907d3435161f137453b718
3
+ size 161355
valley/lib/python3.10/site-packages/numpy/compat/__init__.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Compatibility module.
3
+
4
+ This module contains duplicated code from Python itself or 3rd party
5
+ extensions, which may be included for the following reasons:
6
+
7
+ * compatibility
8
+ * we may only need a small subset of the copied library/module
9
+
10
+ This module is deprecated since 1.26.0 and will be removed in future versions.
11
+
12
+ """
13
+
14
+ import warnings
15
+
16
+ from .._utils import _inspect
17
+ from .._utils._inspect import getargspec, formatargspec
18
+ from . import py3k
19
+ from .py3k import *
20
+
21
+ warnings.warn(
22
+ "`np.compat`, which was used during the Python 2 to 3 transition,"
23
+ " is deprecated since 1.26.0, and will be removed",
24
+ DeprecationWarning, stacklevel=2
25
+ )
26
+
27
+ __all__ = []
28
+ __all__.extend(_inspect.__all__)
29
+ __all__.extend(py3k.__all__)
valley/lib/python3.10/site-packages/numpy/compat/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (919 Bytes). View file
 
valley/lib/python3.10/site-packages/numpy/compat/__pycache__/py3k.cpython-310.pyc ADDED
Binary file (4.72 kB). View file
 
valley/lib/python3.10/site-packages/numpy/compat/py3k.py ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Python 3.X compatibility tools.
3
+
4
+ While this file was originally intended for Python 2 -> 3 transition,
5
+ it is now used to create a compatibility layer between different
6
+ minor versions of Python 3.
7
+
8
+ While the active version of numpy may not support a given version of python, we
9
+ allow downstream libraries to continue to use these shims for forward
10
+ compatibility with numpy while they transition their code to newer versions of
11
+ Python.
12
+ """
13
+ __all__ = ['bytes', 'asbytes', 'isfileobj', 'getexception', 'strchar',
14
+ 'unicode', 'asunicode', 'asbytes_nested', 'asunicode_nested',
15
+ 'asstr', 'open_latin1', 'long', 'basestring', 'sixu',
16
+ 'integer_types', 'is_pathlib_path', 'npy_load_module', 'Path',
17
+ 'pickle', 'contextlib_nullcontext', 'os_fspath', 'os_PathLike']
18
+
19
+ import sys
20
+ import os
21
+ from pathlib import Path
22
+ import io
23
+ try:
24
+ import pickle5 as pickle
25
+ except ImportError:
26
+ import pickle
27
+
28
+ long = int
29
+ integer_types = (int,)
30
+ basestring = str
31
+ unicode = str
32
+ bytes = bytes
33
+
34
+ def asunicode(s):
35
+ if isinstance(s, bytes):
36
+ return s.decode('latin1')
37
+ return str(s)
38
+
39
+ def asbytes(s):
40
+ if isinstance(s, bytes):
41
+ return s
42
+ return str(s).encode('latin1')
43
+
44
+ def asstr(s):
45
+ if isinstance(s, bytes):
46
+ return s.decode('latin1')
47
+ return str(s)
48
+
49
+ def isfileobj(f):
50
+ if not isinstance(f, (io.FileIO, io.BufferedReader, io.BufferedWriter)):
51
+ return False
52
+ try:
53
+ # BufferedReader/Writer may raise OSError when
54
+ # fetching `fileno()` (e.g. when wrapping BytesIO).
55
+ f.fileno()
56
+ return True
57
+ except OSError:
58
+ return False
59
+
60
+ def open_latin1(filename, mode='r'):
61
+ return open(filename, mode=mode, encoding='iso-8859-1')
62
+
63
+ def sixu(s):
64
+ return s
65
+
66
+ strchar = 'U'
67
+
68
+ def getexception():
69
+ return sys.exc_info()[1]
70
+
71
+ def asbytes_nested(x):
72
+ if hasattr(x, '__iter__') and not isinstance(x, (bytes, unicode)):
73
+ return [asbytes_nested(y) for y in x]
74
+ else:
75
+ return asbytes(x)
76
+
77
+ def asunicode_nested(x):
78
+ if hasattr(x, '__iter__') and not isinstance(x, (bytes, unicode)):
79
+ return [asunicode_nested(y) for y in x]
80
+ else:
81
+ return asunicode(x)
82
+
83
+ def is_pathlib_path(obj):
84
+ """
85
+ Check whether obj is a `pathlib.Path` object.
86
+
87
+ Prefer using ``isinstance(obj, os.PathLike)`` instead of this function.
88
+ """
89
+ return isinstance(obj, Path)
90
+
91
+ # from Python 3.7
92
+ class contextlib_nullcontext:
93
+ """Context manager that does no additional processing.
94
+
95
+ Used as a stand-in for a normal context manager, when a particular
96
+ block of code is only sometimes used with a normal context manager:
97
+
98
+ cm = optional_cm if condition else nullcontext()
99
+ with cm:
100
+ # Perform operation, using optional_cm if condition is True
101
+
102
+ .. note::
103
+ Prefer using `contextlib.nullcontext` instead of this context manager.
104
+ """
105
+
106
+ def __init__(self, enter_result=None):
107
+ self.enter_result = enter_result
108
+
109
+ def __enter__(self):
110
+ return self.enter_result
111
+
112
+ def __exit__(self, *excinfo):
113
+ pass
114
+
115
+
116
+ def npy_load_module(name, fn, info=None):
117
+ """
118
+ Load a module. Uses ``load_module`` which will be deprecated in python
119
+ 3.12. An alternative that uses ``exec_module`` is in
120
+ numpy.distutils.misc_util.exec_mod_from_location
121
+
122
+ .. versionadded:: 1.11.2
123
+
124
+ Parameters
125
+ ----------
126
+ name : str
127
+ Full module name.
128
+ fn : str
129
+ Path to module file.
130
+ info : tuple, optional
131
+ Only here for backward compatibility with Python 2.*.
132
+
133
+ Returns
134
+ -------
135
+ mod : module
136
+
137
+ """
138
+ # Explicitly lazy import this to avoid paying the cost
139
+ # of importing importlib at startup
140
+ from importlib.machinery import SourceFileLoader
141
+ return SourceFileLoader(name, fn).load_module()
142
+
143
+
144
+ os_fspath = os.fspath
145
+ os_PathLike = os.PathLike
valley/lib/python3.10/site-packages/numpy/compat/tests/__init__.py ADDED
File without changes
valley/lib/python3.10/site-packages/numpy/compat/tests/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (170 Bytes). View file
 
valley/lib/python3.10/site-packages/numpy/doc/__pycache__/ufuncs.cpython-310.pyc ADDED
Binary file (5.58 kB). View file
 
valley/lib/python3.10/site-packages/numpy/doc/ufuncs.py ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ ===================
3
+ Universal Functions
4
+ ===================
5
+
6
+ Ufuncs are, generally speaking, mathematical functions or operations that are
7
+ applied element-by-element to the contents of an array. That is, the result
8
+ in each output array element only depends on the value in the corresponding
9
+ input array (or arrays) and on no other array elements. NumPy comes with a
10
+ large suite of ufuncs, and scipy extends that suite substantially. The simplest
11
+ example is the addition operator: ::
12
+
13
+ >>> np.array([0,2,3,4]) + np.array([1,1,-1,2])
14
+ array([1, 3, 2, 6])
15
+
16
+ The ufunc module lists all the available ufuncs in numpy. Documentation on
17
+ the specific ufuncs may be found in those modules. This documentation is
18
+ intended to address the more general aspects of ufuncs common to most of
19
+ them. All of the ufuncs that make use of Python operators (e.g., +, -, etc.)
20
+ have equivalent functions defined (e.g. add() for +)
21
+
22
+ Type coercion
23
+ =============
24
+
25
+ What happens when a binary operator (e.g., +,-,\\*,/, etc) deals with arrays of
26
+ two different types? What is the type of the result? Typically, the result is
27
+ the higher of the two types. For example: ::
28
+
29
+ float32 + float64 -> float64
30
+ int8 + int32 -> int32
31
+ int16 + float32 -> float32
32
+ float32 + complex64 -> complex64
33
+
34
+ There are some less obvious cases generally involving mixes of types
35
+ (e.g. uints, ints and floats) where equal bit sizes for each are not
36
+ capable of saving all the information in a different type of equivalent
37
+ bit size. Some examples are int32 vs float32 or uint32 vs int32.
38
+ Generally, the result is the higher type of larger size than both
39
+ (if available). So: ::
40
+
41
+ int32 + float32 -> float64
42
+ uint32 + int32 -> int64
43
+
44
+ Finally, the type coercion behavior when expressions involve Python
45
+ scalars is different than that seen for arrays. Since Python has a
46
+ limited number of types, combining a Python int with a dtype=np.int8
47
+ array does not coerce to the higher type but instead, the type of the
48
+ array prevails. So the rules for Python scalars combined with arrays is
49
+ that the result will be that of the array equivalent the Python scalar
50
+ if the Python scalar is of a higher 'kind' than the array (e.g., float
51
+ vs. int), otherwise the resultant type will be that of the array.
52
+ For example: ::
53
+
54
+ Python int + int8 -> int8
55
+ Python float + int8 -> float64
56
+
57
+ ufunc methods
58
+ =============
59
+
60
+ Binary ufuncs support 4 methods.
61
+
62
+ **.reduce(arr)** applies the binary operator to elements of the array in
63
+ sequence. For example: ::
64
+
65
+ >>> np.add.reduce(np.arange(10)) # adds all elements of array
66
+ 45
67
+
68
+ For multidimensional arrays, the first dimension is reduced by default: ::
69
+
70
+ >>> np.add.reduce(np.arange(10).reshape(2,5))
71
+ array([ 5, 7, 9, 11, 13])
72
+
73
+ The axis keyword can be used to specify different axes to reduce: ::
74
+
75
+ >>> np.add.reduce(np.arange(10).reshape(2,5),axis=1)
76
+ array([10, 35])
77
+
78
+ **.accumulate(arr)** applies the binary operator and generates an
79
+ equivalently shaped array that includes the accumulated amount for each
80
+ element of the array. A couple examples: ::
81
+
82
+ >>> np.add.accumulate(np.arange(10))
83
+ array([ 0, 1, 3, 6, 10, 15, 21, 28, 36, 45])
84
+ >>> np.multiply.accumulate(np.arange(1,9))
85
+ array([ 1, 2, 6, 24, 120, 720, 5040, 40320])
86
+
87
+ The behavior for multidimensional arrays is the same as for .reduce(),
88
+ as is the use of the axis keyword).
89
+
90
+ **.reduceat(arr,indices)** allows one to apply reduce to selected parts
91
+ of an array. It is a difficult method to understand. See the documentation
92
+ at:
93
+
94
+ **.outer(arr1,arr2)** generates an outer operation on the two arrays arr1 and
95
+ arr2. It will work on multidimensional arrays (the shape of the result is
96
+ the concatenation of the two input shapes.: ::
97
+
98
+ >>> np.multiply.outer(np.arange(3),np.arange(4))
99
+ array([[0, 0, 0, 0],
100
+ [0, 1, 2, 3],
101
+ [0, 2, 4, 6]])
102
+
103
+ Output arguments
104
+ ================
105
+
106
+ All ufuncs accept an optional output array. The array must be of the expected
107
+ output shape. Beware that if the type of the output array is of a different
108
+ (and lower) type than the output result, the results may be silently truncated
109
+ or otherwise corrupted in the downcast to the lower type. This usage is useful
110
+ when one wants to avoid creating large temporary arrays and instead allows one
111
+ to reuse the same array memory repeatedly (at the expense of not being able to
112
+ use more convenient operator notation in expressions). Note that when the
113
+ output argument is used, the ufunc still returns a reference to the result.
114
+
115
+ >>> x = np.arange(2)
116
+ >>> np.add(np.arange(2, dtype=float), np.arange(2, dtype=float), x,
117
+ ... casting='unsafe')
118
+ array([0, 2])
119
+ >>> x
120
+ array([0, 2])
121
+
122
+ and & or as ufuncs
123
+ ==================
124
+
125
+ Invariably people try to use the python 'and' and 'or' as logical operators
126
+ (and quite understandably). But these operators do not behave as normal
127
+ operators since Python treats these quite differently. They cannot be
128
+ overloaded with array equivalents. Thus using 'and' or 'or' with an array
129
+ results in an error. There are two alternatives:
130
+
131
+ 1) use the ufunc functions logical_and() and logical_or().
132
+ 2) use the bitwise operators & and \\|. The drawback of these is that if
133
+ the arguments to these operators are not boolean arrays, the result is
134
+ likely incorrect. On the other hand, most usages of logical_and and
135
+ logical_or are with boolean arrays. As long as one is careful, this is
136
+ a convenient way to apply these operators.
137
+
138
+ """
valley/lib/python3.10/site-packages/numpy/lib/__pycache__/_function_base_impl.cpython-310.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0a94a990b8538ba282102f37a5288d26c5f19032de2cae9154920999322b329f
3
+ size 166337
valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (6.84 kB). View file
 
valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/_polybase.cpython-310.pyc ADDED
Binary file (36.9 kB). View file
 
valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/chebyshev.cpython-310.pyc ADDED
Binary file (62.4 kB). View file
 
valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/hermite.cpython-310.pyc ADDED
Binary file (54.7 kB). View file
 
valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/hermite_e.cpython-310.pyc ADDED
Binary file (52.3 kB). View file
 
valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/laguerre.cpython-310.pyc ADDED
Binary file (52.5 kB). View file
 
valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/legendre.cpython-310.pyc ADDED
Binary file (51 kB). View file
 
valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/polynomial.cpython-310.pyc ADDED
Binary file (52.3 kB). View file
 
valley/lib/python3.10/site-packages/numpy/polynomial/__pycache__/polyutils.cpython-310.pyc ADDED
Binary file (21.9 kB). View file
 
valley/lib/python3.10/site-packages/numpy/polynomial/tests/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (174 Bytes). View file
 
valley/lib/python3.10/site-packages/numpy/polynomial/tests/__pycache__/test_symbol.cpython-310.pyc ADDED
Binary file (8.39 kB). View file
 
valley/lib/python3.10/site-packages/numpy/random/LICENSE.md ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ **This software is dual-licensed under the The University of Illinois/NCSA
2
+ Open Source License (NCSA) and The 3-Clause BSD License**
3
+
4
+ # NCSA Open Source License
5
+ **Copyright (c) 2019 Kevin Sheppard. All rights reserved.**
6
+
7
+ Developed by: Kevin Sheppard (<kevin.sheppard@economics.ox.ac.uk>,
8
+ <kevin.k.sheppard@gmail.com>)
9
+ [http://www.kevinsheppard.com](http://www.kevinsheppard.com)
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
12
+ this software and associated documentation files (the "Software"), to deal with
13
+ the Software without restriction, including without limitation the rights to
14
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
15
+ of the Software, and to permit persons to whom the Software is furnished to do
16
+ so, subject to the following conditions:
17
+
18
+ Redistributions of source code must retain the above copyright notice, this
19
+ list of conditions and the following disclaimers.
20
+
21
+ Redistributions in binary form must reproduce the above copyright notice, this
22
+ list of conditions and the following disclaimers in the documentation and/or
23
+ other materials provided with the distribution.
24
+
25
+ Neither the names of Kevin Sheppard, nor the names of any contributors may be
26
+ used to endorse or promote products derived from this Software without specific
27
+ prior written permission.
28
+
29
+ **THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
+ CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH
35
+ THE SOFTWARE.**
36
+
37
+
38
+ # 3-Clause BSD License
39
+ **Copyright (c) 2019 Kevin Sheppard. All rights reserved.**
40
+
41
+ Redistribution and use in source and binary forms, with or without
42
+ modification, are permitted provided that the following conditions are met:
43
+
44
+ 1. Redistributions of source code must retain the above copyright notice,
45
+ this list of conditions and the following disclaimer.
46
+
47
+ 2. Redistributions in binary form must reproduce the above copyright notice,
48
+ this list of conditions and the following disclaimer in the documentation
49
+ and/or other materials provided with the distribution.
50
+
51
+ 3. Neither the name of the copyright holder nor the names of its contributors
52
+ may be used to endorse or promote products derived from this software
53
+ without specific prior written permission.
54
+
55
+ **THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
56
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
58
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
59
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
60
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
61
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
62
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
63
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
64
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
65
+ THE POSSIBILITY OF SUCH DAMAGE.**
66
+
67
+ # Components
68
+
69
+ Many parts of this module have been derived from original sources,
70
+ often the algorithm's designer. Component licenses are located with
71
+ the component code.
valley/lib/python3.10/site-packages/numpy/random/__init__.pxd ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cimport numpy as np
2
+ from libc.stdint cimport uint32_t, uint64_t
3
+
4
+ cdef extern from "numpy/random/bitgen.h":
5
+ struct bitgen:
6
+ void *state
7
+ uint64_t (*next_uint64)(void *st) nogil
8
+ uint32_t (*next_uint32)(void *st) nogil
9
+ double (*next_double)(void *st) nogil
10
+ uint64_t (*next_raw)(void *st) nogil
11
+
12
+ ctypedef bitgen bitgen_t
13
+
14
+ from numpy.random.bit_generator cimport BitGenerator, SeedSequence
valley/lib/python3.10/site-packages/numpy/random/__init__.py ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ ========================
3
+ Random Number Generation
4
+ ========================
5
+
6
+ Use ``default_rng()`` to create a `Generator` and call its methods.
7
+
8
+ =============== =========================================================
9
+ Generator
10
+ --------------- ---------------------------------------------------------
11
+ Generator Class implementing all of the random number distributions
12
+ default_rng Default constructor for ``Generator``
13
+ =============== =========================================================
14
+
15
+ ============================================= ===
16
+ BitGenerator Streams that work with Generator
17
+ --------------------------------------------- ---
18
+ MT19937
19
+ PCG64
20
+ PCG64DXSM
21
+ Philox
22
+ SFC64
23
+ ============================================= ===
24
+
25
+ ============================================= ===
26
+ Getting entropy to initialize a BitGenerator
27
+ --------------------------------------------- ---
28
+ SeedSequence
29
+ ============================================= ===
30
+
31
+
32
+ Legacy
33
+ ------
34
+
35
+ For backwards compatibility with previous versions of numpy before 1.17, the
36
+ various aliases to the global `RandomState` methods are left alone and do not
37
+ use the new `Generator` API.
38
+
39
+ ==================== =========================================================
40
+ Utility functions
41
+ -------------------- ---------------------------------------------------------
42
+ random Uniformly distributed floats over ``[0, 1)``
43
+ bytes Uniformly distributed random bytes.
44
+ permutation Randomly permute a sequence / generate a random sequence.
45
+ shuffle Randomly permute a sequence in place.
46
+ choice Random sample from 1-D array.
47
+ ==================== =========================================================
48
+
49
+ ==================== =========================================================
50
+ Compatibility
51
+ functions - removed
52
+ in the new API
53
+ -------------------- ---------------------------------------------------------
54
+ rand Uniformly distributed values.
55
+ randn Normally distributed values.
56
+ ranf Uniformly distributed floating point numbers.
57
+ random_integers Uniformly distributed integers in a given range.
58
+ (deprecated, use ``integers(..., closed=True)`` instead)
59
+ random_sample Alias for `random_sample`
60
+ randint Uniformly distributed integers in a given range
61
+ seed Seed the legacy random number generator.
62
+ ==================== =========================================================
63
+
64
+ ==================== =========================================================
65
+ Univariate
66
+ distributions
67
+ -------------------- ---------------------------------------------------------
68
+ beta Beta distribution over ``[0, 1]``.
69
+ binomial Binomial distribution.
70
+ chisquare :math:`\\chi^2` distribution.
71
+ exponential Exponential distribution.
72
+ f F (Fisher-Snedecor) distribution.
73
+ gamma Gamma distribution.
74
+ geometric Geometric distribution.
75
+ gumbel Gumbel distribution.
76
+ hypergeometric Hypergeometric distribution.
77
+ laplace Laplace distribution.
78
+ logistic Logistic distribution.
79
+ lognormal Log-normal distribution.
80
+ logseries Logarithmic series distribution.
81
+ negative_binomial Negative binomial distribution.
82
+ noncentral_chisquare Non-central chi-square distribution.
83
+ noncentral_f Non-central F distribution.
84
+ normal Normal / Gaussian distribution.
85
+ pareto Pareto distribution.
86
+ poisson Poisson distribution.
87
+ power Power distribution.
88
+ rayleigh Rayleigh distribution.
89
+ triangular Triangular distribution.
90
+ uniform Uniform distribution.
91
+ vonmises Von Mises circular distribution.
92
+ wald Wald (inverse Gaussian) distribution.
93
+ weibull Weibull distribution.
94
+ zipf Zipf's distribution over ranked data.
95
+ ==================== =========================================================
96
+
97
+ ==================== ==========================================================
98
+ Multivariate
99
+ distributions
100
+ -------------------- ----------------------------------------------------------
101
+ dirichlet Multivariate generalization of Beta distribution.
102
+ multinomial Multivariate generalization of the binomial distribution.
103
+ multivariate_normal Multivariate generalization of the normal distribution.
104
+ ==================== ==========================================================
105
+
106
+ ==================== =========================================================
107
+ Standard
108
+ distributions
109
+ -------------------- ---------------------------------------------------------
110
+ standard_cauchy Standard Cauchy-Lorentz distribution.
111
+ standard_exponential Standard exponential distribution.
112
+ standard_gamma Standard Gamma distribution.
113
+ standard_normal Standard normal distribution.
114
+ standard_t Standard Student's t-distribution.
115
+ ==================== =========================================================
116
+
117
+ ==================== =========================================================
118
+ Internal functions
119
+ -------------------- ---------------------------------------------------------
120
+ get_state Get tuple representing internal state of generator.
121
+ set_state Set state of generator.
122
+ ==================== =========================================================
123
+
124
+
125
+ """
126
+ __all__ = [
127
+ 'beta',
128
+ 'binomial',
129
+ 'bytes',
130
+ 'chisquare',
131
+ 'choice',
132
+ 'dirichlet',
133
+ 'exponential',
134
+ 'f',
135
+ 'gamma',
136
+ 'geometric',
137
+ 'get_state',
138
+ 'gumbel',
139
+ 'hypergeometric',
140
+ 'laplace',
141
+ 'logistic',
142
+ 'lognormal',
143
+ 'logseries',
144
+ 'multinomial',
145
+ 'multivariate_normal',
146
+ 'negative_binomial',
147
+ 'noncentral_chisquare',
148
+ 'noncentral_f',
149
+ 'normal',
150
+ 'pareto',
151
+ 'permutation',
152
+ 'poisson',
153
+ 'power',
154
+ 'rand',
155
+ 'randint',
156
+ 'randn',
157
+ 'random',
158
+ 'random_integers',
159
+ 'random_sample',
160
+ 'ranf',
161
+ 'rayleigh',
162
+ 'sample',
163
+ 'seed',
164
+ 'set_state',
165
+ 'shuffle',
166
+ 'standard_cauchy',
167
+ 'standard_exponential',
168
+ 'standard_gamma',
169
+ 'standard_normal',
170
+ 'standard_t',
171
+ 'triangular',
172
+ 'uniform',
173
+ 'vonmises',
174
+ 'wald',
175
+ 'weibull',
176
+ 'zipf',
177
+ ]
178
+
179
+ # add these for module-freeze analysis (like PyInstaller)
180
+ from . import _pickle
181
+ from . import _common
182
+ from . import _bounded_integers
183
+
184
+ from ._generator import Generator, default_rng
185
+ from .bit_generator import SeedSequence, BitGenerator
186
+ from ._mt19937 import MT19937
187
+ from ._pcg64 import PCG64, PCG64DXSM
188
+ from ._philox import Philox
189
+ from ._sfc64 import SFC64
190
+ from .mtrand import *
191
+
192
+ __all__ += ['Generator', 'RandomState', 'SeedSequence', 'MT19937',
193
+ 'Philox', 'PCG64', 'PCG64DXSM', 'SFC64', 'default_rng',
194
+ 'BitGenerator']
195
+
196
+
197
+ def __RandomState_ctor():
198
+ """Return a RandomState instance.
199
+
200
+ This function exists solely to assist (un)pickling.
201
+
202
+ Note that the state of the RandomState returned here is irrelevant, as this
203
+ function's entire purpose is to return a newly allocated RandomState whose
204
+ state pickle can set. Consequently the RandomState returned by this function
205
+ is a freshly allocated copy with a seed=0.
206
+
207
+ See https://github.com/numpy/numpy/issues/4763 for a detailed discussion
208
+
209
+ """
210
+ return RandomState(seed=0)
211
+
212
+
213
+ from numpy._pytesttester import PytestTester
214
+ test = PytestTester(__name__)
215
+ del PytestTester
valley/lib/python3.10/site-packages/numpy/random/__init__.pyi ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ test: PytestTester
valley/lib/python3.10/site-packages/numpy/random/_bounded_integers.cpython-310-x86_64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a886f1f17c0fb7b96d4420379cfad0c753810a76314f048fbb3d6808f2850591
3
+ size 370808
valley/lib/python3.10/site-packages/numpy/random/_bounded_integers.pxd ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from libc.stdint cimport (uint8_t, uint16_t, uint32_t, uint64_t,
2
+ int8_t, int16_t, int32_t, int64_t, intptr_t)
3
+ import numpy as np
4
+ cimport numpy as np
5
+ ctypedef np.npy_bool bool_t
6
+
7
+ from numpy.random cimport bitgen_t
8
+
9
+ cdef inline uint64_t _gen_mask(uint64_t max_val) noexcept nogil:
10
+ """Mask generator for use in bounded random numbers"""
11
+ # Smallest bit mask >= max
12
+ cdef uint64_t mask = max_val
13
+ mask |= mask >> 1
14
+ mask |= mask >> 2
15
+ mask |= mask >> 4
16
+ mask |= mask >> 8
17
+ mask |= mask >> 16
18
+ mask |= mask >> 32
19
+ return mask
20
+
21
+ cdef object _rand_uint64(object low, object high, object size, bint use_masked, bint closed, bitgen_t *state, object lock)
22
+ cdef object _rand_uint32(object low, object high, object size, bint use_masked, bint closed, bitgen_t *state, object lock)
23
+ cdef object _rand_uint16(object low, object high, object size, bint use_masked, bint closed, bitgen_t *state, object lock)
24
+ cdef object _rand_uint8(object low, object high, object size, bint use_masked, bint closed, bitgen_t *state, object lock)
25
+ cdef object _rand_bool(object low, object high, object size, bint use_masked, bint closed, bitgen_t *state, object lock)
26
+ cdef object _rand_int64(object low, object high, object size, bint use_masked, bint closed, bitgen_t *state, object lock)
27
+ cdef object _rand_int32(object low, object high, object size, bint use_masked, bint closed, bitgen_t *state, object lock)
28
+ cdef object _rand_int16(object low, object high, object size, bint use_masked, bint closed, bitgen_t *state, object lock)
29
+ cdef object _rand_int8(object low, object high, object size, bint use_masked, bint closed, bitgen_t *state, object lock)
valley/lib/python3.10/site-packages/numpy/random/_common.cpython-310-x86_64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:07755504737ffcfcad3d112b1ab91485919239d05cd86c71d107b77cadabc82d
3
+ size 276560
valley/lib/python3.10/site-packages/numpy/random/_common.pxd ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #cython: language_level=3
2
+
3
+ from libc.stdint cimport uint32_t, uint64_t, int32_t, int64_t
4
+
5
+ import numpy as np
6
+ cimport numpy as np
7
+
8
+ from numpy.random cimport bitgen_t
9
+
10
+ cdef double POISSON_LAM_MAX
11
+ cdef double LEGACY_POISSON_LAM_MAX
12
+ cdef uint64_t MAXSIZE
13
+
14
+ cdef enum ConstraintType:
15
+ CONS_NONE
16
+ CONS_NON_NEGATIVE
17
+ CONS_POSITIVE
18
+ CONS_POSITIVE_NOT_NAN
19
+ CONS_BOUNDED_0_1
20
+ CONS_BOUNDED_GT_0_1
21
+ CONS_BOUNDED_LT_0_1
22
+ CONS_GT_1
23
+ CONS_GTE_1
24
+ CONS_POISSON
25
+ LEGACY_CONS_POISSON
26
+ LEGACY_CONS_NON_NEGATIVE_INBOUNDS_LONG
27
+
28
+ ctypedef ConstraintType constraint_type
29
+
30
+ cdef object benchmark(bitgen_t *bitgen, object lock, Py_ssize_t cnt, object method)
31
+ cdef object random_raw(bitgen_t *bitgen, object lock, object size, object output)
32
+ cdef object prepare_cffi(bitgen_t *bitgen)
33
+ cdef object prepare_ctypes(bitgen_t *bitgen)
34
+ cdef int check_constraint(double val, object name, constraint_type cons) except -1
35
+ cdef int check_array_constraint(np.ndarray val, object name, constraint_type cons) except -1
36
+
37
+ cdef extern from "include/aligned_malloc.h":
38
+ cdef void *PyArray_realloc_aligned(void *p, size_t n)
39
+ cdef void *PyArray_malloc_aligned(size_t n)
40
+ cdef void *PyArray_calloc_aligned(size_t n, size_t s)
41
+ cdef void PyArray_free_aligned(void *p)
42
+
43
+ ctypedef void (*random_double_fill)(bitgen_t *state, np.npy_intp count, double* out) noexcept nogil
44
+ ctypedef double (*random_double_0)(void *state) noexcept nogil
45
+ ctypedef double (*random_double_1)(void *state, double a) noexcept nogil
46
+ ctypedef double (*random_double_2)(void *state, double a, double b) noexcept nogil
47
+ ctypedef double (*random_double_3)(void *state, double a, double b, double c) noexcept nogil
48
+
49
+ ctypedef void (*random_float_fill)(bitgen_t *state, np.npy_intp count, float* out) noexcept nogil
50
+ ctypedef float (*random_float_0)(bitgen_t *state) noexcept nogil
51
+ ctypedef float (*random_float_1)(bitgen_t *state, float a) noexcept nogil
52
+
53
+ ctypedef int64_t (*random_uint_0)(void *state) noexcept nogil
54
+ ctypedef int64_t (*random_uint_d)(void *state, double a) noexcept nogil
55
+ ctypedef int64_t (*random_uint_dd)(void *state, double a, double b) noexcept nogil
56
+ ctypedef int64_t (*random_uint_di)(void *state, double a, uint64_t b) noexcept nogil
57
+ ctypedef int64_t (*random_uint_i)(void *state, int64_t a) noexcept nogil
58
+ ctypedef int64_t (*random_uint_iii)(void *state, int64_t a, int64_t b, int64_t c) noexcept nogil
59
+
60
+ ctypedef uint32_t (*random_uint_0_32)(bitgen_t *state) noexcept nogil
61
+ ctypedef uint32_t (*random_uint_1_i_32)(bitgen_t *state, uint32_t a) noexcept nogil
62
+
63
+ ctypedef int32_t (*random_int_2_i_32)(bitgen_t *state, int32_t a, int32_t b) noexcept nogil
64
+ ctypedef int64_t (*random_int_2_i)(bitgen_t *state, int64_t a, int64_t b) noexcept nogil
65
+
66
+ cdef double kahan_sum(double *darr, np.npy_intp n) noexcept
67
+
68
+ cdef inline double uint64_to_double(uint64_t rnd) noexcept nogil:
69
+ return (rnd >> 11) * (1.0 / 9007199254740992.0)
70
+
71
+ cdef object double_fill(void *func, bitgen_t *state, object size, object lock, object out)
72
+
73
+ cdef object float_fill(void *func, bitgen_t *state, object size, object lock, object out)
74
+
75
+ cdef object float_fill_from_double(void *func, bitgen_t *state, object size, object lock, object out)
76
+
77
+ cdef object wrap_int(object val, object bits)
78
+
79
+ cdef np.ndarray int_to_array(object value, object name, object bits, object uint_size)
80
+
81
+ cdef validate_output_shape(iter_shape, np.ndarray output)
82
+
83
+ cdef object cont(void *func, void *state, object size, object lock, int narg,
84
+ object a, object a_name, constraint_type a_constraint,
85
+ object b, object b_name, constraint_type b_constraint,
86
+ object c, object c_name, constraint_type c_constraint,
87
+ object out)
88
+
89
+ cdef object disc(void *func, void *state, object size, object lock,
90
+ int narg_double, int narg_int64,
91
+ object a, object a_name, constraint_type a_constraint,
92
+ object b, object b_name, constraint_type b_constraint,
93
+ object c, object c_name, constraint_type c_constraint)
94
+
95
+ cdef object cont_f(void *func, bitgen_t *state, object size, object lock,
96
+ object a, object a_name, constraint_type a_constraint,
97
+ object out)
98
+
99
+ cdef object cont_broadcast_3(void *func, void *state, object size, object lock,
100
+ np.ndarray a_arr, object a_name, constraint_type a_constraint,
101
+ np.ndarray b_arr, object b_name, constraint_type b_constraint,
102
+ np.ndarray c_arr, object c_name, constraint_type c_constraint)
103
+
104
+ cdef object discrete_broadcast_iii(void *func, void *state, object size, object lock,
105
+ np.ndarray a_arr, object a_name, constraint_type a_constraint,
106
+ np.ndarray b_arr, object b_name, constraint_type b_constraint,
107
+ np.ndarray c_arr, object c_name, constraint_type c_constraint)
valley/lib/python3.10/site-packages/numpy/random/_examples/cffi/__pycache__/extending.cpython-310.pyc ADDED
Binary file (927 Bytes). View file
 
valley/lib/python3.10/site-packages/numpy/random/_examples/cffi/__pycache__/parse.cpython-310.pyc ADDED
Binary file (1.18 kB). View file
 
valley/lib/python3.10/site-packages/numpy/random/_examples/cffi/extending.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Use cffi to access any of the underlying C functions from distributions.h
3
+ """
4
+ import os
5
+ import numpy as np
6
+ import cffi
7
+ from .parse import parse_distributions_h
8
+ ffi = cffi.FFI()
9
+
10
+ inc_dir = os.path.join(np.get_include(), 'numpy')
11
+
12
+ # Basic numpy types
13
+ ffi.cdef('''
14
+ typedef intptr_t npy_intp;
15
+ typedef unsigned char npy_bool;
16
+
17
+ ''')
18
+
19
+ parse_distributions_h(ffi, inc_dir)
20
+
21
+ lib = ffi.dlopen(np.random._generator.__file__)
22
+
23
+ # Compare the distributions.h random_standard_normal_fill to
24
+ # Generator.standard_random
25
+ bit_gen = np.random.PCG64()
26
+ rng = np.random.Generator(bit_gen)
27
+ state = bit_gen.state
28
+
29
+ interface = rng.bit_generator.cffi
30
+ n = 100
31
+ vals_cffi = ffi.new('double[%d]' % n)
32
+ lib.random_standard_normal_fill(interface.bit_generator, n, vals_cffi)
33
+
34
+ # reset the state
35
+ bit_gen.state = state
36
+
37
+ vals = rng.standard_normal(n)
38
+
39
+ for i in range(n):
40
+ assert vals[i] == vals_cffi[i]
valley/lib/python3.10/site-packages/numpy/random/_examples/cffi/parse.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+
4
+ def parse_distributions_h(ffi, inc_dir):
5
+ """
6
+ Parse distributions.h located in inc_dir for CFFI, filling in the ffi.cdef
7
+
8
+ Read the function declarations without the "#define ..." macros that will
9
+ be filled in when loading the library.
10
+ """
11
+
12
+ with open(os.path.join(inc_dir, 'random', 'bitgen.h')) as fid:
13
+ s = []
14
+ for line in fid:
15
+ # massage the include file
16
+ if line.strip().startswith('#'):
17
+ continue
18
+ s.append(line)
19
+ ffi.cdef('\n'.join(s))
20
+
21
+ with open(os.path.join(inc_dir, 'random', 'distributions.h')) as fid:
22
+ s = []
23
+ in_skip = 0
24
+ ignoring = False
25
+ for line in fid:
26
+ # check for and remove extern "C" guards
27
+ if ignoring:
28
+ if line.strip().startswith('#endif'):
29
+ ignoring = False
30
+ continue
31
+ if line.strip().startswith('#ifdef __cplusplus'):
32
+ ignoring = True
33
+
34
+ # massage the include file
35
+ if line.strip().startswith('#'):
36
+ continue
37
+
38
+ # skip any inlined function definition
39
+ # which starts with 'static inline xxx(...) {'
40
+ # and ends with a closing '}'
41
+ if line.strip().startswith('static inline'):
42
+ in_skip += line.count('{')
43
+ continue
44
+ elif in_skip > 0:
45
+ in_skip += line.count('{')
46
+ in_skip -= line.count('}')
47
+ continue
48
+
49
+ # replace defines with their value or remove them
50
+ line = line.replace('DECLDIR', '')
51
+ line = line.replace('RAND_INT_TYPE', 'int64_t')
52
+ s.append(line)
53
+ ffi.cdef('\n'.join(s))
54
+
valley/lib/python3.10/site-packages/numpy/random/_examples/cython/extending.pyx ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ #cython: language_level=3
3
+
4
+ from libc.stdint cimport uint32_t
5
+ from cpython.pycapsule cimport PyCapsule_IsValid, PyCapsule_GetPointer
6
+
7
+ import numpy as np
8
+ cimport numpy as np
9
+ cimport cython
10
+
11
+ from numpy.random cimport bitgen_t
12
+ from numpy.random import PCG64
13
+
14
+ np.import_array()
15
+
16
+
17
+ @cython.boundscheck(False)
18
+ @cython.wraparound(False)
19
+ def uniform_mean(Py_ssize_t n):
20
+ cdef Py_ssize_t i
21
+ cdef bitgen_t *rng
22
+ cdef const char *capsule_name = "BitGenerator"
23
+ cdef double[::1] random_values
24
+ cdef np.ndarray randoms
25
+
26
+ x = PCG64()
27
+ capsule = x.capsule
28
+ if not PyCapsule_IsValid(capsule, capsule_name):
29
+ raise ValueError("Invalid pointer to anon_func_state")
30
+ rng = <bitgen_t *> PyCapsule_GetPointer(capsule, capsule_name)
31
+ random_values = np.empty(n)
32
+ # Best practice is to acquire the lock whenever generating random values.
33
+ # This prevents other threads from modifying the state. Acquiring the lock
34
+ # is only necessary if the GIL is also released, as in this example.
35
+ with x.lock, nogil:
36
+ for i in range(n):
37
+ random_values[i] = rng.next_double(rng.state)
38
+ randoms = np.asarray(random_values)
39
+ return randoms.mean()
40
+
41
+
42
+ # This function is declared nogil so it can be used without the GIL below
43
+ cdef uint32_t bounded_uint(uint32_t lb, uint32_t ub, bitgen_t *rng) nogil:
44
+ cdef uint32_t mask, delta, val
45
+ mask = delta = ub - lb
46
+ mask |= mask >> 1
47
+ mask |= mask >> 2
48
+ mask |= mask >> 4
49
+ mask |= mask >> 8
50
+ mask |= mask >> 16
51
+
52
+ val = rng.next_uint32(rng.state) & mask
53
+ while val > delta:
54
+ val = rng.next_uint32(rng.state) & mask
55
+
56
+ return lb + val
57
+
58
+
59
+ @cython.boundscheck(False)
60
+ @cython.wraparound(False)
61
+ def bounded_uints(uint32_t lb, uint32_t ub, Py_ssize_t n):
62
+ cdef Py_ssize_t i
63
+ cdef bitgen_t *rng
64
+ cdef uint32_t[::1] out
65
+ cdef const char *capsule_name = "BitGenerator"
66
+
67
+ x = PCG64()
68
+ out = np.empty(n, dtype=np.uint32)
69
+ capsule = x.capsule
70
+
71
+ if not PyCapsule_IsValid(capsule, capsule_name):
72
+ raise ValueError("Invalid pointer to anon_func_state")
73
+ rng = <bitgen_t *>PyCapsule_GetPointer(capsule, capsule_name)
74
+
75
+ with x.lock, nogil:
76
+ for i in range(n):
77
+ out[i] = bounded_uint(lb, ub, rng)
78
+ return np.asarray(out)
valley/lib/python3.10/site-packages/numpy/random/_examples/cython/extending_distributions.pyx ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ #cython: language_level=3
3
+ """
4
+ This file shows how the to use a BitGenerator to create a distribution.
5
+ """
6
+ import numpy as np
7
+ cimport numpy as np
8
+ cimport cython
9
+ from cpython.pycapsule cimport PyCapsule_IsValid, PyCapsule_GetPointer
10
+ from libc.stdint cimport uint16_t, uint64_t
11
+ from numpy.random cimport bitgen_t
12
+ from numpy.random import PCG64
13
+ from numpy.random.c_distributions cimport (
14
+ random_standard_uniform_fill, random_standard_uniform_fill_f)
15
+
16
+
17
+ @cython.boundscheck(False)
18
+ @cython.wraparound(False)
19
+ def uniforms(Py_ssize_t n):
20
+ """
21
+ Create an array of `n` uniformly distributed doubles.
22
+ A 'real' distribution would want to process the values into
23
+ some non-uniform distribution
24
+ """
25
+ cdef Py_ssize_t i
26
+ cdef bitgen_t *rng
27
+ cdef const char *capsule_name = "BitGenerator"
28
+ cdef double[::1] random_values
29
+
30
+ x = PCG64()
31
+ capsule = x.capsule
32
+ # Optional check that the capsule if from a BitGenerator
33
+ if not PyCapsule_IsValid(capsule, capsule_name):
34
+ raise ValueError("Invalid pointer to anon_func_state")
35
+ # Cast the pointer
36
+ rng = <bitgen_t *> PyCapsule_GetPointer(capsule, capsule_name)
37
+ random_values = np.empty(n, dtype='float64')
38
+ with x.lock, nogil:
39
+ for i in range(n):
40
+ # Call the function
41
+ random_values[i] = rng.next_double(rng.state)
42
+ randoms = np.asarray(random_values)
43
+
44
+ return randoms
45
+
46
+ # cython example 2
47
+ @cython.boundscheck(False)
48
+ @cython.wraparound(False)
49
+ def uint10_uniforms(Py_ssize_t n):
50
+ """Uniform 10 bit integers stored as 16-bit unsigned integers"""
51
+ cdef Py_ssize_t i
52
+ cdef bitgen_t *rng
53
+ cdef const char *capsule_name = "BitGenerator"
54
+ cdef uint16_t[::1] random_values
55
+ cdef int bits_remaining
56
+ cdef int width = 10
57
+ cdef uint64_t buff, mask = 0x3FF
58
+
59
+ x = PCG64()
60
+ capsule = x.capsule
61
+ if not PyCapsule_IsValid(capsule, capsule_name):
62
+ raise ValueError("Invalid pointer to anon_func_state")
63
+ rng = <bitgen_t *> PyCapsule_GetPointer(capsule, capsule_name)
64
+ random_values = np.empty(n, dtype='uint16')
65
+ # Best practice is to release GIL and acquire the lock
66
+ bits_remaining = 0
67
+ with x.lock, nogil:
68
+ for i in range(n):
69
+ if bits_remaining < width:
70
+ buff = rng.next_uint64(rng.state)
71
+ random_values[i] = buff & mask
72
+ buff >>= width
73
+
74
+ randoms = np.asarray(random_values)
75
+ return randoms
76
+
77
+ # cython example 3
78
+ def uniforms_ex(bit_generator, Py_ssize_t n, dtype=np.float64):
79
+ """
80
+ Create an array of `n` uniformly distributed doubles via a "fill" function.
81
+
82
+ A 'real' distribution would want to process the values into
83
+ some non-uniform distribution
84
+
85
+ Parameters
86
+ ----------
87
+ bit_generator: BitGenerator instance
88
+ n: int
89
+ Output vector length
90
+ dtype: {str, dtype}, optional
91
+ Desired dtype, either 'd' (or 'float64') or 'f' (or 'float32'). The
92
+ default dtype value is 'd'
93
+ """
94
+ cdef Py_ssize_t i
95
+ cdef bitgen_t *rng
96
+ cdef const char *capsule_name = "BitGenerator"
97
+ cdef np.ndarray randoms
98
+
99
+ capsule = bit_generator.capsule
100
+ # Optional check that the capsule if from a BitGenerator
101
+ if not PyCapsule_IsValid(capsule, capsule_name):
102
+ raise ValueError("Invalid pointer to anon_func_state")
103
+ # Cast the pointer
104
+ rng = <bitgen_t *> PyCapsule_GetPointer(capsule, capsule_name)
105
+
106
+ _dtype = np.dtype(dtype)
107
+ randoms = np.empty(n, dtype=_dtype)
108
+ if _dtype == np.float32:
109
+ with bit_generator.lock:
110
+ random_standard_uniform_fill_f(rng, n, <float*>np.PyArray_DATA(randoms))
111
+ elif _dtype == np.float64:
112
+ with bit_generator.lock:
113
+ random_standard_uniform_fill(rng, n, <double*>np.PyArray_DATA(randoms))
114
+ else:
115
+ raise TypeError('Unsupported dtype %r for random' % _dtype)
116
+ return randoms
117
+
valley/lib/python3.10/site-packages/numpy/random/_examples/cython/meson.build ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ project('random-build-examples', 'c', 'cpp', 'cython')
2
+
3
+ py_mod = import('python')
4
+ py3 = py_mod.find_installation(pure: false)
5
+
6
+ cc = meson.get_compiler('c')
7
+ cy = meson.get_compiler('cython')
8
+
9
+ # Keep synced with pyproject.toml
10
+ if not cy.version().version_compare('>=3.0.6')
11
+ error('tests requires Cython >= 3.0.6')
12
+ endif
13
+
14
+ base_cython_args = []
15
+ if cy.version().version_compare('>=3.1.0')
16
+ base_cython_args += ['-Xfreethreading_compatible=True']
17
+ endif
18
+
19
+ _numpy_abs = run_command(py3, ['-c',
20
+ 'import os; os.chdir(".."); import numpy; print(os.path.abspath(numpy.get_include() + "../../.."))'],
21
+ check: true).stdout().strip()
22
+
23
+ npymath_path = _numpy_abs / '_core' / 'lib'
24
+ npy_include_path = _numpy_abs / '_core' / 'include'
25
+ npyrandom_path = _numpy_abs / 'random' / 'lib'
26
+ npymath_lib = cc.find_library('npymath', dirs: npymath_path)
27
+ npyrandom_lib = cc.find_library('npyrandom', dirs: npyrandom_path)
28
+
29
+ py3.extension_module(
30
+ 'extending_distributions',
31
+ 'extending_distributions.pyx',
32
+ install: false,
33
+ include_directories: [npy_include_path],
34
+ dependencies: [npyrandom_lib, npymath_lib],
35
+ cython_args: base_cython_args,
36
+ )
37
+ py3.extension_module(
38
+ 'extending',
39
+ 'extending.pyx',
40
+ install: false,
41
+ include_directories: [npy_include_path],
42
+ dependencies: [npyrandom_lib, npymath_lib],
43
+ cython_args: base_cython_args,
44
+ )
45
+ py3.extension_module(
46
+ 'extending_cpp',
47
+ 'extending_distributions.pyx',
48
+ install: false,
49
+ override_options : ['cython_language=cpp'],
50
+ cython_args: base_cython_args + ['--module-name', 'extending_cpp'],
51
+ include_directories: [npy_include_path],
52
+ dependencies: [npyrandom_lib, npymath_lib],
53
+ )
valley/lib/python3.10/site-packages/numpy/random/_examples/numba/__pycache__/extending.cpython-310.pyc ADDED
Binary file (2.16 kB). View file
 
valley/lib/python3.10/site-packages/numpy/random/_examples/numba/__pycache__/extending_distributions.cpython-310.pyc ADDED
Binary file (2.1 kB). View file
 
valley/lib/python3.10/site-packages/numpy/random/_examples/numba/extending.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numba as nb
3
+
4
+ from numpy.random import PCG64
5
+ from timeit import timeit
6
+
7
+ bit_gen = PCG64()
8
+ next_d = bit_gen.cffi.next_double
9
+ state_addr = bit_gen.cffi.state_address
10
+
11
+ def normals(n, state):
12
+ out = np.empty(n)
13
+ for i in range((n + 1) // 2):
14
+ x1 = 2.0 * next_d(state) - 1.0
15
+ x2 = 2.0 * next_d(state) - 1.0
16
+ r2 = x1 * x1 + x2 * x2
17
+ while r2 >= 1.0 or r2 == 0.0:
18
+ x1 = 2.0 * next_d(state) - 1.0
19
+ x2 = 2.0 * next_d(state) - 1.0
20
+ r2 = x1 * x1 + x2 * x2
21
+ f = np.sqrt(-2.0 * np.log(r2) / r2)
22
+ out[2 * i] = f * x1
23
+ if 2 * i + 1 < n:
24
+ out[2 * i + 1] = f * x2
25
+ return out
26
+
27
+ # Compile using Numba
28
+ normalsj = nb.jit(normals, nopython=True)
29
+ # Must use state address not state with numba
30
+ n = 10000
31
+
32
+ def numbacall():
33
+ return normalsj(n, state_addr)
34
+
35
+ rg = np.random.Generator(PCG64())
36
+
37
+ def numpycall():
38
+ return rg.normal(size=n)
39
+
40
+ # Check that the functions work
41
+ r1 = numbacall()
42
+ r2 = numpycall()
43
+ assert r1.shape == (n,)
44
+ assert r1.shape == r2.shape
45
+
46
+ t1 = timeit(numbacall, number=1000)
47
+ print(f'{t1:.2f} secs for {n} PCG64 (Numba/PCG64) gaussian randoms')
48
+ t2 = timeit(numpycall, number=1000)
49
+ print(f'{t2:.2f} secs for {n} PCG64 (NumPy/PCG64) gaussian randoms')
50
+
51
+ # example 2
52
+
53
+ next_u32 = bit_gen.ctypes.next_uint32
54
+ ctypes_state = bit_gen.ctypes.state
55
+
56
+ @nb.jit(nopython=True)
57
+ def bounded_uint(lb, ub, state):
58
+ mask = delta = ub - lb
59
+ mask |= mask >> 1
60
+ mask |= mask >> 2
61
+ mask |= mask >> 4
62
+ mask |= mask >> 8
63
+ mask |= mask >> 16
64
+
65
+ val = next_u32(state) & mask
66
+ while val > delta:
67
+ val = next_u32(state) & mask
68
+
69
+ return lb + val
70
+
71
+
72
+ print(bounded_uint(323, 2394691, ctypes_state.value))
73
+
74
+
75
+ @nb.jit(nopython=True)
76
+ def bounded_uints(lb, ub, n, state):
77
+ out = np.empty(n, dtype=np.uint32)
78
+ for i in range(n):
79
+ out[i] = bounded_uint(lb, ub, state)
80
+
81
+
82
+ bounded_uints(323, 2394691, 10000000, ctypes_state.value)
83
+
84
+
valley/lib/python3.10/site-packages/numpy/random/_examples/numba/extending_distributions.py ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ r"""
2
+ Building the required library in this example requires a source distribution
3
+ of NumPy or clone of the NumPy git repository since distributions.c is not
4
+ included in binary distributions.
5
+
6
+ On *nix, execute in numpy/random/src/distributions
7
+
8
+ export ${PYTHON_VERSION}=3.8 # Python version
9
+ export PYTHON_INCLUDE=#path to Python's include folder, usually \
10
+ ${PYTHON_HOME}/include/python${PYTHON_VERSION}m
11
+ export NUMPY_INCLUDE=#path to numpy's include folder, usually \
12
+ ${PYTHON_HOME}/lib/python${PYTHON_VERSION}/site-packages/numpy/_core/include
13
+ gcc -shared -o libdistributions.so -fPIC distributions.c \
14
+ -I${NUMPY_INCLUDE} -I${PYTHON_INCLUDE}
15
+ mv libdistributions.so ../../_examples/numba/
16
+
17
+ On Windows
18
+
19
+ rem PYTHON_HOME and PYTHON_VERSION are setup dependent, this is an example
20
+ set PYTHON_HOME=c:\Anaconda
21
+ set PYTHON_VERSION=38
22
+ cl.exe /LD .\distributions.c -DDLL_EXPORT \
23
+ -I%PYTHON_HOME%\lib\site-packages\numpy\_core\include \
24
+ -I%PYTHON_HOME%\include %PYTHON_HOME%\libs\python%PYTHON_VERSION%.lib
25
+ move distributions.dll ../../_examples/numba/
26
+ """
27
+ import os
28
+
29
+ import numba as nb
30
+ import numpy as np
31
+ from cffi import FFI
32
+
33
+ from numpy.random import PCG64
34
+
35
+ ffi = FFI()
36
+ if os.path.exists('./distributions.dll'):
37
+ lib = ffi.dlopen('./distributions.dll')
38
+ elif os.path.exists('./libdistributions.so'):
39
+ lib = ffi.dlopen('./libdistributions.so')
40
+ else:
41
+ raise RuntimeError('Required DLL/so file was not found.')
42
+
43
+ ffi.cdef("""
44
+ double random_standard_normal(void *bitgen_state);
45
+ """)
46
+ x = PCG64()
47
+ xffi = x.cffi
48
+ bit_generator = xffi.bit_generator
49
+
50
+ random_standard_normal = lib.random_standard_normal
51
+
52
+
53
+ def normals(n, bit_generator):
54
+ out = np.empty(n)
55
+ for i in range(n):
56
+ out[i] = random_standard_normal(bit_generator)
57
+ return out
58
+
59
+
60
+ normalsj = nb.jit(normals, nopython=True)
61
+
62
+ # Numba requires a memory address for void *
63
+ # Can also get address from x.ctypes.bit_generator.value
64
+ bit_generator_address = int(ffi.cast('uintptr_t', bit_generator))
65
+
66
+ norm = normalsj(1000, bit_generator_address)
67
+ print(norm[:12])
valley/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:c08ae8ad6d04e5300cb1c92077eeeb44e27e23457658062c9053313f1d8ce070
3
+ size 1060664
valley/lib/python3.10/site-packages/numpy/random/_generator.pyi ADDED
@@ -0,0 +1,784 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from collections.abc import Callable
2
+ from typing import Any, overload, TypeVar, Literal
3
+
4
+ import numpy as np
5
+ from numpy import (
6
+ dtype,
7
+ float32,
8
+ float64,
9
+ int8,
10
+ int16,
11
+ int32,
12
+ int64,
13
+ int_,
14
+ uint,
15
+ uint8,
16
+ uint16,
17
+ uint32,
18
+ uint64,
19
+ )
20
+ from numpy.random import BitGenerator, SeedSequence
21
+ from numpy._typing import (
22
+ ArrayLike,
23
+ NDArray,
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])
49
+
50
+ _DTypeLikeFloat32 = (
51
+ dtype[float32]
52
+ | _SupportsDType[dtype[float32]]
53
+ | type[float32]
54
+ | _Float32Codes
55
+ | _SingleCodes
56
+ )
57
+
58
+ _DTypeLikeFloat64 = (
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) -> None: ...
72
+ def __setstate__(self, state: dict[str, Any] | None) -> None: ...
73
+ def __reduce__(self) -> tuple[
74
+ Callable[[BitGenerator], Generator],
75
+ tuple[BitGenerator],
76
+ None]: ...
77
+ @property
78
+ def bit_generator(self) -> BitGenerator: ...
79
+ def spawn(self, n_children: int) -> list[Generator]: ...
80
+ def bytes(self, length: int) -> bytes: ...
81
+ @overload
82
+ def standard_normal( # type: ignore[misc]
83
+ self,
84
+ size: None = ...,
85
+ dtype: _DTypeLikeFloat32 | _DTypeLikeFloat64 = ...,
86
+ out: None = ...,
87
+ ) -> float: ...
88
+ @overload
89
+ def standard_normal( # type: ignore[misc]
90
+ self,
91
+ size: _ShapeLike = ...,
92
+ ) -> NDArray[float64]: ...
93
+ @overload
94
+ def standard_normal( # type: ignore[misc]
95
+ self,
96
+ *,
97
+ out: NDArray[float64] = ...,
98
+ ) -> NDArray[float64]: ...
99
+ @overload
100
+ def standard_normal( # type: ignore[misc]
101
+ self,
102
+ size: _ShapeLike = ...,
103
+ dtype: _DTypeLikeFloat32 = ...,
104
+ out: None | NDArray[float32] = ...,
105
+ ) -> NDArray[float32]: ...
106
+ @overload
107
+ def standard_normal( # type: ignore[misc]
108
+ self,
109
+ size: _ShapeLike = ...,
110
+ dtype: _DTypeLikeFloat64 = ...,
111
+ out: None | NDArray[float64] = ...,
112
+ ) -> NDArray[float64]: ...
113
+ @overload
114
+ def permutation(self, x: int, axis: int = ...) -> NDArray[int64]: ...
115
+ @overload
116
+ def permutation(self, x: ArrayLike, axis: int = ...) -> NDArray[Any]: ...
117
+ @overload
118
+ def standard_exponential( # type: ignore[misc]
119
+ self,
120
+ size: None = ...,
121
+ dtype: _DTypeLikeFloat32 | _DTypeLikeFloat64 = ...,
122
+ method: Literal["zig", "inv"] = ...,
123
+ out: None = ...,
124
+ ) -> float: ...
125
+ @overload
126
+ def standard_exponential(
127
+ self,
128
+ size: _ShapeLike = ...,
129
+ ) -> NDArray[float64]: ...
130
+ @overload
131
+ def standard_exponential(
132
+ self,
133
+ *,
134
+ out: NDArray[float64] = ...,
135
+ ) -> NDArray[float64]: ...
136
+ @overload
137
+ def standard_exponential(
138
+ self,
139
+ size: _ShapeLike = ...,
140
+ *,
141
+ method: Literal["zig", "inv"] = ...,
142
+ out: None | NDArray[float64] = ...,
143
+ ) -> NDArray[float64]: ...
144
+ @overload
145
+ def standard_exponential(
146
+ self,
147
+ size: _ShapeLike = ...,
148
+ dtype: _DTypeLikeFloat32 = ...,
149
+ method: Literal["zig", "inv"] = ...,
150
+ out: None | NDArray[float32] = ...,
151
+ ) -> NDArray[float32]: ...
152
+ @overload
153
+ def standard_exponential(
154
+ self,
155
+ size: _ShapeLike = ...,
156
+ dtype: _DTypeLikeFloat64 = ...,
157
+ method: Literal["zig", "inv"] = ...,
158
+ out: None | NDArray[float64] = ...,
159
+ ) -> NDArray[float64]: ...
160
+ @overload
161
+ def random( # type: ignore[misc]
162
+ self,
163
+ size: None = ...,
164
+ dtype: _DTypeLikeFloat32 | _DTypeLikeFloat64 = ...,
165
+ out: None = ...,
166
+ ) -> float: ...
167
+ @overload
168
+ def random(
169
+ self,
170
+ *,
171
+ out: NDArray[float64] = ...,
172
+ ) -> NDArray[float64]: ...
173
+ @overload
174
+ def random(
175
+ self,
176
+ size: _ShapeLike = ...,
177
+ *,
178
+ out: None | NDArray[float64] = ...,
179
+ ) -> NDArray[float64]: ...
180
+ @overload
181
+ def random(
182
+ self,
183
+ size: _ShapeLike = ...,
184
+ dtype: _DTypeLikeFloat32 = ...,
185
+ out: None | NDArray[float32] = ...,
186
+ ) -> NDArray[float32]: ...
187
+ @overload
188
+ def random(
189
+ self,
190
+ size: _ShapeLike = ...,
191
+ dtype: _DTypeLikeFloat64 = ...,
192
+ out: None | NDArray[float64] = ...,
193
+ ) -> NDArray[float64]: ...
194
+ @overload
195
+ def beta(
196
+ self,
197
+ a: _FloatLike_co,
198
+ b: _FloatLike_co,
199
+ size: None = ...,
200
+ ) -> float: ... # type: ignore[misc]
201
+ @overload
202
+ def beta(
203
+ self, a: _ArrayLikeFloat_co, b: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
204
+ ) -> NDArray[float64]: ...
205
+ @overload
206
+ def exponential(self, scale: _FloatLike_co = ..., size: None = ...) -> float: ... # type: ignore[misc]
207
+ @overload
208
+ def exponential(
209
+ self, scale: _ArrayLikeFloat_co = ..., size: None | _ShapeLike = ...
210
+ ) -> NDArray[float64]: ...
211
+ @overload
212
+ def integers( # type: ignore[misc]
213
+ self,
214
+ low: int,
215
+ high: None | int = ...,
216
+ size: None = ...,
217
+ ) -> int: ...
218
+ @overload
219
+ def integers( # type: ignore[misc]
220
+ self,
221
+ low: int,
222
+ high: None | int = ...,
223
+ size: None = ...,
224
+ dtype: type[bool] = ...,
225
+ endpoint: bool = ...,
226
+ ) -> bool: ...
227
+ @overload
228
+ def integers( # type: ignore[misc]
229
+ self,
230
+ low: int,
231
+ high: None | int = ...,
232
+ size: None = ...,
233
+ dtype: type[np.bool] = ...,
234
+ endpoint: bool = ...,
235
+ ) -> np.bool: ...
236
+ @overload
237
+ def integers( # type: ignore[misc]
238
+ self,
239
+ low: int,
240
+ high: None | int = ...,
241
+ size: None = ...,
242
+ dtype: type[int] = ...,
243
+ endpoint: bool = ...,
244
+ ) -> int: ...
245
+ @overload
246
+ def integers( # type: ignore[misc]
247
+ self,
248
+ low: int,
249
+ high: None | int = ...,
250
+ size: None = ...,
251
+ dtype: dtype[uint8] | type[uint8] | _UInt8Codes | _SupportsDType[dtype[uint8]] = ...,
252
+ endpoint: bool = ...,
253
+ ) -> uint8: ...
254
+ @overload
255
+ def integers( # type: ignore[misc]
256
+ self,
257
+ low: int,
258
+ high: None | int = ...,
259
+ size: None = ...,
260
+ dtype: dtype[uint16] | type[uint16] | _UInt16Codes | _SupportsDType[dtype[uint16]] = ...,
261
+ endpoint: bool = ...,
262
+ ) -> uint16: ...
263
+ @overload
264
+ def integers( # type: ignore[misc]
265
+ self,
266
+ low: int,
267
+ high: None | int = ...,
268
+ size: None = ...,
269
+ dtype: dtype[uint32] | type[uint32] | _UInt32Codes | _SupportsDType[dtype[uint32]] = ...,
270
+ endpoint: bool = ...,
271
+ ) -> uint32: ...
272
+ @overload
273
+ def integers( # type: ignore[misc]
274
+ self,
275
+ low: int,
276
+ high: None | int = ...,
277
+ size: None = ...,
278
+ dtype: dtype[uint] | type[uint] | _UIntCodes | _SupportsDType[dtype[uint]] = ...,
279
+ endpoint: bool = ...,
280
+ ) -> uint: ...
281
+ @overload
282
+ def integers( # type: ignore[misc]
283
+ self,
284
+ low: int,
285
+ high: None | int = ...,
286
+ size: None = ...,
287
+ dtype: dtype[uint64] | type[uint64] | _UInt64Codes | _SupportsDType[dtype[uint64]] = ...,
288
+ endpoint: bool = ...,
289
+ ) -> uint64: ...
290
+ @overload
291
+ def integers( # type: ignore[misc]
292
+ self,
293
+ low: int,
294
+ high: None | int = ...,
295
+ size: None = ...,
296
+ dtype: dtype[int8] | type[int8] | _Int8Codes | _SupportsDType[dtype[int8]] = ...,
297
+ endpoint: bool = ...,
298
+ ) -> int8: ...
299
+ @overload
300
+ def integers( # type: ignore[misc]
301
+ self,
302
+ low: int,
303
+ high: None | int = ...,
304
+ size: None = ...,
305
+ dtype: dtype[int16] | type[int16] | _Int16Codes | _SupportsDType[dtype[int16]] = ...,
306
+ endpoint: bool = ...,
307
+ ) -> int16: ...
308
+ @overload
309
+ def integers( # type: ignore[misc]
310
+ self,
311
+ low: int,
312
+ high: None | int = ...,
313
+ size: None = ...,
314
+ dtype: dtype[int32] | type[int32] | _Int32Codes | _SupportsDType[dtype[int32]] = ...,
315
+ endpoint: bool = ...,
316
+ ) -> int32: ...
317
+ @overload
318
+ def integers( # type: ignore[misc]
319
+ self,
320
+ low: int,
321
+ high: None | int = ...,
322
+ size: None = ...,
323
+ dtype: dtype[int_] | type[int] | type[int_] | _IntCodes | _SupportsDType[dtype[int_]] = ...,
324
+ endpoint: bool = ...,
325
+ ) -> int_: ...
326
+ @overload
327
+ def integers( # type: ignore[misc]
328
+ self,
329
+ low: int,
330
+ high: None | int = ...,
331
+ size: None = ...,
332
+ dtype: dtype[int64] | type[int64] | _Int64Codes | _SupportsDType[dtype[int64]] = ...,
333
+ endpoint: bool = ...,
334
+ ) -> int64: ...
335
+ @overload
336
+ def integers( # type: ignore[misc]
337
+ self,
338
+ low: _ArrayLikeInt_co,
339
+ high: None | _ArrayLikeInt_co = ...,
340
+ size: None | _ShapeLike = ...,
341
+ ) -> NDArray[int64]: ...
342
+ @overload
343
+ def integers( # type: ignore[misc]
344
+ self,
345
+ low: _ArrayLikeInt_co,
346
+ high: None | _ArrayLikeInt_co = ...,
347
+ size: None | _ShapeLike = ...,
348
+ dtype: _DTypeLikeBool = ...,
349
+ endpoint: bool = ...,
350
+ ) -> NDArray[np.bool]: ...
351
+ @overload
352
+ def integers( # type: ignore[misc]
353
+ self,
354
+ low: _ArrayLikeInt_co,
355
+ high: None | _ArrayLikeInt_co = ...,
356
+ size: None | _ShapeLike = ...,
357
+ dtype: dtype[int8] | type[int8] | _Int8Codes | _SupportsDType[dtype[int8]] = ...,
358
+ endpoint: bool = ...,
359
+ ) -> NDArray[int8]: ...
360
+ @overload
361
+ def integers( # type: ignore[misc]
362
+ self,
363
+ low: _ArrayLikeInt_co,
364
+ high: None | _ArrayLikeInt_co = ...,
365
+ size: None | _ShapeLike = ...,
366
+ dtype: dtype[int16] | type[int16] | _Int16Codes | _SupportsDType[dtype[int16]] = ...,
367
+ endpoint: bool = ...,
368
+ ) -> NDArray[int16]: ...
369
+ @overload
370
+ def integers( # type: ignore[misc]
371
+ self,
372
+ low: _ArrayLikeInt_co,
373
+ high: None | _ArrayLikeInt_co = ...,
374
+ size: None | _ShapeLike = ...,
375
+ dtype: dtype[int32] | type[int32] | _Int32Codes | _SupportsDType[dtype[int32]] = ...,
376
+ endpoint: bool = ...,
377
+ ) -> NDArray[int32]: ...
378
+ @overload
379
+ def integers( # type: ignore[misc]
380
+ self,
381
+ low: _ArrayLikeInt_co,
382
+ high: None | _ArrayLikeInt_co = ...,
383
+ size: None | _ShapeLike = ...,
384
+ dtype: None | dtype[int64] | type[int64] | _Int64Codes | _SupportsDType[dtype[int64]] = ...,
385
+ endpoint: bool = ...,
386
+ ) -> NDArray[int64]: ...
387
+ @overload
388
+ def integers( # type: ignore[misc]
389
+ self,
390
+ low: _ArrayLikeInt_co,
391
+ high: None | _ArrayLikeInt_co = ...,
392
+ size: None | _ShapeLike = ...,
393
+ dtype: dtype[uint8] | type[uint8] | _UInt8Codes | _SupportsDType[dtype[uint8]] = ...,
394
+ endpoint: bool = ...,
395
+ ) -> NDArray[uint8]: ...
396
+ @overload
397
+ def integers( # type: ignore[misc]
398
+ self,
399
+ low: _ArrayLikeInt_co,
400
+ high: None | _ArrayLikeInt_co = ...,
401
+ size: None | _ShapeLike = ...,
402
+ dtype: dtype[uint16] | type[uint16] | _UInt16Codes | _SupportsDType[dtype[uint16]] = ...,
403
+ endpoint: bool = ...,
404
+ ) -> NDArray[uint16]: ...
405
+ @overload
406
+ def integers( # type: ignore[misc]
407
+ self,
408
+ low: _ArrayLikeInt_co,
409
+ high: None | _ArrayLikeInt_co = ...,
410
+ size: None | _ShapeLike = ...,
411
+ dtype: dtype[uint32] | type[uint32] | _UInt32Codes | _SupportsDType[dtype[uint32]] = ...,
412
+ endpoint: bool = ...,
413
+ ) -> NDArray[uint32]: ...
414
+ @overload
415
+ def integers( # type: ignore[misc]
416
+ self,
417
+ low: _ArrayLikeInt_co,
418
+ high: None | _ArrayLikeInt_co = ...,
419
+ size: None | _ShapeLike = ...,
420
+ dtype: dtype[uint64] | type[uint64] | _UInt64Codes | _SupportsDType[dtype[uint64]] = ...,
421
+ endpoint: bool = ...,
422
+ ) -> NDArray[uint64]: ...
423
+ @overload
424
+ def integers( # type: ignore[misc]
425
+ self,
426
+ low: _ArrayLikeInt_co,
427
+ high: None | _ArrayLikeInt_co = ...,
428
+ size: None | _ShapeLike = ...,
429
+ dtype: dtype[int_] | type[int] | type[int_] | _IntCodes | _SupportsDType[dtype[int_]] = ...,
430
+ endpoint: bool = ...,
431
+ ) -> NDArray[int_]: ...
432
+ @overload
433
+ def integers( # type: ignore[misc]
434
+ self,
435
+ low: _ArrayLikeInt_co,
436
+ high: None | _ArrayLikeInt_co = ...,
437
+ size: None | _ShapeLike = ...,
438
+ dtype: dtype[uint] | type[uint] | _UIntCodes | _SupportsDType[dtype[uint]] = ...,
439
+ endpoint: bool = ...,
440
+ ) -> NDArray[uint]: ...
441
+ # TODO: Use a TypeVar _T here to get away from Any output? Should be int->NDArray[int64], ArrayLike[_T] -> _T | NDArray[Any]
442
+ @overload
443
+ def choice(
444
+ self,
445
+ a: int,
446
+ size: None = ...,
447
+ replace: bool = ...,
448
+ p: None | _ArrayLikeFloat_co = ...,
449
+ axis: int = ...,
450
+ shuffle: bool = ...,
451
+ ) -> int: ...
452
+ @overload
453
+ def choice(
454
+ self,
455
+ a: int,
456
+ size: _ShapeLike = ...,
457
+ replace: bool = ...,
458
+ p: None | _ArrayLikeFloat_co = ...,
459
+ axis: int = ...,
460
+ shuffle: bool = ...,
461
+ ) -> NDArray[int64]: ...
462
+ @overload
463
+ def choice(
464
+ self,
465
+ a: ArrayLike,
466
+ size: None = ...,
467
+ replace: bool = ...,
468
+ p: None | _ArrayLikeFloat_co = ...,
469
+ axis: int = ...,
470
+ shuffle: bool = ...,
471
+ ) -> Any: ...
472
+ @overload
473
+ def choice(
474
+ self,
475
+ a: ArrayLike,
476
+ size: _ShapeLike = ...,
477
+ replace: bool = ...,
478
+ p: None | _ArrayLikeFloat_co = ...,
479
+ axis: int = ...,
480
+ shuffle: bool = ...,
481
+ ) -> NDArray[Any]: ...
482
+ @overload
483
+ def uniform(
484
+ self,
485
+ low: _FloatLike_co = ...,
486
+ high: _FloatLike_co = ...,
487
+ size: None = ...,
488
+ ) -> float: ... # type: ignore[misc]
489
+ @overload
490
+ def uniform(
491
+ self,
492
+ low: _ArrayLikeFloat_co = ...,
493
+ high: _ArrayLikeFloat_co = ...,
494
+ size: None | _ShapeLike = ...,
495
+ ) -> NDArray[float64]: ...
496
+ @overload
497
+ def normal(
498
+ self,
499
+ loc: _FloatLike_co = ...,
500
+ scale: _FloatLike_co = ...,
501
+ size: None = ...,
502
+ ) -> float: ... # type: ignore[misc]
503
+ @overload
504
+ def normal(
505
+ self,
506
+ loc: _ArrayLikeFloat_co = ...,
507
+ scale: _ArrayLikeFloat_co = ...,
508
+ size: None | _ShapeLike = ...,
509
+ ) -> NDArray[float64]: ...
510
+ @overload
511
+ def standard_gamma( # type: ignore[misc]
512
+ self,
513
+ shape: _FloatLike_co,
514
+ size: None = ...,
515
+ dtype: _DTypeLikeFloat32 | _DTypeLikeFloat64 = ...,
516
+ out: None = ...,
517
+ ) -> float: ...
518
+ @overload
519
+ def standard_gamma(
520
+ self,
521
+ shape: _ArrayLikeFloat_co,
522
+ size: None | _ShapeLike = ...,
523
+ ) -> NDArray[float64]: ...
524
+ @overload
525
+ def standard_gamma(
526
+ self,
527
+ shape: _ArrayLikeFloat_co,
528
+ *,
529
+ out: NDArray[float64] = ...,
530
+ ) -> NDArray[float64]: ...
531
+ @overload
532
+ def standard_gamma(
533
+ self,
534
+ shape: _ArrayLikeFloat_co,
535
+ size: None | _ShapeLike = ...,
536
+ dtype: _DTypeLikeFloat32 = ...,
537
+ out: None | NDArray[float32] = ...,
538
+ ) -> NDArray[float32]: ...
539
+ @overload
540
+ def standard_gamma(
541
+ self,
542
+ shape: _ArrayLikeFloat_co,
543
+ size: None | _ShapeLike = ...,
544
+ dtype: _DTypeLikeFloat64 = ...,
545
+ out: None | NDArray[float64] = ...,
546
+ ) -> NDArray[float64]: ...
547
+ @overload
548
+ def gamma(self, shape: _FloatLike_co, scale: _FloatLike_co = ..., size: None = ...) -> float: ... # type: ignore[misc]
549
+ @overload
550
+ def gamma(
551
+ self,
552
+ shape: _ArrayLikeFloat_co,
553
+ scale: _ArrayLikeFloat_co = ...,
554
+ size: None | _ShapeLike = ...,
555
+ ) -> NDArray[float64]: ...
556
+ @overload
557
+ def f(self, dfnum: _FloatLike_co, dfden: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
558
+ @overload
559
+ def f(
560
+ self, dfnum: _ArrayLikeFloat_co, dfden: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
561
+ ) -> NDArray[float64]: ...
562
+ @overload
563
+ def noncentral_f(self, dfnum: _FloatLike_co, dfden: _FloatLike_co, nonc: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
564
+ @overload
565
+ def noncentral_f(
566
+ self,
567
+ dfnum: _ArrayLikeFloat_co,
568
+ dfden: _ArrayLikeFloat_co,
569
+ nonc: _ArrayLikeFloat_co,
570
+ size: None | _ShapeLike = ...,
571
+ ) -> NDArray[float64]: ...
572
+ @overload
573
+ def chisquare(self, df: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
574
+ @overload
575
+ def chisquare(
576
+ self, df: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
577
+ ) -> NDArray[float64]: ...
578
+ @overload
579
+ def noncentral_chisquare(self, df: _FloatLike_co, nonc: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
580
+ @overload
581
+ def noncentral_chisquare(
582
+ self, df: _ArrayLikeFloat_co, nonc: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
583
+ ) -> NDArray[float64]: ...
584
+ @overload
585
+ def standard_t(self, df: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
586
+ @overload
587
+ def standard_t(
588
+ self, df: _ArrayLikeFloat_co, size: None = ...
589
+ ) -> NDArray[float64]: ...
590
+ @overload
591
+ def standard_t(
592
+ self, df: _ArrayLikeFloat_co, size: _ShapeLike = ...
593
+ ) -> NDArray[float64]: ...
594
+ @overload
595
+ def vonmises(self, mu: _FloatLike_co, kappa: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
596
+ @overload
597
+ def vonmises(
598
+ self, mu: _ArrayLikeFloat_co, kappa: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
599
+ ) -> NDArray[float64]: ...
600
+ @overload
601
+ def pareto(self, a: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
602
+ @overload
603
+ def pareto(
604
+ self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
605
+ ) -> NDArray[float64]: ...
606
+ @overload
607
+ def weibull(self, a: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
608
+ @overload
609
+ def weibull(
610
+ self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
611
+ ) -> NDArray[float64]: ...
612
+ @overload
613
+ def power(self, a: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
614
+ @overload
615
+ def power(
616
+ self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
617
+ ) -> NDArray[float64]: ...
618
+ @overload
619
+ def standard_cauchy(self, size: None = ...) -> float: ... # type: ignore[misc]
620
+ @overload
621
+ def standard_cauchy(self, size: _ShapeLike = ...) -> NDArray[float64]: ...
622
+ @overload
623
+ def laplace(
624
+ self,
625
+ loc: _FloatLike_co = ...,
626
+ scale: _FloatLike_co = ...,
627
+ size: None = ...,
628
+ ) -> float: ... # type: ignore[misc]
629
+ @overload
630
+ def laplace(
631
+ self,
632
+ loc: _ArrayLikeFloat_co = ...,
633
+ scale: _ArrayLikeFloat_co = ...,
634
+ size: None | _ShapeLike = ...,
635
+ ) -> NDArray[float64]: ...
636
+ @overload
637
+ def gumbel(
638
+ self,
639
+ loc: _FloatLike_co = ...,
640
+ scale: _FloatLike_co = ...,
641
+ size: None = ...,
642
+ ) -> float: ... # type: ignore[misc]
643
+ @overload
644
+ def gumbel(
645
+ self,
646
+ loc: _ArrayLikeFloat_co = ...,
647
+ scale: _ArrayLikeFloat_co = ...,
648
+ size: None | _ShapeLike = ...,
649
+ ) -> NDArray[float64]: ...
650
+ @overload
651
+ def logistic(
652
+ self,
653
+ loc: _FloatLike_co = ...,
654
+ scale: _FloatLike_co = ...,
655
+ size: None = ...,
656
+ ) -> float: ... # type: ignore[misc]
657
+ @overload
658
+ def logistic(
659
+ self,
660
+ loc: _ArrayLikeFloat_co = ...,
661
+ scale: _ArrayLikeFloat_co = ...,
662
+ size: None | _ShapeLike = ...,
663
+ ) -> NDArray[float64]: ...
664
+ @overload
665
+ def lognormal(
666
+ self,
667
+ mean: _FloatLike_co = ...,
668
+ sigma: _FloatLike_co = ...,
669
+ size: None = ...,
670
+ ) -> float: ... # type: ignore[misc]
671
+ @overload
672
+ def lognormal(
673
+ self,
674
+ mean: _ArrayLikeFloat_co = ...,
675
+ sigma: _ArrayLikeFloat_co = ...,
676
+ size: None | _ShapeLike = ...,
677
+ ) -> NDArray[float64]: ...
678
+ @overload
679
+ def rayleigh(self, scale: _FloatLike_co = ..., size: None = ...) -> float: ... # type: ignore[misc]
680
+ @overload
681
+ def rayleigh(
682
+ self, scale: _ArrayLikeFloat_co = ..., size: None | _ShapeLike = ...
683
+ ) -> NDArray[float64]: ...
684
+ @overload
685
+ def wald(self, mean: _FloatLike_co, scale: _FloatLike_co, size: None = ...) -> float: ... # type: ignore[misc]
686
+ @overload
687
+ def wald(
688
+ self, mean: _ArrayLikeFloat_co, scale: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
689
+ ) -> NDArray[float64]: ...
690
+ @overload
691
+ def triangular(
692
+ self,
693
+ left: _FloatLike_co,
694
+ mode: _FloatLike_co,
695
+ right: _FloatLike_co,
696
+ size: None = ...,
697
+ ) -> float: ... # type: ignore[misc]
698
+ @overload
699
+ def triangular(
700
+ self,
701
+ left: _ArrayLikeFloat_co,
702
+ mode: _ArrayLikeFloat_co,
703
+ right: _ArrayLikeFloat_co,
704
+ size: None | _ShapeLike = ...,
705
+ ) -> NDArray[float64]: ...
706
+ @overload
707
+ def binomial(self, n: int, p: _FloatLike_co, size: None = ...) -> int: ... # type: ignore[misc]
708
+ @overload
709
+ def binomial(
710
+ self, n: _ArrayLikeInt_co, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
711
+ ) -> NDArray[int64]: ...
712
+ @overload
713
+ def negative_binomial(self, n: _FloatLike_co, p: _FloatLike_co, size: None = ...) -> int: ... # type: ignore[misc]
714
+ @overload
715
+ def negative_binomial(
716
+ self, n: _ArrayLikeFloat_co, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
717
+ ) -> NDArray[int64]: ...
718
+ @overload
719
+ def poisson(self, lam: _FloatLike_co = ..., size: None = ...) -> int: ... # type: ignore[misc]
720
+ @overload
721
+ def poisson(
722
+ self, lam: _ArrayLikeFloat_co = ..., size: None | _ShapeLike = ...
723
+ ) -> NDArray[int64]: ...
724
+ @overload
725
+ def zipf(self, a: _FloatLike_co, size: None = ...) -> int: ... # type: ignore[misc]
726
+ @overload
727
+ def zipf(
728
+ self, a: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
729
+ ) -> NDArray[int64]: ...
730
+ @overload
731
+ def geometric(self, p: _FloatLike_co, size: None = ...) -> int: ... # type: ignore[misc]
732
+ @overload
733
+ def geometric(
734
+ self, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
735
+ ) -> NDArray[int64]: ...
736
+ @overload
737
+ def hypergeometric(self, ngood: int, nbad: int, nsample: int, size: None = ...) -> int: ... # type: ignore[misc]
738
+ @overload
739
+ def hypergeometric(
740
+ self,
741
+ ngood: _ArrayLikeInt_co,
742
+ nbad: _ArrayLikeInt_co,
743
+ nsample: _ArrayLikeInt_co,
744
+ size: None | _ShapeLike = ...,
745
+ ) -> NDArray[int64]: ...
746
+ @overload
747
+ def logseries(self, p: _FloatLike_co, size: None = ...) -> int: ... # type: ignore[misc]
748
+ @overload
749
+ def logseries(
750
+ self, p: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
751
+ ) -> NDArray[int64]: ...
752
+ def multivariate_normal(
753
+ self,
754
+ mean: _ArrayLikeFloat_co,
755
+ cov: _ArrayLikeFloat_co,
756
+ size: None | _ShapeLike = ...,
757
+ check_valid: Literal["warn", "raise", "ignore"] = ...,
758
+ tol: float = ...,
759
+ *,
760
+ method: Literal["svd", "eigh", "cholesky"] = ...,
761
+ ) -> NDArray[float64]: ...
762
+ def multinomial(
763
+ self, n: _ArrayLikeInt_co,
764
+ pvals: _ArrayLikeFloat_co,
765
+ size: None | _ShapeLike = ...
766
+ ) -> NDArray[int64]: ...
767
+ def multivariate_hypergeometric(
768
+ self,
769
+ colors: _ArrayLikeInt_co,
770
+ nsample: int,
771
+ size: None | _ShapeLike = ...,
772
+ method: Literal["marginals", "count"] = ...,
773
+ ) -> NDArray[int64]: ...
774
+ def dirichlet(
775
+ self, alpha: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
776
+ ) -> NDArray[float64]: ...
777
+ def permuted(
778
+ self, x: ArrayLike, *, axis: None | int = ..., out: None | NDArray[Any] = ...
779
+ ) -> NDArray[Any]: ...
780
+ def shuffle(self, x: ArrayLike, axis: int = ...) -> None: ...
781
+
782
+ def default_rng(
783
+ seed: None | _ArrayLikeInt_co | SeedSequence | BitGenerator | Generator = ...
784
+ ) -> Generator: ...
valley/lib/python3.10/site-packages/numpy/random/_mt19937.cpython-310-x86_64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dd495e243ad214871dbc40a0aa58194512de7bc572d2e38dd7c0c393cefe9bfa
3
+ size 137472
valley/lib/python3.10/site-packages/numpy/random/_mt19937.pyi ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TypedDict
2
+
3
+ from numpy import uint32
4
+ from numpy.typing import NDArray
5
+ from numpy.random.bit_generator import BitGenerator, SeedSequence
6
+ from numpy._typing import _ArrayLikeInt_co
7
+
8
+ class _MT19937Internal(TypedDict):
9
+ key: NDArray[uint32]
10
+ pos: int
11
+
12
+ class _MT19937State(TypedDict):
13
+ bit_generator: str
14
+ state: _MT19937Internal
15
+
16
+ class MT19937(BitGenerator):
17
+ def __init__(self, seed: None | _ArrayLikeInt_co | SeedSequence = ...) -> None: ...
18
+ def _legacy_seeding(self, seed: _ArrayLikeInt_co) -> None: ...
19
+ def jumped(self, jumps: int = ...) -> MT19937: ...
20
+ @property
21
+ def state(self) -> _MT19937State: ...
22
+ @state.setter
23
+ def state(self, value: _MT19937State) -> None: ...
valley/lib/python3.10/site-packages/numpy/random/_pcg64.cpython-310-x86_64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da0039620017587ade18daee8da42bbfbafb89cac89bf5f15be3961c12926617
3
+ size 148496
valley/lib/python3.10/site-packages/numpy/random/_pcg64.pyi ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TypedDict
2
+
3
+ from numpy.random.bit_generator import BitGenerator, SeedSequence
4
+ from numpy._typing import _ArrayLikeInt_co
5
+
6
+ class _PCG64Internal(TypedDict):
7
+ state: int
8
+ inc: int
9
+
10
+ class _PCG64State(TypedDict):
11
+ bit_generator: str
12
+ state: _PCG64Internal
13
+ has_uint32: int
14
+ uinteger: int
15
+
16
+ class PCG64(BitGenerator):
17
+ def __init__(self, seed: None | _ArrayLikeInt_co | SeedSequence = ...) -> None: ...
18
+ def jumped(self, jumps: int = ...) -> PCG64: ...
19
+ @property
20
+ def state(
21
+ self,
22
+ ) -> _PCG64State: ...
23
+ @state.setter
24
+ def state(
25
+ self,
26
+ value: _PCG64State,
27
+ ) -> None: ...
28
+ def advance(self, delta: int) -> PCG64: ...
29
+
30
+ class PCG64DXSM(BitGenerator):
31
+ def __init__(self, seed: None | _ArrayLikeInt_co | SeedSequence = ...) -> None: ...
32
+ def jumped(self, jumps: int = ...) -> PCG64DXSM: ...
33
+ @property
34
+ def state(
35
+ self,
36
+ ) -> _PCG64State: ...
37
+ @state.setter
38
+ def state(
39
+ self,
40
+ value: _PCG64State,
41
+ ) -> None: ...
42
+ def advance(self, delta: int) -> PCG64DXSM: ...