Skip to content

Commit

Permalink
Remove hyphens for adverbs ending in "ly"
Browse files Browse the repository at this point in the history
  • Loading branch information
mhostetter committed Jul 3, 2024
1 parent acd8f10 commit f49b458
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions docs/release-notes/v0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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.

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion docs/release-notes/v0.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/galois/_fields/_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions src/galois/_fields/_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 <int-repr>`.
Expand Down Expand Up @@ -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::
Expand Down
10 changes: 5 additions & 5 deletions src/galois/_polys/_conway.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/galois/_polys/_dense.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/galois/_polys/_factor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions src/galois/_polys/_irreducible.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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::
Expand Down Expand Up @@ -176,21 +176,21 @@ 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
galois.irreducible_poly(7, 3)
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
Expand Down
26 changes: 13 additions & 13 deletions src/galois/_polys/_primitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand All @@ -149,28 +149,28 @@ 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
galois.primitive_poly(7, 3)
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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
4 changes: 2 additions & 2 deletions src/galois/_prime.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ 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

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)
Expand Down
Loading

0 comments on commit f49b458

Please sign in to comment.