Swarmauri Metric Hamming
The swarmauri_metric_hamming package delivers a production-ready implementation of the Hamming distance that integrates seamlessly with the Swarmauri metric ecosystem. It extends MetricBase with binary vector validation, pairwise distance calculations, and axiom verification utilities designed for error-correcting code workflows.
Features
- ✅ Fully compliant
MetricBaseimplementation for binary sequences. - 🔁 Pairwise and batched distance calculations for matrices, vectors, and iterables.
- 🧪 Built-in validation helpers for metric axioms and input compatibility checks.
- 🧰 Utility conversion helpers for strings, dictionaries, NumPy arrays, and Swarmauri matrices/vectors.
Installation
Using uv
uv pip install swarmauri_metric_hamming
Using pip
pip install swarmauri_metric_hamming
Usage
from swarmauri_metric_hamming import HammingMetric
metric = HammingMetric()
codeword = [1, 0, 1, 1, 0, 0, 1]
received = [1, 1, 1, 1, 0, 0, 1]
# Compute the Hamming distance between two binary vectors
print(metric.distance(codeword, received)) # 1.0
# Verify the metric axioms for the provided inputs
assert metric.check_symmetry(codeword, received)
assert metric.check_triangle_inequality(codeword, received, codeword)
Support
- Python 3.10, 3.11, and 3.12
- Licensed under the Apache-2.0 license
Contributing
We welcome contributions! Please submit issues and pull requests through the Swarmauri SDK GitHub repository.
Metadata
Release files for swarmauri_metric_hamming 0.9.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| swarmauri_metric_hamming-0.9.2.tar.gz | 8.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swarmauri_metric_hamming-0.9.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.0 kB
Release files / swarmauri_metric_hamming-0.9.2.tar.gz
| Download URL | swarmauri_metric_hamming-0.9.2.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa4aacd8be99130aa67dfdb0597df7f38ab4c9d338d93291ebd5bbee2086f509
|
|
BLAKE2b-256 checksum How to use checksums |
6050fd61c49870dbc42d8d3e3549023739a58374f4a1bf59ee571dff1818561f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / swarmauri_metric_hamming-0.9.2-py3-none-any.whl
| Download URL | swarmauri_metric_hamming-0.9.2-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
765eadbf65d948e2649dbbd407dd741aec365656ecb14b0da23dd8e694a13bad
|
|
BLAKE2b-256 checksum How to use checksums |
78b5b81f3631b055b12f0b48cb9b454b66c67af2854b4993c83c3b4613603150
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|