code wiki / (root) / nx_hamming.nx

nx_hamming.nx

buildroot/runtime/nx_hamming.nx

2381 B66 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_tier.nx nx_jaro_winkler.nx nx_hamming.nx nx_hamming_test.nx

imports: nx_syscalls.nxnx_tier.nxnx_jaro_winkler.nx

imported by: nx_hamming_test.nx

structs

none

consts

28const NX_HAMMING_Q: nx_int = 1024
29const NX_HAMMING_LENGTH_MISMATCH: nx_int = -1

functions

33func nx_hamming(s1: *u8, s2: *u8, n: nx_int) -> nx_int
46func nx_hamming_safe(s1: *u8, n1: nx_int, s2: *u8, n2: nx_int) -> nx_int
called by 1: main calls 1: nx_hamming
53func nx_hamming_similarity_q10(s1: *u8, s2: *u8, n: nx_int) -> nx_int
called by 1: main calls 1: nx_hamming
64func nx_hamming_classify(similarity_q10: nx_int) -> nx_int
called by 1: main calls 1: nx_jaro_winkler_classify