R Under development (unstable) (2023-04-23 r84305 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > library(rcdd) If you want correct answers, use rational arithmetic. See the Warnings sections in help pages for functions that do computational geometry. > > set.seed(42) > > n <- 50 > d <- 5 > x <- matrix(rnorm(n * d), nrow = n) > x <- d2q(x) > > foo <- cbind("0", cbind("1", x)) > # in order to get the same results as before save and restore .Random.seed > # because sccd now calls R RNG > save.Random.seed <- .Random.seed > out <- scdd(foo, representation = "V") > .Random.seed <- save.Random.seed > > l <- out$output[ , 1] > b <- out$output[ , 2] > a <- out$output[ , - c(1, 2)] > a <- qxq(a, rep(-1, length(a))) > > unique(l) [1] "0" > > axb <- qmatmult(a, t(x)) > axb <- sweep(axb, 1, b, FUN = qmq) > fred <- apply(axb, 2, function(foo) max(qsign(foo))) > > all(fred <= 0) [1] TRUE > ### points in interior > sum(fred < 0) [1] 8 > ### points on boundary > sum(fred == 0) [1] 42 > > ### try on some new points > > y <- matrix(rnorm(2 * n * d), nrow = 2 * n) > y <- d2q(y) > > ### REVISED DOWN TO HERE > > ayb <- qmatmult(a, t(y)) > ayb <- sweep(ayb, 1, b, FUN = qmq) > fred <- apply(ayb, 2, function(foo) max(qsign(foo))) > > ### points in interior > sum(fred < 0) [1] 24 > ### points on boundary > sum(fred == 0) [1] 0 > ### points in exterior > sum(fred > 0) [1] 76 > > > proc.time() user system elapsed 8.25 0.09 8.32