Running 'allfaces.R' [0s]
  Comparing 'allfaces.Rout' to 'allfaces.Rout.save' ... OK
  Running 'arith.R' [0s]
  Comparing 'arith.Rout' to 'arith.Rout.save' ... OK
  Running 'bar-gmp.R' [0s]
  Comparing 'bar-gmp.Rout' to 'bar-gmp.Rout.save' ... OK
  Running 'bar.R' [0s]
  Comparing 'bar.Rout' to 'bar.Rout.save' ... OK
  Running 'bug.R' [165s]
  Running 'bug2.R' [0s]
  Comparing 'bug2.Rout' to 'bug2.Rout.save' ... OK
  Running 'chull.R' [169s]
  Running 'chull2.R' [158s]
  Running 'convert.R' [164s]
  Running 'fred.R' [0s]
  Comparing 'fred.Rout' to 'fred.Rout.save' ... OK
  Running 'lpcdd.R' [0s]
  Comparing 'lpcdd.Rout' to 'lpcdd.Rout.save' ... OK
  Running 'make.R' [0s]
  Comparing 'make.Rout' to 'make.Rout.save' ... OK
  Running 'oops.R' [1s]
  Comparing 'oops.Rout' to 'oops.Rout.save' ... OK
  Running 'qgram.R' [166s]
  Running 'qmatmult.R' [0s]
  Comparing 'qmatmult.Rout' to 'qmatmult.Rout.save' ... OK
  Running 'qux-gmp.R' [0s]
  Comparing 'qux-gmp.Rout' to 'qux-gmp.Rout.save' ... OK
  Running 'qux.R' [0s]
  Comparing 'qux.Rout' to 'qux.Rout.save' ... OK
  Running 'redund.R' [0s]
  Comparing 'redund.Rout' to 'redund.Rout.save' ... OK
  Running 'sammy.R' [0s]
  Comparing 'sammy.Rout' to 'sammy.Rout.save' ... OK
  Running 'subset.R' [170s]
  Running 'zero.R' [163s]
