Dear all,
I am interested to know a faster matrix intersection package for R handles
intersection of two integer matrices with ncol=2. Currently I am using my
homemade code adapted from a previous thread:
intersectMat <- function(mat1, mat2){#mat1 and mat2 are both
deduplicated nr1 <- nrow(mat1) nr2 <- nrow(mat2)
mat2[duplicated(rbind(mat1, mat2))[(nr1 + 1):(nr1 + nr2)], ]}
which handles:
size A= 10578373
size B= 9519807
expected intersecting time= 251.2272
intersecting for corssing MPRs took 409.602 seconds.
scale a little bit worse than linearly but atomic operation is not good.
Wonder if a super fast C/C++ extension exists for this task. Your ideas are
appreciated.
Thanks!
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.