汉明距离估算

📏 Hamming Distance Estimator

Estimate the differing-bit count of two equal-length binary strings for error-correction and link-reliability analysis.

📐 计算公式与说明

汉明距离(本页为估算口径,非逐位比较实现):估算差异比特数 = round(串长 × 差异率% ÷ 100);采样差异 = round(采样数 × 差异率% ÷ 100)。校验:无强校验,空值按 0 兜底。判据:无固定分级,按差异率线性估算、四舍五入取整,串长与采样数各自独立折算。

差异率可用采样统计近似。

📚 深度解析:汉明距离估算

💡 常见使用场景

示例:10110 与 10011
逐位比较第 3、5 位不同,汉明距离 = 2,可检 1 位错但不足以纠 1 位(需距离≥3)。

❓ 常见问题(FAQ)

不等长怎么算?
严格汉明距离要求等长;不等长可用对齐后的编辑距离或采样近似。
汉明距离与纠错什么关系?
码字最小距离 d 可检测 d−1 位错、纠正 ⌊(d−1)/2⌋ 位错。
能衡量文本相似度吗?
对定长编码(如哈希)可,自由文本需先编码再比较。

Formula & Standard References

Item Formula / Rule Source / Standard
Hamming distance d(x, y) = popcount(x XOR y), the number of differing bits Hamming, Error Detecting and Error Correcting Codes, 1950
Correction criterion Correcting t bits needs d ≥ 2t + 1; detecting e bits needs d ≥ e + 1 Hamming 1950 §2 Minimum distance bound
Normalized distance Normalized distance = d(x, y) / n over n-bit codewords, ranging from 0 to 1 ISO/IEC 2382 Information technology vocabulary