From f49b458b936ccd9eef2d86a2219a3e1cc324481f Mon Sep 17 00:00:00 2001 From: mhostetter Date: Wed, 3 Jul 2024 19:32:33 -0400 Subject: [PATCH] Remove hyphens for adverbs ending in "ly" --- README.md | 2 +- docs/index.rst | 2 +- docs/release-notes/v0.0.md | 10 ++++----- docs/release-notes/v0.3.md | 2 +- src/galois/_fields/_array.py | 2 +- src/galois/_fields/_factory.py | 6 +++--- src/galois/_polys/_conway.py | 10 ++++----- src/galois/_polys/_dense.py | 4 ++-- src/galois/_polys/_factor.py | 2 +- src/galois/_polys/_irreducible.py | 12 +++++------ src/galois/_polys/_primitive.py | 26 +++++++++++------------ src/galois/_prime.py | 4 ++-- src/galois/typing.py | 6 +++--- tests/fields/test_classes.py | 2 +- tests/polys/luts/irreducible_polys_min.py | 2 +- 15 files changed, 46 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 889654002..872cf1e96 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The new ufuncs are written in pure Python and [just-in-time compiled](https://nu ## Features -- Supports all [Galois fields](https://mhostetter.github.io/galois/latest/api/galois.GF/) $\mathrm{GF}(p^m)$, even arbitrarily-large fields! +- Supports all [Galois fields](https://mhostetter.github.io/galois/latest/api/galois.GF/) $\mathrm{GF}(p^m)$, even arbitrarily large fields! - [**Faster**](https://mhostetter.github.io/galois/latest/performance/prime-fields/) than native NumPy! `GF(x) * GF(y)` is faster than `(x * y) % p` for $\mathrm{GF}(p)$. - Seamless integration with NumPy -- normal NumPy functions work on [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/)s. - Linear algebra over finite fields using normal [`np.linalg`](https://mhostetter.github.io/galois/latest/basic-usage/array-arithmetic/#linear-algebra) functions. diff --git a/docs/index.rst b/docs/index.rst index 1e7af191a..531607d2a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -40,7 +40,7 @@ calculation (for memory savings). Features -------- -- Supports all Galois fields $\mathrm{GF}(p^m)$, even arbitrarily-large fields! +- Supports all Galois fields $\mathrm{GF}(p^m)$, even arbitrarily large fields! - **Faster** than native NumPy! `GF(x) * GF(y)` is faster than `(x * y) % p` for $\mathrm{GF}(p)$. - Seamless integration with NumPy -- normal NumPy functions work on :obj:`~galois.FieldArray` instances. - Linear algebra over finite fields using normal :obj:`numpy.linalg` functions. diff --git a/docs/release-notes/v0.0.md b/docs/release-notes/v0.0.md index 8da4e5d0f..129427b46 100644 --- a/docs/release-notes/v0.0.md +++ b/docs/release-notes/v0.0.md @@ -307,7 +307,7 @@ Poly(1, GF(2)) - Allow polynomial comparison with integers and field scalars. Now `galois.Poly([0]) == 0` and `galois.Poly([0]) == GF(0)` return `True` rather than raising `TypeError`. - Support testing 0-degree polynomials for irreducibility and primitivity. - Extend `crt()` to work over non co-prime moduli. -- Extend `prev_prime()` and `next_prime()` to work over arbitrarily-large inputs. +- Extend `prev_prime()` and `next_prime()` to work over arbitrarily large inputs. - Allow negative integer inputs to `primes()`, `is_prime()`, `is_composite()`, `is_prime_power()`, `is_perfect_power()`, `is_square_free()`, `is_smooth()`, and `is_powersmooth()`. - Fix various type hinting errors. - Various other bug fixes. @@ -715,8 +715,8 @@ Poly(1, GF(2)) - Moved `galois.square_free_factorization()` function into `Poly.square_free_factors()` method. ([#362](https://github.com/mhostetter/galois/pull/362)) - Moved `galois.distinct_degree_factorization()` function into `Poly.distinct_degree_factors()` method. ([#362](https://github.com/mhostetter/galois/pull/362)) - Moved `galois.equal_degree_factorization()` function into `Poly.equal_degree_factors()` method. ([#362](https://github.com/mhostetter/galois/pull/362)) -- Moved `galois.is_irreducible()` function into `Poly.is_irreducible()` method. This is a method, not property, to indicate it is a computationally-expensive operation. ([#362](https://github.com/mhostetter/galois/pull/362)) -- Moved `galois.is_primitive()` function into `Poly.is_primitive()` method. This is a method, not property, to indicate it is a computationally-expensive operation. ([#362](https://github.com/mhostetter/galois/pull/362)) +- Moved `galois.is_irreducible()` function into `Poly.is_irreducible()` method. This is a method, not property, to indicate it is a computationally expensive operation. ([#362](https://github.com/mhostetter/galois/pull/362)) +- Moved `galois.is_primitive()` function into `Poly.is_primitive()` method. This is a method, not property, to indicate it is a computationally expensive operation. ([#362](https://github.com/mhostetter/galois/pull/362)) - Moved `galois.is_monic()` function into `Poly.is_monic` property. ([#362](https://github.com/mhostetter/galois/pull/362)) ### Changes @@ -742,7 +742,7 @@ Poly(1, GF(2)) - Added `galois.get_printoptions()` function to return the current package-wide printing options. This is the equivalent of `np.get_printoptions()`. ([#363](https://github.com/mhostetter/galois/pull/363)) - Added `galois.printoptions()` context manager to modify printing options inside of a `with` statement. This is the equivalent of `np.printoptions()`. ([#363](https://github.com/mhostetter/galois/pull/363)) - Added a separate `Poly.factors()` method, in addition to the polymorphic `galois.factors()`. ([#362](https://github.com/mhostetter/galois/pull/362)) -- Added a separate `Poly.is_square_free()` method, in addition to the polymorphic `galois.is_square_free()`. This is a method, not property, to indicate it is a computationally-expensive operation. ([#362](https://github.com/mhostetter/galois/pull/362)) +- Added a separate `Poly.is_square_free()` method, in addition to the polymorphic `galois.is_square_free()`. This is a method, not property, to indicate it is a computationally expensive operation. ([#362](https://github.com/mhostetter/galois/pull/362)) - Fixed a bug (believed to be introduced in v0.0.26) where `Poly.degree` occasionally returned `np.int64` instead of `int`. This could cause overflow in certain large integer operations (e.g., computing $q^m$ when determining if a degree-$m$ polynomial over $\mathrm{GF}(q)$ is irreducible). When the integer overflowed, this created erroneous results. ([#360](https://github.com/mhostetter/galois/issues/360), [#361](https://github.com/mhostetter/galois/pull/361)) - Increased code coverage. @@ -756,7 +756,7 @@ Poly(1, GF(2)) ### Changes -- Added support for NumPy 1.22 with Numba 0.55.2. This allows users to upgrade NumPy and avoid recently-discovered vulnerabilities [CVE-2021-34141](https://nvd.nist.gov/vuln/detail/CVE-2021-34141), [CVE-2021-41496](https://nvd.nist.gov/vuln/detail/CVE-2021-41496), and [CVE-2021-41495](https://nvd.nist.gov/vuln/detail/CVE-2021-41495). ([#366](https://github.com/mhostetter/galois/pull/366)) +- Added support for NumPy 1.22 with Numba 0.55.2. This allows users to upgrade NumPy and avoid recently discovered vulnerabilities [CVE-2021-34141](https://nvd.nist.gov/vuln/detail/CVE-2021-34141), [CVE-2021-41496](https://nvd.nist.gov/vuln/detail/CVE-2021-41496), and [CVE-2021-41495](https://nvd.nist.gov/vuln/detail/CVE-2021-41495). ([#366](https://github.com/mhostetter/galois/pull/366)) - Made `FieldArray.repr_table()` more compact. ([#367](https://github.com/mhostetter/galois/pull/367)) ```ipython In [2]: GF = galois.GF(3**3) diff --git a/docs/release-notes/v0.3.md b/docs/release-notes/v0.3.md index 2d6235245..ed0784991 100644 --- a/docs/release-notes/v0.3.md +++ b/docs/release-notes/v0.3.md @@ -173,7 +173,7 @@ tocdepth: 2 Poly(x^9 + 3x^2 + 4, GF(7)) ``` - Added a database of binary irreducible polynomials with degrees less than 10,000. These polynomials are - lexicographically-first and have the minimum number of non-zero terms. The database is accessed in + lexicographically first and have the minimum number of non-zero terms. The database is accessed in `irreducible_poly()` when `terms="min"` and `method="min"`. ([#462](https://github.com/mhostetter/galois/pull/462)) ```ipython In [1]: import galois diff --git a/src/galois/_fields/_array.py b/src/galois/_fields/_array.py index 2895a4563..3a074bc92 100644 --- a/src/galois/_fields/_array.py +++ b/src/galois/_fields/_array.py @@ -128,7 +128,7 @@ def _verify_array_like_types_and_values(cls, x: ElementLike | ArrayLike) -> Elem if isinstance(x, (int, np.integer)): cls._verify_scalar_value(x) elif isinstance(x, cls): - # This was a previously-created and vetted array -- there's no need to re-verify + # This was a previously created and vetted array -- there's no need to re-verify if x.ndim == 0: # Ensure that in "large" fields with dtype=object that FieldArray objects aren't assigned to the array. # The arithmetic functions are designed to operate on Python ints. diff --git a/src/galois/_fields/_factory.py b/src/galois/_fields/_factory.py index caf19b1b9..4327b42f1 100644 --- a/src/galois/_fields/_factory.py +++ b/src/galois/_fields/_factory.py @@ -88,7 +88,7 @@ def GF( :func:`~galois.FieldArray.compile` method. See :doc:`/basic-usage/compilation-modes` for a further discussion. - - `None` (default): For a newly-created :obj:`~galois.FieldArray` subclass, `None` corresponds to + - `None` (default): For a newly created :obj:`~galois.FieldArray` subclass, `None` corresponds to `"auto"`. If the :obj:`~galois.FieldArray` subclass already exists, `None` does not modify its current compilation mode. - `"auto"`: Selects `"jit-lookup"` for fields with order less than $2^{20}$, `"jit-calculate"` for @@ -109,7 +109,7 @@ def GF( :func:`~galois.FieldArray.repr` method. See :doc:`/basic-usage/element-representation` for a further discussion. - - `None` (default): For a newly-created :obj:`~galois.FieldArray` subclass, `None` corresponds to `"int"`. + - `None` (default): For a newly created :obj:`~galois.FieldArray` subclass, `None` corresponds to `"int"`. If the :obj:`~galois.FieldArray` subclass already exists, `None` does not modify its current element representation. - `"int"`: Sets the element representation to the :ref:`integer representation `. @@ -191,7 +191,7 @@ def GF( GF = galois.GF(3**5, irreducible_poly="x^5 + 2x + 2") print(GF.properties) - Finite fields with arbitrarily-large orders are supported. + Finite fields with arbitrarily large orders are supported. .. md-tab-set:: diff --git a/src/galois/_polys/_conway.py b/src/galois/_polys/_conway.py index f2c2c6d0f..23710c929 100644 --- a/src/galois/_polys/_conway.py +++ b/src/galois/_polys/_conway.py @@ -24,7 +24,7 @@ def is_conway(f: Poly, search: bool = False) -> bool: .. question:: Why is this a method and not a property? :collapsible: - This is a method to indicate it is a computationally-expensive task. + This is a method to indicate it is a computationally expensive task. Arguments: search: Manually search for Conway polynomials if they are not included in `Frank Luebeck's database @@ -81,7 +81,7 @@ def is_conway(f: Poly, search: bool = False) -> bool: f.is_conway_consistent() g.is_conway_consistent() - Among the multiple candidate Conway polynomials, the lexicographically-first (accordingly to a special + Among the multiple candidate Conway polynomials, the lexicographically first (accordingly to a special lexicographical order) is the Conway polynomial. .. ipython:: python @@ -111,7 +111,7 @@ def is_conway_consistent(f: Poly, search: bool = False) -> bool: .. question:: Why is this a method and not a property? :collapsible: - This is a method to indicate it is a computationally-expensive task. + This is a method to indicate it is a computationally expensive task. Arguments: search: Manually search for Conway polynomials if they are not included in `Frank Luebeck's database @@ -164,7 +164,7 @@ def is_conway_consistent(f: Poly, search: bool = False) -> bool: f.is_conway_consistent() g.is_conway_consistent() - Among the multiple candidate Conway polynomials, the lexicographically-first (accordingly to a special + Among the multiple candidate Conway polynomials, the lexicographically first (accordingly to a special lexicographical order) is the Conway polynomial. .. ipython:: python @@ -268,7 +268,7 @@ def conway_poly(characteristic: int, degree: int, search: bool = False) -> Poly: f.is_conway_consistent() g.is_conway_consistent() - Among the multiple candidate Conway polynomials, the lexicographically-first (accordingly to a special + Among the multiple candidate Conway polynomials, the lexicographically first (accordingly to a special lexicographical order) is the Conway polynomial. .. ipython:: python diff --git a/src/galois/_polys/_dense.py b/src/galois/_polys/_dense.py index 6edd1e80e..c7a5fca35 100644 --- a/src/galois/_polys/_dense.py +++ b/src/galois/_polys/_dense.py @@ -335,7 +335,7 @@ def __call__(self, a: Array, b: int, c: Array | None = None) -> Array: assert a.ndim == 1 and c.ndim == 1 if c is not None else True dtype = a.dtype - # Convert the integer b into a vector of uint64 [MSWord, ..., LSWord] so arbitrarily-large exponents may be + # Convert the integer b into a vector of uint64 [MSWord, ..., LSWord] so arbitrarily large exponents may be # passed into the JIT-compiled version b_vec = [] # Pop on LSWord -> MSWord while b >= 2**64: @@ -366,7 +366,7 @@ def set_globals(self): @staticmethod def implementation(a, b_vec, c): """ - b is a vector of uint64 [MSWord, ..., LSWord] so that arbitrarily-large exponents may be passed + b is a vector of uint64 [MSWord, ..., LSWord] so that arbitrarily large exponents may be passed """ if b_vec.size == 1 and b_vec[0] == 0: return np.array([1], dtype=a.dtype) diff --git a/src/galois/_polys/_factor.py b/src/galois/_polys/_factor.py index 3922edfed..59a440630 100644 --- a/src/galois/_polys/_factor.py +++ b/src/galois/_polys/_factor.py @@ -19,7 +19,7 @@ def is_square_free(f) -> bool: .. question:: Why is this a method and not a property? :collapsible: - This is a method to indicate it is a computationally-expensive task. + This is a method to indicate it is a computationally expensive task. Returns: `True` if the polynomial is square-free. diff --git a/src/galois/_polys/_irreducible.py b/src/galois/_polys/_irreducible.py index 769548064..e0541ef43 100644 --- a/src/galois/_polys/_irreducible.py +++ b/src/galois/_polys/_irreducible.py @@ -33,7 +33,7 @@ def is_irreducible(f: Poly) -> bool: .. question:: Why is this a method and not a property? :collapsible: - This is a method to indicate it is a computationally-expensive task. + This is a method to indicate it is a computationally expensive task. Returns: `True` if the polynomial is irreducible. @@ -145,8 +145,8 @@ def irreducible_poly( method: The search method for finding the irreducible polynomial. - - `"min"` (default): Returns the lexicographically-first polynomial. - - `"max"`: Returns the lexicographically-last polynomial. + - `"min"` (default): Returns the lexicographically first polynomial. + - `"max"`: Returns the lexicographically last polynomial. - `"random"`: Returns a random polynomial. .. fast-performance:: @@ -176,7 +176,7 @@ def irreducible_poly( $\mathrm{GF}(q)$. Examples: - Find the lexicographically-first, lexicographically-last, and a random monic irreducible polynomial. + Find the lexicographically first, lexicographically last, and a random monic irreducible polynomial. .. ipython:: python @@ -184,13 +184,13 @@ def irreducible_poly( galois.irreducible_poly(7, 3, method="max") galois.irreducible_poly(7, 3, method="random") - Find the lexicographically-first monic irreducible polynomial with four terms. + Find the lexicographically first monic irreducible polynomial with four terms. .. ipython:: python galois.irreducible_poly(7, 3, terms=4) - Find the lexicographically-first monic irreducible polynomial with the minimum number of non-zero terms. + Find the lexicographically first monic irreducible polynomial with the minimum number of non-zero terms. .. ipython:: python diff --git a/src/galois/_polys/_primitive.py b/src/galois/_polys/_primitive.py index 3c0ae4cf4..d97fa038f 100644 --- a/src/galois/_polys/_primitive.py +++ b/src/galois/_polys/_primitive.py @@ -32,7 +32,7 @@ def is_primitive(f: Poly) -> bool: .. question:: Why is this a method and not a property? :collapsible: - This is a method to indicate it is a computationally-expensive task. + This is a method to indicate it is a computationally expensive task. Returns: `True` if the polynomial is primitive. @@ -125,8 +125,8 @@ def primitive_poly( method: The search method for finding the primitive polynomial. - - `"min"` (default): Returns the lexicographically-first polynomial. - - `"max"`: Returns the lexicographically-last polynomial. + - `"min"` (default): Returns the lexicographically first polynomial. + - `"max"`: Returns the lexicographically last polynomial. - `"random"`: Returns a random polynomial. Returns: @@ -149,7 +149,7 @@ def primitive_poly( $\mathrm{GF}(q^m) = \{0, 1, \alpha, \alpha^2, \dots, \alpha^{q^m-2}\}$. Examples: - Find the lexicographically-first, lexicographically-last, and a random monic primitive polynomial. + Find the lexicographically first, lexicographically last, and a random monic primitive polynomial. .. ipython:: python @@ -157,20 +157,20 @@ def primitive_poly( galois.primitive_poly(7, 3, method="max") galois.primitive_poly(7, 3, method="random") - Find the lexicographically-first monic primitive polynomial with four terms. + Find the lexicographically first monic primitive polynomial with four terms. .. ipython:: python galois.primitive_poly(7, 3, terms=4) - Find the lexicographically-first monic irreducible polynomial with the minimum number of non-zero terms. + Find the lexicographically first monic irreducible polynomial with the minimum number of non-zero terms. .. ipython:: python galois.primitive_poly(7, 3, terms="min") - Notice :func:`~galois.primitive_poly` returns the lexicographically-first primitive polynomial but - :func:`~galois.conway_poly` returns the lexicographically-first primitive polynomial that is *consistent* + Notice :func:`~galois.primitive_poly` returns the lexicographically first primitive polynomial but + :func:`~galois.conway_poly` returns the lexicographically first primitive polynomial that is *consistent* with smaller Conway polynomials. This is sometimes the same polynomial. .. ipython:: python @@ -371,7 +371,7 @@ def matlab_primitive_poly(characteristic: int, degree: int) -> Poly: Poly.is_primitive, primitive_poly, conway_poly Notes: - This function returns the same result as Matlab's `gfprimdf(m, p)`. Matlab uses the lexicographically-first + This function returns the same result as Matlab's `gfprimdf(m, p)`. Matlab uses the lexicographically first primitive polynomial with minimum terms, which is equivalent to `galois.primitive_poly(p, m, terms="min")`. There are three notable exceptions, however: @@ -416,18 +416,18 @@ def matlab_primitive_poly(characteristic: int, degree: int) -> Poly: f"Argument 'degree' must be at least 1, not {degree}. There are no primitive polynomials with degree 0." ) - # Textbooks and Matlab use the lexicographically-first primitive polynomial with minimal terms for the default. + # Textbooks and Matlab use the lexicographically first primitive polynomial with minimal terms for the default. # But for some reason, there are three exceptions. I can't determine why. if characteristic == 2 and degree == 7: - # Not the lexicographically-first of x^7 + x + 1. + # Not the lexicographically first of x^7 + x + 1. return Poly.Degrees([7, 3, 0]) if characteristic == 2 and degree == 14: - # Not the lexicographically-first of x^14 + x^5 + x^3 + x + 1. + # Not the lexicographically first of x^14 + x^5 + x^3 + x + 1. return Poly.Degrees([14, 10, 6, 1, 0]) if characteristic == 2 and degree == 16: - # Not the lexicographically-first of x^16 + x^5 + x^3 + x^2 + 1. + # Not the lexicographically first of x^16 + x^5 + x^3 + x^2 + 1. return Poly.Degrees([16, 12, 3, 1, 0]) return primitive_poly(characteristic, degree) diff --git a/src/galois/_prime.py b/src/galois/_prime.py index dac699acf..9b80ae73d 100644 --- a/src/galois/_prime.py +++ b/src/galois/_prime.py @@ -89,7 +89,7 @@ def primes(n: int) -> list[int]: p = (prime_idxs * 2 + 3).tolist() # Convert indices back to odd integers p.insert(0, 2) # Add the only even prime, 2 - # Replace the global primes lookup table with the newly-created, larger list + # Replace the global primes lookup table with the newly created, larger list PRIMES = p MAX_K = len(PRIMES) MAX_N = n @@ -97,7 +97,7 @@ def primes(n: int) -> list[int]: return p -# TODO: Don't build a large lookup table at import time. Instead, use the progressively-growing nature of PRIMES. +# TODO: Don't build a large lookup table at import time. Instead, use the progressively growing nature of PRIMES. # Generate a prime lookup table for efficient lookup in other algorithms PRIMES = primes(10_000_000) MAX_K = len(PRIMES) diff --git a/src/galois/typing.py b/src/galois/typing.py index 26ea007f8..0ab6761c9 100644 --- a/src/galois/typing.py +++ b/src/galois/typing.py @@ -54,7 +54,7 @@ # Ascending degrees GF("2 + 2x + x^2") -- :obj:`~galois.Array`: A previously-created scalar :obj:`~galois.Array` object. No coercion is necessary. +- :obj:`~galois.Array`: A previously created scalar :obj:`~galois.Array` object. No coercion is necessary. .. rubric:: Alias """ @@ -115,7 +115,7 @@ x = np.array([[17, 4], [148, 205]]); x GF(x) -- :obj:`~galois.Array`: A previously-created :obj:`~galois.Array` object. No coercion is necessary. +- :obj:`~galois.Array`: A previously created :obj:`~galois.Array` object. No coercion is necessary. .. rubric:: Alias """ @@ -225,7 +225,7 @@ 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. +- :obj:`~galois.Poly`: A previously created :obj:`~galois.Poly` object. No coercion is necessary. .. rubric:: Alias """ diff --git a/tests/fields/test_classes.py b/tests/fields/test_classes.py index b2523ddd7..838517ec8 100644 --- a/tests/fields/test_classes.py +++ b/tests/fields/test_classes.py @@ -95,7 +95,7 @@ def test_cant_set_attribute(attribute): def test_is_primitive_poly(): """ - Verify the `is_primitive_poly` boolean is calculated correctly for fields constructed with explicitly-specified + Verify the `is_primitive_poly` boolean is calculated correctly for fields constructed with explicitly specified irreducible polynomials. """ # GF(2^m) with integer dtype diff --git a/tests/polys/luts/irreducible_polys_min.py b/tests/polys/luts/irreducible_polys_min.py index 454d9de59..ae541f5ef 100644 --- a/tests/polys/luts/irreducible_polys_min.py +++ b/tests/polys/luts/irreducible_polys_min.py @@ -1,5 +1,5 @@ """ -A module containing LUTs for lexicographically-first irreducible polynomials with minimal terms. +A module containing LUTs for lexicographically first irreducible polynomials with minimal terms. LUT items obtained by randomly picking degrees and checking the PDF,