Running the tests in 'tests/bug.R' failed.
Complete output:
  > 
  >  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)
  > 
  >  ways <- 7
  > 
  >  dat <- matrix(NA, nrow = 2^ways, ncol = ways)
  >  for (i in 1:ways)
  +     dat[ , i] = rep(rep(0:1, each = 2^(i - 1)), times = 2^(ways - i))
  > 
  >  colnames(dat) <- paste("v", 1:ways, sep = "")
  >  dat <- as.data.frame(dat)
  >  for (i in 1:ncol(dat)) dat[[i]] <- as.factor(dat[[i]])
  >  
  >  mu <- 5
  >  y <- rpois(nrow(dat), mu)
  >  dat <- cbind(dat, y = y)
  > 
  >  M <- model.matrix(y ~ (v1 + v2 + v3 + v4 + v5 + v6 + v7)^3, data = dat)
  > 
  >  v <- M
  >  linearity <- y > 0
  > 
  >    stopifnot(is.numeric(v))
  >    stopifnot(all(is.finite(v)))
  >    stopifnot(is.matrix(v))
  >    if (! missing(linearity)) {
  +        stopifnot(is.logical(linearity))
  +        stopifnot(length(linearity) == nrow(v))
  +    } else {
  +        linearity <- rep(FALSE, nrow(v))
  +    }
  > 
  >    v <- d2q(v)
  >    lresult <- rep(TRUE, nrow(v))
  > 
  >        vresult <- v[lresult, , drop = FALSE]
  >        w <- apply(vresult, 2, qsum)
  >        wminus <- qmq(rep("0", length(w)), w)
  > 
  >        hrep <- rbind(wminus, vresult)
  >        fred <- c(1, rep(0, nrow(vresult)))
  >        hrep <- cbind(as.character(fred), hrep)
  >        fred <- c(0, as.numeric(linearity[lresult]))
  >        hrep <- cbind(as.character(fred), hrep)
  >        dimnames(hrep) <- NULL
  > 
  >  out <- lpcdd(hrep, w, minimize = FALSE)
  >  print(out)
  $solution.type
  [1] "Optimal"
  
  $primal.solution
   [1] "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0"
  [20] "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0"
  [39] "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0"
  [58] "0" "0" "0" "0" "0" "0" "0"
  
  $dual.solution
    [1] "0"     "0"     "-4/5"  "-4/5"  "0"     "-4/5"  "0"     "0"     "-24/5"
   [10] "-4/5"  "0"     "0"     "-24/5" "0"     "-24/5" "-24/5" "32/5"  "-4"   
   [19] "0"     "0"     "-8/5"  "0"     "-8/5"  "-8/5"  "0"     "0"     "-8/5" 
   [28] "-8/5"  "0"     "-8/5"  "0"     "0"     "-12/5" "-4"    "0"     "0"    
   [37] "-8/5"  "0"     "-8/5"  "-8/5"  "0"     "0"     "-8/5"  "-8/5"  "0"    
   [46] "-8/5"  "0"     "0"     "-12/5" "0"     "-8/5"  "-8/5"  "0"     "-8/5" 
   [55] "0"     "0"     "-12/5" "-8/5"  "0"     "0"     "-12/5" "0"     "-12/5"
   [64] "-12/5" "0"     "-8/5"  "0"     "0"     "-12/5" "0"     "-12/5" "-12/5"
   [73] "0"     "0"     "-12/5" "-12/5" "0"     "-12/5" "0"     "0"     "0"    
   [82] "0"     "-12/5" "-12/5" "0"     "-12/5" "0"     "0"     "0"     "-12/5"
   [91] "0"     "0"     "0"     "0"     "0"     "0"     "-32/5" "0"     "-12/5"
  [100] "-12/5" "0"     "-12/5" "0"     "0"     "0"     "-12/5" "0"     "0"    
  [109] "0"     "0"     "0"     "0"     "-32/5" "4/5"   "0"     "0"     "-16/5"
  [118] "0"     "-16/5" "-16/5" "0"     "0"     "-16/5" "-16/5" "0"     "-16/5"
  [127] "0"     "0"     "12/5" 
  
  $optimal.value
  [1] "0"
  
  > 
  >  ##### check gradient of Lagrangian function zero
  >  b.augmented <- hrep[ , 2]
  >  v.augmented <- hrep[ , - c(1, 2)]
  >  blurfle <- out$dual.solution
  >  all(qpq(w, qmatmult(rbind(blurfle), v.augmented)) == "0")
  [1] TRUE
  > 
  >  ##### check primal feasibility (trivial here since solution is zero, but)
  >  blurfle <- out$primal.solution
  >  foo <- qpq(b.augmented, qmatmult(v.augmented, cbind(blurfle)))
  >  all(qsign(foo) >= 0)
  [1] TRUE
  >  
  >  ##### check dual feasibility
  >  blurfle <- qsign(out$dual.solution)
  >  linearity.augmented <- c(FALSE, linearity)
  >  length(linearity.augmented) == nrow(hrep)
  [1] TRUE
  >  all(blurfle[! linearity.augmented] >= 0)
  [1] TRUE
  > 
  >  ##### check complementary slackness
  >  all(qsign(foo) * qsign(blurfle) == 0)
  [1] TRUE
  > 
  >  ##### now redo with ordinary computer arithmetic
  >  aout <- lpcdd(q2d(hrep), q2d(w), minimize = FALSE)
  >  names(aout)
  [1] "solution.type"   "primal.solution" "dual.solution"   "optimal.value"  
  >  names(out)
  [1] "solution.type"   "primal.solution" "dual.solution"   "optimal.value"  
  >  for (i in 2:length(out))
  +      print(all.equal(aout[[i]], q2d(out[[i]])))
  [1] TRUE
  [1] TRUE
  [1] TRUE
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.32    0.10    0.42 
Running the tests in 'tests/chull.R' failed.
Complete output:
  > 
  >  library(rcdd)
  If you want correct answers, use rational arithmetic.
  See the Warnings sections in help pages for
      functions that do computational geometry.
  > 
  >  d <- 5
  >  npoint <- 50
  >  set.seed(42)
  >  x <- matrix(rnorm(d * npoint), ncol = d)
  > 
  >  foo <- cbind(1, x)
  >  foo <- cbind(0, foo)
  >  foo <- round(1e4 * foo)
  >  bar <- rep(1e4, length(foo))
  >  baz <- qdq(foo, bar)
  > 
  >  baz[1:3, ]
       [,1] [,2] [,3]          [,4]          [,5]        [,6]        
  [1,] "0"  "1"  "1371/1000"   "3219/10000"  "1201/1000" "-407/10000"
  [2,] "0"  "1"  "-5647/10000" "-3919/5000"  "653/625"   "-3103/2000"
  [3,] "0"  "1"  "3631/10000"  "15757/10000" "-627/625"  "1459/1250" 
       [,7]          
  [1,] "-20009/10000"
  [2,] "1669/5000"   
  [3,] "11713/10000" 
  >  
  >  out <- scdd(baz, inputincidence = TRUE, representation = "V")
  >  names(out)
  [1] "output"         "inputincidence" "input"         
  > 
  >  length(out$inputincidence)
  [1] 50
  >  inies <- sapply(out$inputincidence, length) > 0
  >  length(inies)
  [1] 50
  >  sum(inies)
  [1] 42
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.78    0.03    0.79 
Running the tests in 'tests/chull2.R' failed.
Complete output:
  > 
  >  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 
     7.18    0.06    7.23 
