| hamming_distance | R Documentation |
Computes the pairwise Hamming distances between rows of a binary matrix.
hamming_distance(X, nthreads = NULL)
X |
A binary (0/1) numeric matrix. |
nthreads |
Integer; number of OpenMP threads to use. If |
An integer matrix of pairwise Hamming distances.
n <- 10000
m <- 1000
set.seed(2468)
X <- matrix(sample(0:1, n * m, replace = TRUE), nrow = n)
# Use all available threads
system.time(result <- hamming_distance(X))
# limit to 2 threads
system.time(hamming_distance(X, nthreads = 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.