When the input strings/sequences \(x\) and \(y\) are of
different lengths (\(|x| \neq |y|\)), the Hamming distance
is defined to be \(\infty\).
A Hamming similarity is returned if similarity = TRUE
. When
\(|x| = |y|\) the similarity is defined as follows:
$$\mathrm{sim}(x, y) = |x| - \mathrm{dist}(x, y),$$
where \(sim\) is the Hamming similarity and \(dist\) is the Hamming
distance. When \(|x| \neq |y|\) the similarity is defined to
be 0.
Normalization of the Hamming distance/similarity to the unit interval is
also supported by setting normalize = TRUE
. The raw distance/similarity
is divided by the length of the string/sequence \(|x| = |y|\). If
\(|x| \neq |y|\) the normalized distance is defined to be 1,
while the normalized similarity is defined to be 0.