swarmauri_matrix_hamming74 0.9.4.dev2__tar.gz → 0.11.0.dev1__tar.gz
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.
- {swarmauri_matrix_hamming74-0.9.4.dev2 → swarmauri_matrix_hamming74-0.11.0.dev1}/PKG-INFO +9 -7
- {swarmauri_matrix_hamming74-0.9.4.dev2 → swarmauri_matrix_hamming74-0.11.0.dev1}/README.md +8 -6
- {swarmauri_matrix_hamming74-0.9.4.dev2 → swarmauri_matrix_hamming74-0.11.0.dev1}/pyproject.toml +2 -2
- {swarmauri_matrix_hamming74-0.9.4.dev2 → swarmauri_matrix_hamming74-0.11.0.dev1}/swarmauri_matrix_hamming74/Hamming74Matrix.py +14 -5
- {swarmauri_matrix_hamming74-0.9.4.dev2 → swarmauri_matrix_hamming74-0.11.0.dev1}/LICENSE +0 -0
- {swarmauri_matrix_hamming74-0.9.4.dev2 → swarmauri_matrix_hamming74-0.11.0.dev1}/swarmauri_matrix_hamming74/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: swarmauri_matrix_hamming74
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0.dev1
|
|
4
4
|
Summary: Swarmauri Hamming (7,4) matrix community package.
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
@@ -40,8 +40,8 @@ Description-Content-Type: text/markdown
|
|
|
40
40
|
<img src="https://img.shields.io/pypi/l/swarmauri_matrix_hamming74" alt="PyPI - License"/></a>
|
|
41
41
|
<a href="https://pypi.org/project/swarmauri_matrix_hamming74/">
|
|
42
42
|
<img src="https://img.shields.io/pypi/v/swarmauri_matrix_hamming74?label=swarmauri_matrix_hamming74&color=green" alt="PyPI - swarmauri_matrix_hamming74"/></a>
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
<a href="https://discord.gg/N4UpBuQv8T">
|
|
44
|
+
<img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
|
|
45
45
|
|
|
46
46
|
# Swarmauri Matrix Hamming(7,4)
|
|
47
47
|
|
|
@@ -49,10 +49,10 @@ The `swarmauri_matrix_hamming74` package provides a binary Hamming (7,4) code ma
|
|
|
49
49
|
|
|
50
50
|
## Features
|
|
51
51
|
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
52
|
+
- Binary matrix implementation built on `MatrixBase` with full indexing and arithmetic support.
|
|
53
|
+
- Generator and parity-check matrix accessors for classic Hamming (7,4) coding schemes.
|
|
54
|
+
- Encoding, syndrome calculation, and nearest-codeword decoding helpers powered by the Hamming metric.
|
|
55
|
+
- Binary-safe matrix operations (addition, subtraction, multiplication, and matrix multiplication modulo 2).
|
|
56
56
|
|
|
57
57
|
## Installation
|
|
58
58
|
|
|
@@ -95,3 +95,5 @@ print(nearest) # Recovers the original codeword
|
|
|
95
95
|
|
|
96
96
|
We welcome contributions! Please submit issues and pull requests through the [Swarmauri SDK GitHub repository](https://github.com/swarmauri/swarmauri-sdk).
|
|
97
97
|
|
|
98
|
+
|
|
99
|
+
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
<img src="https://img.shields.io/pypi/l/swarmauri_matrix_hamming74" alt="PyPI - License"/></a>
|
|
12
12
|
<a href="https://pypi.org/project/swarmauri_matrix_hamming74/">
|
|
13
13
|
<img src="https://img.shields.io/pypi/v/swarmauri_matrix_hamming74?label=swarmauri_matrix_hamming74&color=green" alt="PyPI - swarmauri_matrix_hamming74"/></a>
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
<a href="https://discord.gg/N4UpBuQv8T">
|
|
15
|
+
<img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
|
|
16
16
|
|
|
17
17
|
# Swarmauri Matrix Hamming(7,4)
|
|
18
18
|
|
|
@@ -20,10 +20,10 @@ The `swarmauri_matrix_hamming74` package provides a binary Hamming (7,4) code ma
|
|
|
20
20
|
|
|
21
21
|
## Features
|
|
22
22
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
23
|
+
- Binary matrix implementation built on `MatrixBase` with full indexing and arithmetic support.
|
|
24
|
+
- Generator and parity-check matrix accessors for classic Hamming (7,4) coding schemes.
|
|
25
|
+
- Encoding, syndrome calculation, and nearest-codeword decoding helpers powered by the Hamming metric.
|
|
26
|
+
- Binary-safe matrix operations (addition, subtraction, multiplication, and matrix multiplication modulo 2).
|
|
27
27
|
|
|
28
28
|
## Installation
|
|
29
29
|
|
|
@@ -65,3 +65,5 @@ print(nearest) # Recovers the original codeword
|
|
|
65
65
|
## Contributing
|
|
66
66
|
|
|
67
67
|
We welcome contributions! Please submit issues and pull requests through the [Swarmauri SDK GitHub repository](https://github.com/swarmauri/swarmauri-sdk).
|
|
68
|
+
|
|
69
|
+
|
{swarmauri_matrix_hamming74-0.9.4.dev2 → swarmauri_matrix_hamming74-0.11.0.dev1}/pyproject.toml
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "swarmauri_matrix_hamming74"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.11.0.dev1"
|
|
4
4
|
description = "Swarmauri Hamming (7,4) matrix community package."
|
|
5
5
|
license = "Apache-2.0"
|
|
6
6
|
readme = "README.md"
|
|
@@ -76,7 +76,7 @@ dev = [
|
|
|
76
76
|
"pytest-xdist>=3.6.1",
|
|
77
77
|
"pytest-json-report>=1.5.0",
|
|
78
78
|
"python-dotenv",
|
|
79
|
-
"
|
|
79
|
+
"httpx>=0.27",
|
|
80
80
|
"flake8>=7.0",
|
|
81
81
|
"pytest-timeout>=2.3.1",
|
|
82
82
|
"ruff>=0.9.9",
|
|
@@ -106,10 +106,14 @@ class Hamming74Matrix(MatrixBase):
|
|
|
106
106
|
def __mul__(self, other: BinaryLike) -> "Hamming74Matrix":
|
|
107
107
|
return Hamming74Matrix((self._data * self._coerce(other)) % 2)
|
|
108
108
|
|
|
109
|
-
def __matmul__(
|
|
109
|
+
def __matmul__(
|
|
110
|
+
self, other: Union[BinaryLike, np.ndarray]
|
|
111
|
+
) -> "Hamming74Matrix":
|
|
110
112
|
matrix = self._coerce(other)
|
|
111
113
|
if self.shape[1] != matrix.shape[0]:
|
|
112
|
-
raise ValueError(
|
|
114
|
+
raise ValueError(
|
|
115
|
+
"Matrix dimensions do not align for multiplication"
|
|
116
|
+
)
|
|
113
117
|
return Hamming74Matrix(np.mod(self._data @ matrix, 2))
|
|
114
118
|
|
|
115
119
|
def __truediv__(self, other: BinaryLike) -> "Hamming74Matrix":
|
|
@@ -130,7 +134,9 @@ class Hamming74Matrix(MatrixBase):
|
|
|
130
134
|
def transpose(self) -> "Hamming74Matrix":
|
|
131
135
|
return Hamming74Matrix(self._data.T)
|
|
132
136
|
|
|
133
|
-
def __array__(
|
|
137
|
+
def __array__(
|
|
138
|
+
self,
|
|
139
|
+
) -> np.ndarray: # pragma: no cover - numpy protocol helper
|
|
134
140
|
return np.array(self._data, copy=True)
|
|
135
141
|
|
|
136
142
|
# ------------------------------------------------------------------
|
|
@@ -151,7 +157,9 @@ class Hamming74Matrix(MatrixBase):
|
|
|
151
157
|
def encode(self, message: Sequence[int]) -> List[int]:
|
|
152
158
|
bits = np.mod(np.array(message, dtype=int), 2)
|
|
153
159
|
if bits.size != 4:
|
|
154
|
-
raise ValueError(
|
|
160
|
+
raise ValueError(
|
|
161
|
+
"Hamming (7,4) encoding expects exactly 4 message bits"
|
|
162
|
+
)
|
|
155
163
|
codeword = np.mod(bits @ self._data, 2)
|
|
156
164
|
return codeword.astype(int).tolist()
|
|
157
165
|
|
|
@@ -175,7 +183,8 @@ class Hamming74Matrix(MatrixBase):
|
|
|
175
183
|
raise ValueError("Nearest codeword search expects 7-bit inputs")
|
|
176
184
|
codebook = self.codewords()
|
|
177
185
|
distances = [
|
|
178
|
-
self._metric.distance(candidate.tolist(), codeword)
|
|
186
|
+
self._metric.distance(candidate.tolist(), codeword)
|
|
187
|
+
for codeword in codebook
|
|
179
188
|
]
|
|
180
189
|
index = int(np.argmin(distances))
|
|
181
190
|
return codebook[index]
|
|
File without changes
|