Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor documentation tweaks #499

Merged
merged 6 commits into from
Aug 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
# NOTE: Fake ternary operator, see https://github.com/actions/runner/issues/409
fetch-depth: 0 # Fetch all commits and tags, needed for intermediate versions

- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.11

- name: Upgrade pip
run: python3 -m pip install --upgrade pip
Expand Down
51 changes: 24 additions & 27 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
.. py:module:: galois

galois
======

Arrays
------
======

.. python-apigen-group:: arrays

Galois fields
-------------
=============

.. python-apigen-group:: galois-fields

Primitive elements
..................
------------------

.. python-apigen-group:: galois-fields-primitive-elements

Polynomials
-----------
===========

.. python-apigen-group:: polys

Expand All @@ -28,97 +25,97 @@ Polynomials
The :ref:`number-theory` section contains many functions that operate on polynomials.

Irreducible polynomials
.......................
-----------------------

.. python-apigen-group:: polys-irreducible

Primitive polynomials
.....................
---------------------

.. python-apigen-group:: polys-primitive

Interpolating polynomials
.........................
-------------------------

.. python-apigen-group:: polys-interpolating

Forward error correction
------------------------
========================

.. python-apigen-group:: fec

Linear sequences
----------------
================

.. python-apigen-group:: linear-sequences

Transforms
----------
==========

.. python-apigen-group:: transforms

.. _number-theory:

Number theory
-------------
=============

Divisibility
............
------------

.. python-apigen-group:: number-theory-divisibility

Congruences
...........
-----------

.. python-apigen-group:: number-theory-congruences

Primitive roots
...............
---------------

.. python-apigen-group:: number-theory-primitive-roots

Integer arithmetic
..................
------------------

.. python-apigen-group:: number-theory-integer

Factorization
-------------
=============

Prime factorization
...................
-------------------

.. python-apigen-group:: factorization-prime

Composite factorization
.......................
-----------------------

.. python-apigen-group:: factorization-composite

Specific factorization algorithms
.................................
---------------------------------

.. python-apigen-group:: factorization-specific

Primes
------
======

Prime number generation
.......................
-----------------------

.. python-apigen-group:: primes-generation

Primality tests
...............
---------------

.. python-apigen-group:: primes-tests

Specific primality tests
........................
------------------------

.. python-apigen-group:: primes-specific-tests

Configuration
-------------
=============

.. python-apigen-group:: config
16 changes: 8 additions & 8 deletions docs/basic-usage/array-arithmetic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Array Arithmetic
After creating a :obj:`~galois.FieldArray` subclass and one or two arrays, nearly any arithmetic operation can be
performed using normal NumPy ufuncs or Python operators.

In the sections below, the finite field :math:`\mathrm{GF}(3^5)` and arrays :math:`x` and :math:`y` are used.
In the sections below, the finite field $\mathrm{GF}(3^5)$ and arrays $x$ and $y$ are used.

.. ipython:: python

Expand Down Expand Up @@ -81,7 +81,7 @@ Expand any section for more details.
np.multiply(x, 4)
x + x + x + x

In finite fields :math:`\mathrm{GF}(p^m)`, the characteristic :math:`p` is the smallest value when multiplied by
In finite fields $\mathrm{GF}(p^m)$, the characteristic $p$ is the smallest value when multiplied by
any non-zero field element that results in 0.

.. ipython-with-reprs:: int,poly,power
Expand Down Expand Up @@ -168,7 +168,7 @@ Expand any section for more details.
.. example:: Logarithm: `np.log(x)` or `x.log()`
:collapsible:

Compute the logarithm base :math:`\alpha`, the primitive element of the field.
Compute the logarithm base $\alpha$, the primitive element of the field.

.. ipython-with-reprs:: int,poly,power

Expand All @@ -177,7 +177,7 @@ Expand any section for more details.
alpha = GF.primitive_element; alpha
alpha ** z == y

Compute the logarithm base :math:`\beta`, a different primitive element of the field. See :func:`FieldArray.log`
Compute the logarithm base $\beta$, a different primitive element of the field. See :func:`FieldArray.log`
for more details.

