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

Release 0.3.9 #548

Merged
merged 14 commits into from
Jun 10, 2024
18 changes: 18 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, '3.10', 3.11, 3.12]
# https://github.com/actions/runner-images/issues/9770#issuecomment-2085623315
exclude: # Python < v3.8 does not support Apple Silicon ARM64
- python-version: "3.7"
os: macos-latest
- python-version: "3.8"
os: macos-latest
include: # So run those legacy versions on Intel CPUs
- python-version: "3.7"
os: macos-13
- python-version: "3.8"
os: macos-13
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -135,6 +146,13 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, '3.10', 3.11, 3.12]
# https://github.com/actions/runner-images/issues/9770#issuecomment-2085623315
exclude: # Python < v3.8 does not support Apple Silicon ARM64
- python-version: "3.7"
os: macos-latest
include: # So run those legacy versions on Intel CPUs
- python-version: "3.7"
os: macos-13
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
__pycache__/
.benchmarks/
.coverage
.ipynb_checkpoints/
.pytest_cache/
.venv/
build/
dist/
env/
src/*.egg-info
src/galois/_version.py
.coverage
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.15
rev: v0.4.7
hooks:
- id: ruff
- id: ruff-format
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2020-2023 Matt Hostetter <[email protected]>
Copyright (c) 2020-2024 Matt Hostetter <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Import the `galois` package in Python.
In [1]: import galois

In [2]: galois.__version__
Out[2]: '0.3.8'
Out[2]: '0.3.9'
```

### Create a [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) subclass
Expand Down
1 change: 1 addition & 0 deletions benchmarks/test_fec.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
A pytest module to benchmark forward-error correction encoding/decoding.
"""

import numpy as np
import pytest

Expand Down
1 change: 1 addition & 0 deletions benchmarks/test_field_arithmetic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
A pytest module to benchmark FieldArray arithmetic.
"""

import numpy as np
import pytest

Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# -- Project information -----------------------------------------------------

project = "galois"
copyright = "2020-2023, Matt Hostetter"
copyright = "2020-2024, Matt Hostetter"
author = "Matt Hostetter"
version = galois.__version__

Expand Down Expand Up @@ -284,6 +284,7 @@
"title": "See also",
"classes": ["collapsible"],
"icon": "fontawesome/regular/eye",
"color": (108, 117, 125), # --sd-color-secondary
"override": True,
},
{
Expand Down
14 changes: 14 additions & 0 deletions docs/release-notes/v0.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,17 @@ tocdepth: 2
### Contributors

- Matt Hostetter ([@mhostetter](https://github.com/mhostetter))

## v0.3.9

*Released June 10, 2024*

### Changes

- Added support for `python -OO` optimization. ([#545](https://github.com/mhostetter/galois/pull/545))
- Improved documentation in minor ways.

### Contributors

- Justin Charlong ([@jcharlong](https://github.com/jcharlong))
- Matt Hostetter ([@mhostetter](https://github.com/mhostetter))
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sphinx < 7.3
sphinx-immaterial == 0.11.9
sphinx-immaterial == 0.11.11
# For some reason, if the below versions aren't specified, the dependency resolution takes 18 minutes in CI.
myst-parser == 0.18.1
sphinx-design == 0.5.0
Expand Down
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,16 @@ line-length = 120

[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"E", # pycodestyle
"F", # Pyflakes
"UP", # pyupgrade
"B", # flake8-bugbear
# "SIM",# flake8-simplify
"I", # isort
"PL", # pylint
"DTZ", # flake8-datetimez
"I", # isort
"PL", # pylint
]
ignore = [
"E501", # line-too-long
Expand All @@ -109,6 +112,7 @@ ignore = [
"PLR5501", # collapsible-else-if
"PLW0603", # global-statement
"PLW2901", # redefined-loop-name
"UP006", # non-pep585-annotation, type[FieldArray] renders wrong in docs
]

[tool.ruff.lint.per-file-ignores]
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ruff == 0.1.15
ruff == 0.4.7
pytest
pytest-cov[toml]
pytest-xdist
Expand Down
1 change: 1 addition & 0 deletions scripts/create_conway_polys_database.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
A script to create a database of Conway polynomials using Frank Luebeck's compilation of polynomials.
"""

from __future__ import annotations

import hashlib
Expand Down
1 change: 1 addition & 0 deletions scripts/create_irreducible_polys_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Gadiel Seroussi. Table of Low-Weight Binary Irreducible Polynomials (1998): https://www.hpl.hp.com/techreports/98/HPL-98-135.html

"""

from __future__ import annotations

import hashlib
Expand Down
1 change: 1 addition & 0 deletions scripts/create_prime_factors_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A script to create a database of prime factorizations of p^n +/- 1 using the Cunningham Project's tables.
https://homes.cerias.purdue.edu/~ssw/cun/
"""

from __future__ import annotations

import os
Expand Down
1 change: 1 addition & 0 deletions scripts/generate_fec_test_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Install SageMath:
* `sudo apt install sagemath`
"""

import os
import pickle
import shutil
Expand Down
1 change: 1 addition & 0 deletions scripts/generate_field_test_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Install SageMath:
* `sudo apt install sagemath`
"""

import json
import os
import pickle
Expand Down
1 change: 1 addition & 0 deletions scripts/generate_int_test_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

* `sudo apt install sagemath`
"""

import os
import pickle
import random
Expand Down
1 change: 1 addition & 0 deletions src/galois/_codes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
A subpackage containing forward error correction codes.
"""

from ._bch import *
from ._reed_solomon import *
25 changes: 12 additions & 13 deletions src/galois/_codes/_bch.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""
A module containing general Bose-Chaudhuri-Hocquenghem (BCH) codes over GF(q).
"""

from __future__ import annotations

from typing import overload
from typing import Type, overload

import numba
import numpy as np
Expand Down Expand Up @@ -83,8 +84,8 @@ def __init__(
n: int,
k: int | None = None,
d: int | None = None,
field: type[FieldArray] | None = None,
extension_field: type[FieldArray] | None = None,
field: Type[FieldArray] | None = None,
extension_field: Type[FieldArray] | None = None,
alpha: ElementLike | None = None,
c: int = 1,
systematic: bool = True,
Expand Down Expand Up @@ -481,17 +482,15 @@ def decode(
codeword: ArrayLike,
output: Literal["message", "codeword"] = "message",
errors: Literal[False] = False,
) -> FieldArray:
...
) -> FieldArray: ...

@overload
def decode(
self,
codeword: ArrayLike,
output: Literal["message", "codeword"] = "message",
errors: Literal[True] = True,
) -> tuple[FieldArray, int | np.ndarray]:
...
) -> tuple[FieldArray, int | np.ndarray]: ...

@extend_docstring(
_CyclicCode.decode,
Expand Down Expand Up @@ -683,11 +682,11 @@ def _decode_codeword(self, codeword: FieldArray) -> tuple[FieldArray, np.ndarray
print(bch.field.properties)
""",
)
def field(self) -> type[FieldArray]:
def field(self) -> Type[FieldArray]:
return super().field

@property
def extension_field(self) -> type[FieldArray]:
def extension_field(self) -> Type[FieldArray]:
r"""
The Galois field $\mathrm{GF}(q^m)$ that defines the BCH syndrome arithmetic.

Expand Down Expand Up @@ -1111,7 +1110,7 @@ def is_systematic(self) -> bool:

def _generator_poly_from_d(
d: int,
field: type[FieldArray],
field: Type[FieldArray],
alpha: FieldArray,
c: int,
) -> tuple[Poly, FieldArray]:
Expand All @@ -1134,8 +1133,8 @@ def _generator_poly_from_d(
def _generator_poly_from_k(
n: int,
k: int,
field: type[FieldArray],
extension_field: type[FieldArray],
field: Type[FieldArray],
extension_field: Type[FieldArray],
alpha: FieldArray,
c: int,
) -> tuple[Poly, FieldArray]:
Expand Down Expand Up @@ -1194,7 +1193,7 @@ class bch_decode_jit(Function):
- Lin, S. and Costello, D. Error Control Coding. Section 7.4.
"""

def __init__(self, field: type[FieldArray], extension_field: type[FieldArray]):
def __init__(self, field: Type[FieldArray], extension_field: Type[FieldArray]):
super().__init__(field)
self.extension_field = extension_field

Expand Down
7 changes: 3 additions & 4 deletions src/galois/_codes/_cyclic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
A module containing common functions for cyclic codes.
"""

from __future__ import annotations

from typing import overload
Expand Down Expand Up @@ -88,17 +89,15 @@ def decode(
codeword: ArrayLike,
output: Literal["message", "codeword"] = "message",
errors: Literal[False] = False,
) -> FieldArray:
...
) -> FieldArray: ...

@overload
def decode(
self,
codeword: ArrayLike,
output: Literal["message", "codeword"] = "message",
errors: Literal[True] = True,
) -> tuple[FieldArray, int | np.ndarray]:
...
) -> tuple[FieldArray, int | np.ndarray]: ...

@extend_docstring(
_LinearCode.decode,
Expand Down
11 changes: 5 additions & 6 deletions src/galois/_codes/_linear.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""
A module containing common functions for linear block codes.
"""

from __future__ import annotations

from typing import overload
from typing import Type, overload

import numpy as np
from typing_extensions import Literal
Expand Down Expand Up @@ -121,17 +122,15 @@ def decode(
codeword: ArrayLike,
output: Literal["message", "codeword"] = "message",
errors: Literal[False] = False,
) -> FieldArray:
...
) -> FieldArray: ...

@overload
def decode(
self,
codeword: ArrayLike,
output: Literal["message", "codeword"] = "message",
errors: Literal[True] = True,
) -> tuple[FieldArray, int | np.ndarray]:
...
) -> tuple[FieldArray, int | np.ndarray]: ...

def decode(self, codeword, output="message", errors=False):
r"""
Expand Down Expand Up @@ -302,7 +301,7 @@ def _decode_codeword(self, codeword: FieldArray) -> tuple[FieldArray, np.ndarray
###############################################################################

@property
def field(self) -> type[FieldArray]:
def field(self) -> Type[FieldArray]:
r"""
The Galois field $\mathrm{GF}(q)$ that defines the codeword alphabet.
"""
Expand Down
Loading
Loading