nx_hamming.nx
buildroot/runtime/nx_hamming.nx
about
nx_hamming.nx -- Hamming distance for equal-length byte sequences.
Counts positions at which corresponding bytes differ. Applies ONLY
to strings of equal length -- non-equal lengths are an error (return
NX_HAMMING_LENGTH_MISMATCH sentinel). Useful when the substrate has
already aligned the sequences (fixed-width tokens, error-correction
codes, hashes-of-equal-bit-width, DNA k-mers of fixed k).
Cross-modal: bytes of any signal (pixels, audio samples quantized
to u8, code tokens, network packet headers).
Idea-provenance (patent-clean): Hamming 1950 "Error detecting and
error correcting codes" Bell System Technical Journal.
genealogy_id: hamming_1950_error_detecting_codes
lineage_id: hamming_distance_q10
dependencies 3 imports · 1 importers
imports: nx_syscalls.nxnx_tier.nxnx_jaro_winkler.nx
imported by: nx_hamming_test.nx
structs
| none |
consts
| 28 | const NX_HAMMING_Q: nx_int = 1024 |
| 29 | const NX_HAMMING_LENGTH_MISMATCH: nx_int = -1 |
functions
| 33 | func nx_hamming(s1: *u8, s2: *u8, n: nx_int) -> nx_int |
| 46 | func nx_hamming_safe(s1: *u8, n1: nx_int, s2: *u8, n2: nx_int) -> nx_int |
| 53 | func nx_hamming_similarity_q10(s1: *u8, s2: *u8, n: nx_int) -> nx_int |
| 64 | func nx_hamming_classify(similarity_q10: nx_int) -> nx_int |