.. ipython-with-reprs:: int,poly,power
Expand Down Expand Up @@ -291,8 +291,8 @@ Advanced arithmetic
.. example:: FFT: `np.fft.fft(x)`
:collapsible:

The Discrete Fourier Transform (DFT) of size :math:`n` over the finite field :math:`\mathrm{GF}(p^m)` exists when
there exists a primitive :math:`n`-th root of unity. This occurs when :math:`n\ |\ p^m - 1`.
The Discrete Fourier Transform (DFT) of size $n$ over the finite field $\mathrm{GF}(p^m)$ exists when
there exists a primitive $n$-th root of unity. This occurs when $n\ |\ p^m - 1$.

.. ipython-with-reprs:: int,poly,power

Expand All @@ -309,8 +309,8 @@ Advanced arithmetic
.. example:: Inverse FFT: `np.fft.ifft(X)`
:collapsible:

The inverse Discrete Fourier Transform (DFT) of size :math:`n` over the finite field :math:`\mathrm{GF}(p^m)`
exists when there exists a primitive :math:`n`-th root of unity. This occurs when :math:`n\ |\ p^m - 1`.
The inverse Discrete Fourier Transform (DFT) of size $n$ over the finite field $\mathrm{GF}(p^m)$
exists when there exists a primitive $n$-th root of unity. This occurs when $n\ |\ p^m - 1$.

.. ipython-with-reprs:: int,poly,power

Expand Down
14 changes: 7 additions & 7 deletions docs/basic-usage/array-classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The :obj:`galois` library subclasses :obj:`~numpy.ndarray` to provide arithmetic

The main abstract base class is :obj:`~galois.Array`. It has two abstract subclasses: :obj:`~galois.FieldArray` and
:obj:`~galois.RingArray` (future). None of these abstract classes may be instantiated directly. Instead, specific
subclasses for :math:`\mathrm{GF}(p^m)` and :math:`\mathrm{GR}(p^e, m)` are created at runtime with :func:`~galois.GF`
subclasses for $\mathrm{GF}(p^m)$ and $\mathrm{GR}(p^e, m)$ are created at runtime with :func:`~galois.GF`
and :func:`~galois.GR` (future).

:obj:`~galois.FieldArray` subclasses
Expand All @@ -26,7 +26,7 @@ A :obj:`~galois.FieldArray` subclass is created using the class factory function
:collapsible:

For very large finite fields, the :obj:`~galois.FieldArray` subclass creation time can be reduced by explicitly specifying
:math:`p` and :math:`m`. This eliminates the need to factor the order :math:`p^m`.
$p$ and $m$. This eliminates the need to factor the order $p^m$.

.. ipython:: python

Expand All @@ -35,7 +35,7 @@ A :obj:`~galois.FieldArray` subclass is created using the class factory function

Furthermore, if you already know the desired irreducible polynomial is irreducible and the primitive element is a generator of
the multiplicative group, you can specify `verify=False` to skip the verification step. This eliminates the need to factor
:math:`p^m - 1`.
$p^m - 1$.

.. ipython:: python

Expand All @@ -57,16 +57,16 @@ Class singletons

:obj:`~galois.FieldArray` subclasses of the same type (order, irreducible polynomial, and primitive element) are singletons.

Here is the creation (twice) of the field :math:`\mathrm{GF}(3^5)` defined with the default irreducible
polynomial :math:`x^5 + 2x + 1`. They *are* the same class (a singleton), not just equivalent classes.
Here is the creation (twice) of the field $\mathrm{GF}(3^5)$ defined with the default irreducible
polynomial $x^5 + 2x + 1$. They *are* the same class (a singleton), not just equivalent classes.

.. ipython:: python

galois.GF(3**5) is galois.GF(3**5)

The expense of class creation is incurred only once. So, subsequent calls of `galois.GF(3**5)` are extremely inexpensive.

