Skip to main content

Swarmauri Hamming distance metric community package.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_metric_hamming


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 MetricBase implementation 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swarmauri_metric_hamming-0.9.1.dev4.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swarmauri_metric_hamming-0.9.1.dev4-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_metric_hamming-0.9.1.dev4.tar.gz.

File metadata

  • Download URL: swarmauri_metric_hamming-0.9.1.dev4.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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}

File hashes

Hashes for swarmauri_metric_hamming-0.9.1.dev4.tar.gz
Algorithm Hash digest
SHA256 c7b65fa3d6672cea7f00a0b6163ea7b6c64027b1e48deec3e67e0efd63fccc96
MD5 b31c996737d369131ffa6fb8c6e362f7
BLAKE2b-256 91a3169e0ddba1b3a7acd101ef8f18db67f6f006426abb8543afc5c34565b3e8

See more details on using hashes here.

File details

Details for the file swarmauri_metric_hamming-0.9.1.dev4-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_metric_hamming-0.9.1.dev4-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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}

File hashes

Hashes for swarmauri_metric_hamming-0.9.1.dev4-py3-none-any.whl
Algorithm Hash digest
SHA256 3f88b08271a5d144b075b7c32d83bcdbb0221aa37b98da1bf77dd8f8aa7a54f8
MD5 0def2a38288a2f1aea298a95677dd386
BLAKE2b-256 56d3afd960cec548444941fb0e274ed522a7fa5c23e12bf652d121202fbe2fc1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page