combn_fast | R Documentation |
Fast combination of n elements, taken m at a time
combn_fast(x, m)
x |
integer vector source for combinations |
m |
number of elements to choose. |
This is a significantly faster version of combn
. For
an integer vector x of length 1000 and m of 3 which results in a matrix of size
3 x 166,167,000, the speed improvement is about 9 times (11 secs vs 99 secs).
This code is written using Armadillo C++ and 64 bit unsingned integers.
a matrix with m rows.
all.equal(combn(1:10, 3), combn_fast(1:10,3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.