However, the field :math:`\mathrm{GF}(3^5)` defined with irreducible polynomial :math:`x^5 + x^2 + x + 2`, while isomorphic to the
However, the field $\mathrm{GF}(3^5)$ defined with irreducible polynomial $x^5 + x^2 + x + 2$, while isomorphic to the
first field, has different arithmetic. As such, :func:`~galois.GF` returns a unique :obj:`~galois.FieldArray` subclass.

.. ipython:: python
Expand All @@ -76,7 +76,7 @@ first field, has different arithmetic. As such, :func:`~galois.GF` returns a uni
Methods and properties
......................

All of the methods and properties related to :math:`\mathrm{GF}(p^m)`, not one of its arrays, are documented as class methods
All of the methods and properties related to $\mathrm{GF}(p^m)$, not one of its arrays, are documented as class methods
and class properties in :obj:`~galois.FieldArray`. For example, the irreducible polynomial of the finite field is accessed
with :obj:`~galois.FieldArray.irreducible_poly`.

Expand Down
16 changes: 8 additions & 8 deletions docs/basic-usage/array-creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Array Creation
==============

This page discusses the multiple ways to create arrays over finite fields. For this discussion, we are working in
the finite field :math:`\mathrm{GF}(3^5)`.
the finite field $\mathrm{GF}(3^5)$.

.. ipython-with-reprs:: int,poly,power

Expand Down Expand Up @@ -41,15 +41,15 @@ A finite field array may also be created by exponentiating the primitive element
Polynomial coefficients
.......................

Rather than strings, the polynomial coefficients may be passed into `GF`'s constructor as length-:math:`m` vectors using
Rather than strings, the polynomial coefficients may be passed into `GF`'s constructor as length-$m$ vectors using
the :func:`~galois.FieldArray.Vector` classmethod.

.. ipython-with-reprs:: int,poly,power

GF.Vector([[0, 0, 1, 2, 2], [0, 0, 0, 1, 1]])

The :func:`~galois.FieldArray.vector` method is the opposite operation. It converts extension field elements from :math:`\mathrm{GF}(p^m)`
into length-:math:`m` vectors over :math:`\mathrm{GF}(p)`.
The :func:`~galois.FieldArray.vector` method is the opposite operation. It converts extension field elements from $\mathrm{GF}(p^m)$
into length-$m$ vectors over $\mathrm{GF}(p)$.

.. ipython-with-reprs:: int,poly,power

Expand Down Expand Up @@ -104,7 +104,7 @@ useful for initializing empty arrays.
:title: There is no :func:`numpy.empty` equivalent.
:collapsible:

This is because :obj:`~galois.FieldArray` instances must have values in :math:`[0, p^m)`. Empty NumPy arrays have whatever values
This is because :obj:`~galois.FieldArray` instances must have values in $[0, p^m)$. Empty NumPy arrays have whatever values
are currently in memory, and therefore would fail those bounds checks during instantiation.

Ordered arrays
Expand Down Expand Up @@ -153,22 +153,22 @@ able to store all the field elements (in their :ref:`integer representation <int
Valid data types
................

For small finite fields, like :math:`\mathrm{GF}(2^4)`, every NumPy integer data type is supported.
For small finite fields, like $\mathrm{GF}(2^4)$, every NumPy integer data type is supported.

.. ipython:: python

GF = galois.GF(2**4)
GF.dtypes

For medium finite fields, like :math:`\mathrm{GF}(2^{10})`, some NumPy integer data types are not supported. Here,
For medium finite fields, like $\mathrm{GF}(2^{10})$, some NumPy integer data types are not supported. Here,
:obj:`numpy.uint8` and :obj:`numpy.int8` are not supported.

.. ipython:: python

GF = galois.GF(2**10)
GF.dtypes

For large finite fields, like :math:`\mathrm{GF}(2^{100})`, only the "object" data type (:obj:`numpy.object_`) is
For large finite fields, like $\mathrm{GF}(2^{100})$, only the "object" data type (:obj:`numpy.object_`) is
supported. This uses arrays of Python objects, rather than integer data types. The Python objects used are Python integers,
which have unlimited size.

Expand Down
Loading