summaryrefslogtreecommitdiffstats
path: root/venv/lib/python3.9/site-packages/numpy/doc
diff options
context:
space:
mode:
Diffstat (limited to 'venv/lib/python3.9/site-packages/numpy/doc')
-rw-r--r--venv/lib/python3.9/site-packages/numpy/doc/__init__.py26
-rw-r--r--venv/lib/python3.9/site-packages/numpy/doc/constants.py412
-rw-r--r--venv/lib/python3.9/site-packages/numpy/doc/ufuncs.py137
3 files changed, 575 insertions, 0 deletions
diff --git a/venv/lib/python3.9/site-packages/numpy/doc/__init__.py b/venv/lib/python3.9/site-packages/numpy/doc/__init__.py
new file mode 100644
index 00000000..8a944fec
--- /dev/null
+++ b/venv/lib/python3.9/site-packages/numpy/doc/__init__.py
@@ -0,0 +1,26 @@
+import os
+
+ref_dir = os.path.join(os.path.dirname(__file__))
+
+__all__ = sorted(f[:-3] for f in os.listdir(ref_dir) if f.endswith('.py') and
+ not f.startswith('__'))
+
+for f in __all__:
+ __import__(__name__ + '.' + f)
+
+del f, ref_dir
+
+__doc__ = """\
+Topical documentation
+=====================
+
+The following topics are available:
+%s
+
+You can view them by
+
+>>> help(np.doc.TOPIC) #doctest: +SKIP
+
+""" % '\n- '.join([''] + __all__)
+
+__all__.extend(['__doc__'])
diff --git a/venv/lib/python3.9/site-packages/numpy/doc/constants.py b/venv/lib/python3.9/site-packages/numpy/doc/constants.py
new file mode 100644
index 00000000..4db5c639
--- /dev/null
+++ b/venv/lib/python3.9/site-packages/numpy/doc/constants.py
@@ -0,0 +1,412 @@
+"""
+=========
+Constants
+=========
+
+.. currentmodule:: numpy
+
+NumPy includes several constants:
+
+%(constant_list)s
+"""
+#
+# Note: the docstring is autogenerated.
+#
+import re
+import textwrap
+
+# Maintain same format as in numpy.add_newdocs
+constants = []
+def add_newdoc(module, name, doc):
+ constants.append((name, doc))
+
+add_newdoc('numpy', 'pi',
+ """
+ ``pi = 3.1415926535897932384626433...``
+
+ References
+ ----------
+ https://en.wikipedia.org/wiki/Pi
+
+ """)
+
+add_newdoc('numpy', 'e',
+ """
+ Euler's constant, base of natural logarithms, Napier's constant.
+
+ ``e = 2.71828182845904523536028747135266249775724709369995...``
+
+ See Also
+ --------
+ exp : Exponential function
+ log : Natural logarithm
+
+ References
+ ----------
+ https://en.wikipedia.org/wiki/E_%28mathematical_constant%29
+
+ """)
+
+add_newdoc('numpy', 'euler_gamma',
+ """
+ ``γ = 0.5772156649015328606065120900824024310421...``
+
+ References
+ ----------
+ https://en.wikipedia.org/wiki/Euler-Mascheroni_constant
+
+ """)
+
+add_newdoc('numpy', 'inf',
+ """
+ IEEE 754 floating point representation of (positive) infinity.
+
+ Returns
+ -------
+ y : float
+ A floating point representation of positive infinity.
+
+ See Also
+ --------
+ isinf : Shows which elements are positive or negative infinity
+
+ isposinf : Shows which elements are positive infinity
+
+ isneginf : Shows which elements are negative infinity
+
+ isnan : Shows which elements are Not a Number
+
+ isfinite : Shows which elements are finite (not one of Not a Number,
+ positive infinity and negative infinity)
+
+ Notes
+ -----
+ NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic
+ (IEEE 754). This means that Not a Number is not equivalent to infinity.
+ Also that positive infinity is not equivalent to negative infinity. But
+ infinity is equivalent to positive infinity.
+
+ `Inf`, `Infinity`, `PINF` and `infty` are aliases for `inf`.
+
+ Examples
+ --------
+ >>> np.inf
+ inf
+ >>> np.array([1]) / 0.
+ array([ Inf])
+
+ """)
+
+add_newdoc('numpy', 'nan',
+ """
+ IEEE 754 floating point representation of Not a Number (NaN).
+
+ Returns
+ -------
+ y : A floating point representation of Not a Number.
+
+ See Also
+ --------
+ isnan : Shows which elements are Not a Number.
+
+ isfinite : Shows which elements are finite (not one of
+ Not a Number, positive infinity and negative infinity)
+
+ Notes
+ -----
+ NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic
+ (IEEE 754). This means that Not a Number is not equivalent to infinity.
+
+ `NaN` and `NAN` are aliases of `nan`.
+
+ Examples
+ --------
+ >>> np.nan
+ nan
+ >>> np.log(-1)
+ nan
+ >>> np.log([-1, 1, 2])
+ array([ NaN, 0. , 0.69314718])
+
+ """)
+
+add_newdoc('numpy', 'newaxis',
+ """
+ A convenient alias for None, useful for indexing arrays.
+
+ Examples
+ --------
+ >>> newaxis is None
+ True
+ >>> x = np.arange(3)
+ >>> x
+ array([0, 1, 2])
+ >>> x[:, newaxis]
+ array([[0],
+ [1],
+ [2]])
+ >>> x[:, newaxis, newaxis]
+ array([[[0]],
+ [[1]],
+ [[2]]])
+ >>> x[:, newaxis] * x
+ array([[0, 0, 0],
+ [0, 1, 2],
+ [0, 2, 4]])
+
+ Outer product, same as ``outer(x, y)``:
+
+ >>> y = np.arange(3, 6)
+ >>> x[:, newaxis] * y
+ array([[ 0, 0, 0],
+ [ 3, 4, 5],
+ [ 6, 8, 10]])
+
+ ``x[newaxis, :]`` is equivalent to ``x[newaxis]`` and ``x[None]``:
+
+ >>> x[newaxis, :].shape
+ (1, 3)
+ >>> x[newaxis].shape
+ (1, 3)
+ >>> x[None].shape
+ (1, 3)
+ >>> x[:, newaxis].shape
+ (3, 1)
+
+ """)
+
+add_newdoc('numpy', 'NZERO',
+ """
+ IEEE 754 floating point representation of negative zero.
+
+ Returns
+ -------
+ y : float
+ A floating point representation of negative zero.
+
+ See Also
+ --------
+ PZERO : Defines positive zero.
+
+ isinf : Shows which elements are positive or negative infinity.
+
+ isposinf : Shows which elements are positive infinity.
+
+ isneginf : Shows which elements are negative infinity.
+
+ isnan : Shows which elements are Not a Number.
+
+ isfinite : Shows which elements are finite - not one of
+ Not a Number, positive infinity and negative infinity.
+
+ Notes
+ -----
+ NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic
+ (IEEE 754). Negative zero is considered to be a finite number.
+
+ Examples
+ --------
+ >>> np.NZERO
+ -0.0
+ >>> np.PZERO
+ 0.0
+
+ >>> np.isfinite([np.NZERO])
+ array([ True])
+ >>> np.isnan([np.NZERO])
+ array([False])
+ >>> np.isinf([np.NZERO])
+ array([False])
+
+ """)
+
+add_newdoc('numpy', 'PZERO',
+ """
+ IEEE 754 floating point representation of positive zero.
+
+ Returns
+ -------
+ y : float
+ A floating point representation of positive zero.
+
+ See Also
+ --------
+ NZERO : Defines negative zero.
+
+ isinf : Shows which elements are positive or negative infinity.
+
+ isposinf : Shows which elements are positive infinity.
+
+ isneginf : Shows which elements are negative infinity.
+
+ isnan : Shows which elements are Not a Number.
+
+ isfinite : Shows which elements are finite - not one of
+ Not a Number, positive infinity and negative infinity.
+
+ Notes
+ -----
+ NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic
+ (IEEE 754). Positive zero is considered to be a finite number.
+
+ Examples
+ --------
+ >>> np.PZERO
+ 0.0
+ >>> np.NZERO
+ -0.0
+
+ >>> np.isfinite([np.PZERO])
+ array([ True])
+ >>> np.isnan([np.PZERO])
+ array([False])
+ >>> np.isinf([np.PZERO])
+ array([False])
+
+ """)
+
+add_newdoc('numpy', 'NAN',
+ """
+ IEEE 754 floating point representation of Not a Number (NaN).
+
+ `NaN` and `NAN` are equivalent definitions of `nan`. Please use
+ `nan` instead of `NAN`.
+
+ See Also
+ --------
+ nan
+
+ """)
+
+add_newdoc('numpy', 'NaN',
+ """
+ IEEE 754 floating point representation of Not a Number (NaN).
+
+ `NaN` and `NAN` are equivalent definitions of `nan`. Please use
+ `nan` instead of `NaN`.
+
+ See Also
+ --------
+ nan
+
+ """)
+
+add_newdoc('numpy', 'NINF',
+ """
+ IEEE 754 floating point representation of negative infinity.
+
+ Returns
+ -------
+ y : float
+ A floating point representation of negative infinity.
+
+ See Also
+ --------
+ isinf : Shows which elements are positive or negative infinity
+
+ isposinf : Shows which elements are positive infinity
+
+ isneginf : Shows which elements are negative infinity
+
+ isnan : Shows which elements are Not a Number
+
+ isfinite : Shows which elements are finite (not one of Not a Number,
+ positive infinity and negative infinity)
+
+ Notes
+ -----
+ NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic
+ (IEEE 754). This means that Not a Number is not equivalent to infinity.
+ Also that positive infinity is not equivalent to negative infinity. But
+ infinity is equivalent to positive infinity.
+
+ Examples
+ --------
+ >>> np.NINF
+ -inf
+ >>> np.log(0)
+ -inf
+
+ """)
+
+add_newdoc('numpy', 'PINF',
+ """
+ IEEE 754 floating point representation of (positive) infinity.
+
+ Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for
+ `inf`. For more details, see `inf`.
+
+ See Also
+ --------
+ inf
+
+ """)
+
+add_newdoc('numpy', 'infty',
+ """
+ IEEE 754 floating point representation of (positive) infinity.
+
+ Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for
+ `inf`. For more details, see `inf`.
+
+ See Also
+ --------
+ inf
+
+ """)
+
+add_newdoc('numpy', 'Inf',
+ """
+ IEEE 754 floating point representation of (positive) infinity.
+
+ Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for
+ `inf`. For more details, see `inf`.
+
+ See Also
+ --------
+ inf
+
+ """)
+
+add_newdoc('numpy', 'Infinity',
+ """
+ IEEE 754 floating point representation of (positive) infinity.
+
+ Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for
+ `inf`. For more details, see `inf`.
+
+ See Also
+ --------
+ inf
+
+ """)
+
+
+if __doc__:
+ constants_str = []
+ constants.sort()
+ for name, doc in constants:
+ s = textwrap.dedent(doc).replace("\n", "\n ")
+
+ # Replace sections by rubrics
+ lines = s.split("\n")
+ new_lines = []
+ for line in lines:
+ m = re.match(r'^(\s+)[-=]+\s*$', line)
+ if m and new_lines:
+ prev = textwrap.dedent(new_lines.pop())
+ new_lines.append('%s.. rubric:: %s' % (m.group(1), prev))
+ new_lines.append('')
+ else:
+ new_lines.append(line)
+ s = "\n".join(new_lines)
+
+ # Done.
+ constants_str.append(""".. data:: %s\n %s""" % (name, s))
+ constants_str = "\n".join(constants_str)
+
+ __doc__ = __doc__ % dict(constant_list=constants_str)
+ del constants_str, name, doc
+ del line, lines, new_lines, m, s, prev
+
+del constants, add_newdoc
diff --git a/venv/lib/python3.9/site-packages/numpy/doc/ufuncs.py b/venv/lib/python3.9/site-packages/numpy/doc/ufuncs.py
new file mode 100644
index 00000000..c99e9abc
--- /dev/null
+++ b/venv/lib/python3.9/site-packages/numpy/doc/ufuncs.py
@@ -0,0 +1,137 @@
+"""
+===================
+Universal Functions
+===================
+
+Ufuncs are, generally speaking, mathematical functions or operations that are
+applied element-by-element to the contents of an array. That is, the result
+in each output array element only depends on the value in the corresponding
+input array (or arrays) and on no other array elements. NumPy comes with a
+large suite of ufuncs, and scipy extends that suite substantially. The simplest
+example is the addition operator: ::
+
+ >>> np.array([0,2,3,4]) + np.array([1,1,-1,2])
+ array([1, 3, 2, 6])
+
+The ufunc module lists all the available ufuncs in numpy. Documentation on
+the specific ufuncs may be found in those modules. This documentation is
+intended to address the more general aspects of ufuncs common to most of
+them. All of the ufuncs that make use of Python operators (e.g., +, -, etc.)
+have equivalent functions defined (e.g. add() for +)
+
+Type coercion
+=============
+
+What happens when a binary operator (e.g., +,-,\\*,/, etc) deals with arrays of
+two different types? What is the type of the result? Typically, the result is
+the higher of the two types. For example: ::
+
+ float32 + float64 -> float64
+ int8 + int32 -> int32
+ int16 + float32 -> float32
+ float32 + complex64 -> complex64
+
+There are some less obvious cases generally involving mixes of types
+(e.g. uints, ints and floats) where equal bit sizes for each are not
+capable of saving all the information in a different type of equivalent
+bit size. Some examples are int32 vs float32 or uint32 vs int32.
+Generally, the result is the higher type of larger size than both
+(if available). So: ::
+
+ int32 + float32 -> float64
+ uint32 + int32 -> int64
+
+Finally, the type coercion behavior when expressions involve Python
+scalars is different than that seen for arrays. Since Python has a
+limited number of types, combining a Python int with a dtype=np.int8
+array does not coerce to the higher type but instead, the type of the
+array prevails. So the rules for Python scalars combined with arrays is
+that the result will be that of the array equivalent the Python scalar
+if the Python scalar is of a higher 'kind' than the array (e.g., float
+vs. int), otherwise the resultant type will be that of the array.
+For example: ::
+
+ Python int + int8 -> int8
+ Python float + int8 -> float64
+
+ufunc methods
+=============
+
+Binary ufuncs support 4 methods.
+
+**.reduce(arr)** applies the binary operator to elements of the array in
+ sequence. For example: ::
+
+ >>> np.add.reduce(np.arange(10)) # adds all elements of array
+ 45
+
+For multidimensional arrays, the first dimension is reduced by default: ::
+
+ >>> np.add.reduce(np.arange(10).reshape(2,5))
+ array([ 5, 7, 9, 11, 13])
+
+The axis keyword can be used to specify different axes to reduce: ::
+
+ >>> np.add.reduce(np.arange(10).reshape(2,5),axis=1)
+ array([10, 35])
+
+**.accumulate(arr)** applies the binary operator and generates an
+equivalently shaped array that includes the accumulated amount for each
+element of the array. A couple examples: ::
+
+ >>> np.add.accumulate(np.arange(10))
+ array([ 0, 1, 3, 6, 10, 15, 21, 28, 36, 45])
+ >>> np.multiply.accumulate(np.arange(1,9))
+ array([ 1, 2, 6, 24, 120, 720, 5040, 40320])
+
+The behavior for multidimensional arrays is the same as for .reduce(),
+as is the use of the axis keyword).
+
+**.reduceat(arr,indices)** allows one to apply reduce to selected parts
+ of an array. It is a difficult method to understand. See the documentation
+ at:
+
+**.outer(arr1,arr2)** generates an outer operation on the two arrays arr1 and
+ arr2. It will work on multidimensional arrays (the shape of the result is
+ the concatenation of the two input shapes.: ::
+
+ >>> np.multiply.outer(np.arange(3),np.arange(4))
+ array([[0, 0, 0, 0],
+ [0, 1, 2, 3],
+ [0, 2, 4, 6]])
+
+Output arguments
+================
+
+All ufuncs accept an optional output array. The array must be of the expected
+output shape. Beware that if the type of the output array is of a different
+(and lower) type than the output result, the results may be silently truncated
+or otherwise corrupted in the downcast to the lower type. This usage is useful
+when one wants to avoid creating large temporary arrays and instead allows one
+to reuse the same array memory repeatedly (at the expense of not being able to
+use more convenient operator notation in expressions). Note that when the
+output argument is used, the ufunc still returns a reference to the result.
+
+ >>> x = np.arange(2)
+ >>> np.add(np.arange(2),np.arange(2.),x)
+ array([0, 2])
+ >>> x
+ array([0, 2])
+
+and & or as ufuncs
+==================
+
+Invariably people try to use the python 'and' and 'or' as logical operators
+(and quite understandably). But these operators do not behave as normal
+operators since Python treats these quite differently. They cannot be
+overloaded with array equivalents. Thus using 'and' or 'or' with an array
+results in an error. There are two alternatives:
+
+ 1) use the ufunc functions logical_and() and logical_or().
+ 2) use the bitwise operators & and \\|. The drawback of these is that if
+ the arguments to these operators are not boolean arrays, the result is
+ likely incorrect. On the other hand, most usages of logical_and and
+ logical_or are with boolean arrays. As long as one is careful, this is
+ a convenient way to apply these operators.
+
+"""