Computes all pairwise Hamming distances for a binary matrix \(\mathbf{X}\).

getHammingDistance(X)

Arguments

X

The \(N \times P\) binary matrix

Value

A length \({N \choose 2}\) vector of pairwise Hamming distances

Details

Dependencies: hamming_bitwise from fast_dist_calc.cpp

Examples

X <- matrix(nrow = 5, ncol = 10, rbinom(50, 1, 0.5))
getHammingDistance(X)
#>  [1] 6 6 5 7 2 3 3 5 3 6