Displaying 1 result from an estimated 1 matches for "exprnec".
Did you mean:
expres
2012 Jul 27
1
C code validation
...from R:
> library(QCA)
Loading required package: lpSolve
> benchmark <- function(x, y) {
+ index <- 0
+ while((index <- index + 1) < length(x)) {
+ x <- setdiff(x, findSubsets(y + 1, x[index], max(x)))
+ }
+ return(x)
+ }
>
> set.seed(12345)
> exprnec <- sort(sample(13:19683, 500))
> noflevels <- rep(2, 9)
> mbase <- rev(c(1, cumprod(rev(noflevels + 1))))[-1]
> foo1 <- benchmark(exprnec, noflevels)
> foo2 <- .Call("removeRedundants", exprnec, noflevels, mbase)
>
> all.equal(foo1, foo2)
[1] "Numeric...