Skip to content

Commit

Permalink
Fix indentation of code blocks in bulleted lists
Browse files Browse the repository at this point in the history
  • Loading branch information
mhostetter committed May 11, 2022
1 parent 8d71f8a commit c98df85
Showing 1 changed file with 65 additions and 65 deletions.
130 changes: 65 additions & 65 deletions galois/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,28 @@
- :obj:`int`: A finite field element in its :ref:`integer representation <int repr>`.
.. ipython:: python
.. ipython:: python
GF = galois.GF(3**5)
GF(17)
GF = galois.GF(3**5)
GF(17)
- :obj:`str`: A finite field element in its :ref:`polynomial representation <poly repr>`. Many string conventions are
accepted, including: with/without `*`, with/without spaces, `^` or `**`, any indeterminate variable, increasing/decreasing
degrees, etc. Or any combination of the above.
.. ipython:: python
.. ipython:: python
GF("x^2 + 2x + 2")
# Add explicit * for multiplication
GF("x^2 + 2*x + 2")
# No spaces
GF("x^2+2x+2")
# ** instead of ^
GF("x**2 + 2x + 2")
# Different indeterminate
GF("α^2 + 2α + 2")
# Ascending degrees
GF("2 + 2x + x^2")
GF("x^2 + 2x + 2")
# Add explicit * for multiplication
GF("x^2 + 2*x + 2")
# No spaces
GF("x^2+2x+2")
# ** instead of ^
GF("x**2 + 2x + 2")
# Different indeterminate
GF("α^2 + 2α + 2")
# Ascending degrees
GF("2 + 2x + x^2")
- :obj:`~galois.Array`: A previously-created scalar :obj:`~galois.Array` object. No coercion is necessary.
Expand All @@ -60,21 +60,21 @@
- :obj:`~typing.Sequence` [ :obj:`~galois.typing.ElementLike` ]: An iterable of elements.
.. ipython:: python
.. ipython:: python
GF = galois.GF(3**5)
GF([17, 4])
# Mix and match integers and strings
GF([17, "x + 1"])
GF = galois.GF(3**5)
GF([17, 4])
# Mix and match integers and strings
GF([17, "x + 1"])
- :obj:`~typing.Sequence` [ :obj:`~galois.typing.IterableLike` ]: A recursive iterable of iterables of elements.
.. ipython:: python
.. ipython:: python
GF = galois.GF(3**5)
GF([[17, 4], [148, 205]])
# Mix and match integers and strings
GF([["x^2 + 2x + 2", 4], ["x^4 + 2x^3 + x^2 + x + 1", 205]])
GF = galois.GF(3**5)
GF([[17, 4], [148, 205]])
# Mix and match integers and strings
GF([["x^2 + 2x + 2", 4], ["x^4 + 2x^3 + x^2 + x + 1", 205]])
.. rubric:: Alias
"""
Expand All @@ -88,19 +88,19 @@
- :obj:`~galois.typing.IterableLike`: A recursive iterable of iterables of elements.
.. ipython:: python
.. ipython:: python
GF = galois.GF(3**5)
GF([[17, 4], [148, 205]])
# Mix and match integers and strings
GF([["x^2 + 2x + 2", 4], ["x^4 + 2x^3 + x^2 + x + 1", 205]])
GF = galois.GF(3**5)
GF([[17, 4], [148, 205]])
# Mix and match integers and strings
GF([["x^2 + 2x + 2", 4], ["x^4 + 2x^3 + x^2 + x + 1", 205]])
- :obj:`~numpy.ndarray`: A NumPy array of integers, representing finite field elements in their :ref:`integer representation <int repr>`.
.. ipython:: python
.. ipython:: python
x = np.array([[17, 4], [148, 205]]); x
GF(x)
x = np.array([[17, 4], [148, 205]]); x
GF(x)
- :obj:`~galois.Array`: A previously-created :obj:`~galois.Array` object. No coercion is necessary.
Expand All @@ -116,23 +116,23 @@
- :obj:`int`: The size of a 1-D array.
.. ipython:: python
.. ipython:: python
GF = galois.GF(3**5)
x = GF.Random(4); x
x.shape
GF = galois.GF(3**5)
x = GF.Random(4); x
x.shape
- :obj:`~typing.Sequence` [ :obj:`int` ]: An iterable of integer dimensions. Tuples or lists are allowed. An empty iterable, `()` or `[]`,
represents a 0-D array (scalar).
.. ipython:: python
.. ipython:: python
x = GF.Random((2, 3)); x
x.shape
x = GF.Random([2, 3, 4]); x
x.shape
x = GF.Random(()); x
x.shape
x = GF.Random((2, 3)); x
x.shape
x = GF.Random([2, 3, 4]); x
x.shape
x = GF.Random(()); x
x.shape
.. rubric:: Alias
"""
Expand All @@ -146,31 +146,31 @@
- :obj:`numpy.integer`: A fixed-width NumPy integer data type.
.. ipython:: python
.. ipython:: python
GF = galois.GF(3**5)
x = GF.Random(4, dtype=np.uint16); x.dtype
x = GF.Random(4, dtype=np.int32); x.dtype
GF = galois.GF(3**5)
x = GF.Random(4, dtype=np.uint16); x.dtype
x = GF.Random(4, dtype=np.int32); x.dtype
- :obj:`int`: The system default integer.
.. ipython:: python
.. ipython:: python
x = GF.Random(4, dtype=int); x.dtype
x = GF.Random(4, dtype=int); x.dtype
- :obj:`str`: The string that can be coerced with :obj:`numpy.dtype`.
.. ipython:: python
.. ipython:: python
x = GF.Random(4, dtype="uint16"); x.dtype
x = GF.Random(4, dtype="int32"); x.dtype
x = GF.Random(4, dtype="uint16"); x.dtype
x = GF.Random(4, dtype="int32"); x.dtype
- :obj:`object`: A Python object data type. This applies to non-compiled fields.
.. ipython:: python
.. ipython:: python
GF = galois.GF(2**100)
x = GF.Random(4, dtype=object); x.dtype
GF = galois.GF(2**100)
x = GF.Random(4, dtype=object); x.dtype
.. rubric:: Alias
"""
Expand All @@ -184,25 +184,25 @@
- :obj:`int`: A polynomial in its integer representation, see :func:`~galois.Poly.Int`. The Galois field must be known from context.
.. ipython:: python
.. ipython:: python
# Known from context
GF = galois.GF(3)
galois.Poly.Int(19, field=GF)
# Known from context
GF = galois.GF(3)
galois.Poly.Int(19, field=GF)
- :obj:`str`: A polynomial in its string representation, see :func:`~galois.Poly.Str`. The Galois field must be known from context.
.. ipython:: python
.. ipython:: python
galois.Poly.Str("2x^2 + 1", field=GF)
galois.Poly.Str("2x^2 + 1", field=GF)
- :obj:`~galois.typing.ArrayLike`: An array of polynomial coefficients in degree-descending order. If the coefficients are not
:obj:`~galois.Array`, then the Galois field must be known from context.
.. ipython:: python
.. ipython:: python
galois.Poly([2, 0, 1], field=GF)
galois.Poly(GF([2, 0, 1]))
galois.Poly([2, 0, 1], field=GF)
galois.Poly(GF([2, 0, 1]))
- :obj:`~galois.Poly`: A previously-created :obj:`~galois.Poly` object. No coercion is necessary.
Expand Down

0 comments on commit c98df85

Please sign in to comment.