Running the tests in 'tests/convert.R' failed.
Complete output:
  > 
  >  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)
  >  x <- matrix(runif(4), 2, 2)
  >  print(x)
            [,1]      [,2]
  [1,] 0.9148060 0.2861395
  [2,] 0.9370754 0.8304476
  > 
  >  y <- d2q(x)
  >  print(y)
       [,1]                    [,2]                   
  [1,] "3929062039/4294967296" "153619993/536870912"  
  [2,] "2012354127/2147483648" "3566745395/4294967296"
  > 
  >  xfoo <- x
  >  attr(xfoo, "blurfle") <- "woof!"
  >  class(xfoo) <- c("foo", "bar", "baz")
  >  yfoo <- d2q(xfoo)
  >  print(yfoo)
       [,1]                    [,2]                   
  [1,] "3929062039/4294967296" "153619993/536870912"  
  [2,] "2012354127/2147483648" "3566745395/4294967296"
  attr(,"blurfle")
  [1] "woof!"
  attr(,"class")
  [1] "foo" "bar" "baz"
  > 
  >  z <- q2d(y)
  >  print(z)
            [,1]      [,2]
  [1,] 0.9148060 0.2861395
  [2,] 0.9370754 0.8304476
  > 
  >  x - z
       [,1] [,2]
  [1,]    0    0
  [2,]    0    0
  > 
  >  foo <- d2q(0.5)
  >  print(foo)
  [1] "1/2"
  >  bar <- q2q(foo)
  >  print(bar)
  [1] "1/2"
  >  bar[1] <- "-15/3"
  >  baz <- q2q(bar)
  >  print(baz)
  [1] "-5"
  > 
  >  numer <- as.character(seq(-3, 3))
  >  denom <- as.character(seq(along = numer))
  >  qux <- z2q(numer, denom)
  >  print(qux)
  [1] "-3"   "-1"   "-1/3" "0"    "1/5"  "1/3"  "3/7" 
  > 
  >  numer <- seq(-3, 3)
  >  denom <- seq(along = numer)
  >  qux <- z2q(numer, denom)
  >  print(qux)
  [1] "-3"   "-1"   "-1/3" "0"    "1/5"  "1/3"  "3/7" 
  > 
  >  qux <- z2q(numer, denom, canonicalize = FALSE)
  >  print(qux)
  [1] "-3/1" "-2/2" "-1/3" "0/4"  "1/5"  "2/6"  "3/7" 
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.18    0.07    0.18 
Running the tests in 'tests/qgram.R' failed.
Complete output:
  > 
  >  set.seed(42)
  > 
  >  library(rcdd)
  If you want correct answers, use rational arithmetic.
  See the Warnings sections in help pages for
      functions that do computational geometry.
  > 
  >  d <- 10
  >  n <- 5
  >  foo <- matrix(rnorm(d * n), d)
  > 
  >  bar <- qgram(foo)
  > 
  >  baz <- qmatmult(t(bar), bar)
  >  all(baz[row(baz) != col(baz)] == "0")
  [1] TRUE
  > 
  >  all(apply(qabs(bar), 2, qsum) == "1")
  [1] TRUE
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.18    0.07    0.25 
Running the tests in 'tests/subset.R' failed.
Complete output:
  > 
  >  library(rcdd)
  If you want correct answers, use rational arithmetic.
  See the Warnings sections in help pages for
      functions that do computational geometry.
  > 
  >  .Call(rcdd:::C_test_my_subset, integer(0), as.integer(1:3), as.integer(3))
  [1] TRUE
  > 
  >  .Call(rcdd:::C_test_my_subset, as.integer(1:3), integer(0), as.integer(4))
  [1] FALSE
  > 
  >  .Call(rcdd:::C_test_my_subset, as.integer(1:3), as.integer(1), as.integer(5))
  [1] FALSE
  > 
  >  .Call(rcdd:::C_test_my_subset, as.integer(1:3), as.integer(1:3), as.integer(6))
  [1] TRUE
  > 
  >  .Call(rcdd:::C_test_my_subset, as.integer(1:2), as.integer(1:3), as.integer(7))
  [1] TRUE
  > 
  >  #### need to test for collisions
  > 
  >  pow2 <- 5
  >  hashsize <- 2^pow2
  > 
  >  i <- seq(1:1000)
  >  hashi <- (2654435761 * i) %% hashsize
  >  hash1 <- i[hashi == hashi[1]]
  > 
  >  set2 <- hash1[1:10]
  >  print(set2)
   [1]   1  33  65  97 129 161 193 225 257 289
  > 
  >  set1 <- sample(set2, 4)
  > 
  >  .Call(rcdd:::C_test_my_subset, as.integer(set1), as.integer(set2), as.integer(pow2))
  [1] TRUE
  >  
  >  set1 <- sample(set2, 4)
  > 
  >  .Call(rcdd:::C_test_my_subset, as.integer(set1), as.integer(set2), as.integer(pow2))
  [1] TRUE
  > 
  >  set1 <- union(set1, 1001)
  > 
  >  .Call(rcdd:::C_test_my_subset, as.integer(set1), as.integer(set2), as.integer(pow2))
  [1] FALSE
  > 
  >  options(error=dump.frames)
  > 
  >  .Call(rcdd:::C_test_my_subset, as.integer(set1), as.integer(hash1), as.integer(pow2))
  Error: too many collisions in hash table, increase table size
  > 
  >  .Call(rcdd:::C_test_my_subset, as.integer(set1), as.integer(hash1),
  +       as.integer(pow2 + 3))
  [1] FALSE
  > 
  >  options(error=NULL)
  > 
  >  sets <- list(1, 2, c(1, 2), 3, 4, 5, c(4, 5), c(4, 5, 6), c(1, 3, 5))
  >  sets <- lapply(sets, as.integer)
  > 
  >  .Call(rcdd:::C_nonred, sets, as.integer(pow2))
  [1] FALSE FALSE  TRUE FALSE FALSE FALSE FALSE  TRUE  TRUE
  > 
  >  maximal(sets)
  [1] FALSE FALSE  TRUE FALSE FALSE FALSE FALSE  TRUE  TRUE
  > 
  >  ##### intersections #####
  > 
  >  .Call(rcdd:::C_all_intersect, sets, as.integer(pow2))
  [[1]]
  integer(0)
  
  [[2]]
  [1] 1
  
  [[3]]
  integer(0)
  
  [[4]]
  integer(0)
  
  [[5]]
  integer(0)
  
  [[6]]
  integer(0)
  
  [[7]]
  integer(0)
  
  [[8]]
  [1] 1
  
  [[9]]
  [1] 2
  
  [[10]]
  integer(0)
  
  [[11]]
  integer(0)
  
  [[12]]
  integer(0)
  
  [[13]]
  integer(0)
  
  [[14]]
  integer(0)
  
  [[15]]
  integer(0)
  
  [[16]]
  integer(0)
  
  [[17]]
  integer(0)
  
  [[18]]
  integer(0)
  
  [[19]]
  integer(0)
  
  [[20]]
  integer(0)
  
  [[21]]
  [1] 1
  
  [[22]]
  integer(0)
  
  [[23]]
  integer(0)
  
  [[24]]
  integer(0)
  
  [[25]]
  integer(0)
  
  [[26]]
  [1] 3
  
  [[27]]
  integer(0)
  
  [[28]]
  [1] 4
  
  [[29]]
  [1] 4
  
  [[30]]
  integer(0)
  
  [[31]]
  [1] 5
  
  [[32]]
  [1] 5
  
  [[33]]
  [1] 5
  
  [[34]]
  [1] 4 5
  
  [[35]]
  [1] 5
  
  [[36]]
  [1] 5
  
  > 
  >  sets <- list(c(1, 2, 3), c(2, 3, 4), c(3, 4, 5), c(4, 5, 1), c(5, 1, 2))
  >  sets <- lapply(sets, as.integer)
  > 
  >  .Call(rcdd:::C_all_intersect, sets, as.integer(pow2))
  [[1]]
  [1] 2 3
  
  [[2]]
  [1] 3
  
  [[3]]
  [1] 1
  
  [[4]]
  [1] 1 2
  
  [[5]]
  [1] 3 4
  
  [[6]]
  [1] 4
  
  [[7]]
  [1] 2
  
  [[8]]
  [1] 4 5
  
  [[9]]
  [1] 5
  
  [[10]]
  [1] 5 1
  
  >  
  >  allIntersect(sets)
  [[1]]
  [1] 2 3
  
  [[2]]
  [1] 3
  
  [[3]]
  [1] 1
  
  [[4]]
  [1] 1 2
  
  [[5]]
  [1] 3 4
  
  [[6]]
  [1] 4
  
  [[7]]
  [1] 2
  
  [[8]]
  [1] 4 5
  
  [[9]]
  [1] 5
  
  [[10]]
  [1] 5 1
  
  > 
  >  ##### unions #####
  > 
  >  .Call(rcdd:::C_all_union, sets, as.integer(pow2))
  [[1]]
  [1] 1 2 3 4
  
  [[2]]
  [1] 1 2 3 4 5
  
  [[3]]
  [1] 1 2 3 4 5
  
  [[4]]
  [1] 1 2 3 5
  
  [[5]]
  [1] 2 3 4 5
  
  [[6]]
  [1] 2 3 4 5 1
  
  [[7]]
  [1] 2 3 4 5 1
  
  [[8]]
  [1] 3 4 5 1
  
  [[9]]
  [1] 3 4 5 1 2
  
  [[10]]
  [1] 4 5 1 2
  
  > 
  >  sets <- list(1, 2, c(3, 4), c(1, 3), 5)
  >  sets <- lapply(sets, as.integer)
  > 
  >  .Call(rcdd:::C_all_union, sets, as.integer(pow2))
  [[1]]
  [1] 1 2
  
  [[2]]
  [1] 1 3 4
  
  [[3]]
  [1] 1 3
  
  [[4]]
  [1] 1 5
  
  [[5]]
  [1] 2 3 4
  
  [[6]]
  [1] 2 1 3
  
  [[7]]
  [1] 2 5
  
  [[8]]
  [1] 3 4 1
  
  [[9]]
  [1] 3 4 5
  
  [[10]]
  [1] 1 3 5
  
  > 
  >  allUnion(sets)
  [[1]]
  [1] 1 2
  
  [[2]]
  [1] 1 3 4
  
  [[3]]
  [1] 1 3
  
  [[4]]
  [1] 1 5
  
  [[5]]
  [1] 2 3 4
  
  [[6]]
  [1] 2 1 3
  
  [[7]]
  [1] 2 5
  
  [[8]]
  [1] 3 4 1
  
  [[9]]
  [1] 3 4 5
  
  [[10]]
  [1] 1 3 5
  
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.18    0.06    0.23 
Running the tests in 'tests/zero.R' failed.
Complete output:
  > 
  >  library(rcdd)
  If you want correct answers, use rational arithmetic.
  See the Warnings sections in help pages for
      functions that do computational geometry.
  > 
  >  qux <- matrix(0, 0, 6)
  > 
  >  out <- scdd(qux, representation = "H")
  >  print(out)
  $output
       [,1] [,2] [,3] [,4] [,5] [,6]
  [1,]    1    0    1    0    0    0
  [2,]    1    0    0    1    0    0
  [3,]    1    0    0    0    1    0
  [4,]    1    0    0    0    0    1
  attr(,"representation")
  [1] "V"
  
  > 
  >  scdd(out$output)
  $output
       [,1] [,2] [,3] [,4] [,5] [,6]
  attr(,"representation")
  [1] "H"
  
  > 
  >  out <- scdd(qux, representation = "H", adjacency = TRUE,
  +      inputadjacency = TRUE, incidence = TRUE, inputincidence = TRUE)
  >  print(out)
  $output
       [,1] [,2] [,3] [,4] [,5] [,6]
  [1,]    1    0    1    0    0    0
  [2,]    1    0    0    1    0    0
  [3,]    1    0    0    0    1    0
  [4,]    1    0    0    0    0    1
  attr(,"representation")
  [1] "V"
  
  $adjacency
  list()
  
  $inputadjacency
  list()
  
  $incidence
  $incidence[[1]]
  integer(0)
  
  $incidence[[2]]
  integer(0)
  
  $incidence[[3]]
  integer(0)
  
  $incidence[[4]]
  integer(0)
  
  
  $inputincidence
  list()
  
  $input
       [,1] [,2] [,3] [,4] [,5] [,6]
  
  > 
  >  options(error=dump.frames)
  > 
  >  out <- scdd(qux, representation = "V")
  Error in scdd(qux, representation = "V") : 
    no rows in 'm', not allowed for V-representation
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.21    0.03    0.23