# Simple example
X <- matrix(c(1,2,3,4, 2,1,4,3, 1,3,2,4), nrow=3, byrow=TRUE)
CI <- combinpmatr(X)
# With weights
CI_weighted <- combinpmatr(X, Wk=c(2, 1, 3))
# Compare implementations
if (FALSE) {
data(APAred)
system.time(CI1 <- combinpmatr(APAred, use_cpp=TRUE))
system.time(CI2 <- combinpmatr(APAred, use_cpp=FALSE))
all.equal(CI1, CI2) # Should be TRUE
}
Run the code above in your browser using DataLab