gf2 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gf2/__init__.py +87 -0
- gf2/core.py +798 -0
- gf2/generators.py +537 -0
- gf2/py.typed +0 -0
- gf2/solvers.py +576 -0
- gf2/sparse.py +681 -0
- gf2-0.1.0.dist-info/METADATA +245 -0
- gf2-0.1.0.dist-info/RECORD +10 -0
- gf2-0.1.0.dist-info/WHEEL +4 -0
- gf2-0.1.0.dist-info/licenses/LICENSE +21 -0
gf2/__init__.py
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""
|
|
2
|
+
gf2: Binary Linear Algebra over GF(2)
|
|
3
|
+
======================================
|
|
4
|
+
|
|
5
|
+
High-performance binary matrix operations with optimized sparse and dense
|
|
6
|
+
storage, solvers, and generators. Applications include coding theory,
|
|
7
|
+
cryptography, network coding, and quantum error correction.
|
|
8
|
+
|
|
9
|
+
Quick start:
|
|
10
|
+
>>> from gf2.generators import identity
|
|
11
|
+
>>> from gf2.core import rank
|
|
12
|
+
>>> I = identity(8)
|
|
13
|
+
>>> rank(I)
|
|
14
|
+
8
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from importlib import metadata as _metadata
|
|
18
|
+
|
|
19
|
+
from .core import *
|
|
20
|
+
from .generators import *
|
|
21
|
+
from .solvers import *
|
|
22
|
+
from .sparse import *
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
# Core matrix classes
|
|
26
|
+
"SparseGF2Matrix",
|
|
27
|
+
"DenseGF2Matrix",
|
|
28
|
+
# Basic operations
|
|
29
|
+
"add",
|
|
30
|
+
"multiply",
|
|
31
|
+
"transpose",
|
|
32
|
+
"rank",
|
|
33
|
+
"det",
|
|
34
|
+
"trace",
|
|
35
|
+
"is_invertible",
|
|
36
|
+
# Linear systems
|
|
37
|
+
"solve",
|
|
38
|
+
"nullspace",
|
|
39
|
+
"nullspace_bitwise",
|
|
40
|
+
"nullspace_fast",
|
|
41
|
+
"inverse",
|
|
42
|
+
"lu_decomposition",
|
|
43
|
+
"least_squares",
|
|
44
|
+
"kernel",
|
|
45
|
+
"image",
|
|
46
|
+
"rank_nullity_theorem",
|
|
47
|
+
"solve_multiple_rhs",
|
|
48
|
+
"iterative_refinement",
|
|
49
|
+
"benchmark_solver",
|
|
50
|
+
# Matrix generators
|
|
51
|
+
"identity",
|
|
52
|
+
"zeros",
|
|
53
|
+
"ones",
|
|
54
|
+
"random_sparse",
|
|
55
|
+
"random_regular",
|
|
56
|
+
"circulant",
|
|
57
|
+
"circulant_random",
|
|
58
|
+
"toeplitz",
|
|
59
|
+
"ldpc_matrix",
|
|
60
|
+
"hamming_matrix",
|
|
61
|
+
"repetition_matrix",
|
|
62
|
+
# Quantum error-correcting code constructions
|
|
63
|
+
"surface_code_matrix",
|
|
64
|
+
"hypergraph_product",
|
|
65
|
+
"css_code_matrix",
|
|
66
|
+
"bicycle_codes",
|
|
67
|
+
# Advanced properties
|
|
68
|
+
"reduced_row_echelon_form",
|
|
69
|
+
"matrix_power",
|
|
70
|
+
"characteristic_polynomial",
|
|
71
|
+
"minimal_polynomial",
|
|
72
|
+
"matrix_norm",
|
|
73
|
+
"condition_number",
|
|
74
|
+
# Factory and storage statistics
|
|
75
|
+
"create_sparse_matrix",
|
|
76
|
+
"SparseStats",
|
|
77
|
+
# Structured results returned by the operations above
|
|
78
|
+
"LUDecomposition",
|
|
79
|
+
"RowEchelonForm",
|
|
80
|
+
"NullspaceVector",
|
|
81
|
+
"RankNullity",
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
try: # keep one source of truth: the version declared in pyproject.toml
|
|
85
|
+
__version__ = _metadata.version("gf2")
|
|
86
|
+
except _metadata.PackageNotFoundError: # running from a source tree, not installed
|
|
87
|
+
__version__ = "0.0.0+unknown"
|