Running 'test-Halton.R' [177s]
  Running 'test-SFMT.R' [0s]
  Running 'test-Sobol.R' [163s]
  Running 'test-Stirling.R' [0s]
  Running 'test-Torus.R' [0s]
  Running 'test-WELL.R' [158s]
  Running 'test-binary-op.R' [0s]
  Running 'test-envir.R' [0s]
  Running 'test-knuthTAOCP.R' [167s]
  Running 'test-mjrec.R' [153s]
  Running 'test-parallel-qmc.R' [156s]
  Running 'test-permut.R' [0s]
  Running 'test-runifInterface-LCG.R' [159s]
  Running 'test-runifInterface-nonLCG.R' [168s]
  Running 'test-sobol-basic.R' [163s]
  Running 'test-sobol-scram.R' [0s]
  Running 'test-sobol.V.R' [157s]
  Running 'test-sobol.directions.R' [0s]
Running the tests in 'tests/test-Halton.R' failed.
Complete output:
  > library(randtoolbox)
  Loading required package: rngWELL
  This is randtoolbox. For an overview, type 'help("randtoolbox")'.
  > 
  > #### outputs ####
  > print(halton(1, 5))
       [,1]      [,2] [,3]      [,4]       [,5]
  [1,]  0.5 0.3333333  0.2 0.1428571 0.09090909
  > 
  > options(digits=15)
  > n <- 100
  > n <- 5
  > cbind( 1/get.primes(n), as.vector(halton(1, n) ) )
                     [,1]               [,2]
  [1,] 0.5000000000000000 0.5000000000000000
  [2,] 0.3333333333333333 0.3333333333333333
  [3,] 0.2000000000000000 0.2000000000000000
  [4,] 0.1428571428571428 0.1428571428571428
  [5,] 0.0909090909090909 0.0909090909090909
  > 
  > #### n argument ####
  > try(halton(-1))
  Error in halton(-1) : invalid argument 'n'
  > 
  > #### dim argument ####
  > try(halton(1, 0))
  Error in halton(1, 0) : invalid argument 'dim'
  > 
  > 
  > #### init argument ####
  > halton(n)
  [1] 0.500 0.250 0.750 0.125 0.625
  > randtoolbox:::.getrandtoolboxEnv(".halton.seed")
  $base
  [1] 2
  
  $offset
  [1] 6
  
  > halton(n, init=TRUE)
  [1] 0.500 0.250 0.750 0.125 0.625
  > randtoolbox:::.getrandtoolboxEnv(".halton.seed")
  $base
  [1] 2
  
  $offset
  [1] 6
  
  > halton(n, init=FALSE)
  [1] 0.3750 0.8750 0.0625 0.5625 0.3125
  > try(halton(5, init="a"))
  Error in halton(5, init = "a") : invalid argument 'init'
  > 
  > #### mixed argument ####
  > 
  > try(halton(1, mixed=3))
  Error in halton(1, mixed = 3) : invalid argument 'mixed'
  > halton(n, mixed=TRUE)
  [1] 0.102862385101616 0.313063856214285 0.286233811639249 0.392372249159962
  [5] 0.701482330216095
  > 
  > #### usetime argument ####
  > #QMC with time machine start
  > halton(n, usetime=TRUE)
  [1] 0.9767913818359375 0.0236663818359375 0.5236663818359375 0.2736663818359375
  [5] 0.7736663818359375
  > halton(n, usetime=TRUE)
  [1] 0.9767913818359375 0.0236663818359375 0.5236663818359375 0.2736663818359375
  [5] 0.7736663818359375
  > 
  > #hybrid QMC with SFMT : test continuing the sequence (bug reported by Hiroyuki Kawakatsu)
  > setSeed(1234); 
  > halton(n, init=TRUE, mixed=TRUE, mexp=607)
  [1] 0.7717277337796986 0.2175991137046367 0.0579174996819347 0.9341774594504386
  [5] 0.7164084406103939
  > halton(n, init=FALSE, mixed=TRUE)
  [1] 0.296885532094166 0.920652552042156 0.437001249287277 0.144013730110601
  [5] 0.131321514490992
  > 
  > setSeed(1234); 
  > halton(n, init=TRUE, mixed=TRUE, mexp=607)
  [1] 0.7717277337796986 0.2175991137046367 0.0579174996819347 0.9341774594504386
  [5] 0.7164084406103939
  > halton(n, init=FALSE, mixed=TRUE) 
  [1] 0.296885532094166 0.920652552042156 0.437001249287277 0.144013730110601
  [5] 0.131321514490992
  > 
  > #### method argument ####
  > n <- 5
  > d <- 4
  > halton(n, d, method="C")
        [,1]              [,2] [,3]              [,4]
  [1,] 0.500 0.333333333333333 0.20 0.142857142857143
  [2,] 0.250 0.666666666666667 0.40 0.285714285714286
  [3,] 0.750 0.111111111111111 0.60 0.428571428571429
  [4,] 0.125 0.444444444444444 0.80 0.571428571428571
  [5,] 0.625 0.777777777777778 0.04 0.714285714285714
  > randtoolbox:::.getrandtoolboxEnv(".halton.seed")
  $base
  [1] 2 3 5 7
  
  $offset
  [1] 6
  
  > halton(n, d, method="C", start=5)
         [,1]              [,2] [,3]               [,4]
  [1,] 0.6250 0.777777777777778 0.04 0.7142857142857142
  [2,] 0.3750 0.222222222222222 0.24 0.8571428571428571
  [3,] 0.8750 0.555555555555556 0.44 0.0204081632653061
  [4,] 0.0625 0.888888888888889 0.64 0.1632653061224490
  [5,] 0.5625 0.037037037037037 0.84 0.3061224489795918
  > 
  > #### normal argument ####
  > halton(n, normal=TRUE)
  [1]  0.000000000000000 -0.674489750196082  0.674489750196082 -1.150349380376008
  [5]  0.318639363964375
  > try(halton(3, normal=1))
  Error in halton(3, normal = 1) : invalid argument 'normal'
  > 
  > #### mexp argument ####
  > halton(n, mexp=607)
  [1] 0.500 0.250 0.750 0.125 0.625
  > try(halton(3, mexp=3))
  Error in halton(3, mexp = 3) : 
    'mexp' must be in {607, 1279, 2281, 4253, 11213, 19937, 44497, 86243, 132049, 216091}. 
  > try(halton(3, mexp="3"))
  Error in halton(3, mexp = "3") : invalid argument 'mexp'
  > 
  > 
  > #### start argument ####
  > try(halton(3, start="3"))
  Error in halton(3, start = "3") : invalid argument 'start'
  > halton(n, start=0)
  [1] 0.000 0.500 0.250 0.750 0.125
  > halton(n, start=1)
  [1] 0.500 0.250 0.750 0.125 0.625
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.21    0.04    0.25 
Running the tests in 'tests/test-Sobol.R' failed.
Complete output:
  > library(randtoolbox)
  Loading required package: rngWELL
  This is randtoolbox. For an overview, type 'help("randtoolbox")'.
  > 
  > n <- 5
  > 
  > #### n argument ####
  > try(sobol(-1))
  Error in sobol(-1) : invalid argument 'n'
  > 
  > #### dim argument ####
  > try(sobol(1, 0))
  Error in sobol(1, 0) : invalid argument 'dim'
  > 
  > 
  > #### init argument ####
  > sobol(n)
  [1] 0.500 0.750 0.250 0.375 0.875
  > randtoolbox:::.getrandtoolboxEnv(".sobol.seed")
  $seed
  [1] 6
  
  > sobol(n, init=TRUE)
  [1] 0.500 0.750 0.250 0.375 0.875
  > randtoolbox:::.getrandtoolboxEnv(".sobol.seed")
  $seed
  [1] 6
  
  > sobol(n, init=FALSE)
  [1] 0.6250 0.1250 0.1875 0.6875 0.9375
  > try(sobol(5, init="a"))
  Error in sobol(5, init = "a") : invalid argument 'init'
  > 
  > #### mixed argument ####
  > 
  > try(sobol(1, mixed=3))
  Error in sobol(1, mixed = 3) : invalid argument 'mixed'
  > sobol(n, mixed=TRUE)
  [1] 0.500 0.750 0.250 0.375 0.875
  > 
  > #### normal argument ####
  > sobol(n, normal=TRUE)
  [1]  0.0000000  0.6744898 -0.6744898 -0.3186394  1.1503494
  > try(sobol(3, normal=1))
  Error in sobol(3, normal = 1) : invalid argument 'normal'
  > 
  > 
  > #### start argument ####
  > try(sobol(3, start="3"))
  Error in sobol(3, start = "3") : invalid argument 'start'
  > sobol(n, start=0)
  [1] 0.000 0.500 0.750 0.250 0.375
  > sobol(n, start=1)
  [1] 0.500 0.750 0.250 0.375 0.875
  > 
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.17    0.06    0.20 
Running the tests in 'tests/test-WELL.R' failed.
Complete output:
  > library(randtoolbox)
  Loading required package: rngWELL
  This is randtoolbox. For an overview, type 'help("randtoolbox")'.
  > 
  > params <- c(
  + 	"512a",
  + 	"521a",
  + 	"521b",
  + 	"607a",
  + 	"607b",
  + 	"800a",
  + 	"800b",
  + 	"1024a",
  + 	"1024b",
  + 	"19937a",
  + 	"19937b",
  + 	"19937c",
  + 	"21701a",
  + 	"23209a",
  + 	"23209b",
  + 	"44497a",
  + 	"44497b")
  > 
  > result1 <- rep(NA, times=length(params))
  > result2 <- rep(NA, times=length(params))
  > 
  > seed <- floor(2^31*runif(1))
  > cat("using seed", seed, "for test of the output of WELL RNG\n")
  using seed 920936892 for test of the output of WELL RNG
  > 
  > m <- 100
  > cat("generating sequences of the length", m, "from each generator\n")
  generating sequences of the length 100 from each generator
  > 
  > for (i in 1:length(params))
  + {
  + 	cat(i, "")
  + 	set.generator("WELL", version=params[i], seed=seed)
  + 	s0 <- getWELLState()
  + 	x <- runif(m)
  + 	out <- rngWELLScriptR(m, s0, params[i], includeState=TRUE)
  + 	s1 <- getWELLState()
  + 	result1[i] <- all(x == out$x)
  + 	result2[i] <- all(s1 == out$state)
  + }
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 > 
  > cat("\n\n")
  
  
  > print(data.frame(params, result1, result2))
     params result1 result2
  1    512a    TRUE    TRUE
  2    521a    TRUE    TRUE
  3    521b    TRUE    TRUE
  4    607a    TRUE    TRUE
  5    607b    TRUE    TRUE
  6    800a    TRUE    TRUE
  7    800b    TRUE    TRUE
  8   1024a    TRUE    TRUE
  9   1024b    TRUE    TRUE
  10 19937a    TRUE    TRUE
  11 19937b    TRUE    TRUE
  12 19937c    TRUE    TRUE
  13 21701a    TRUE    TRUE
  14 23209a    TRUE    TRUE
  15 23209b    TRUE    TRUE
  16 44497a    TRUE    TRUE
  17 44497b    TRUE    TRUE
  > 
  > stopifnot(all(result1, result2))
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.46    0.29    0.76 
Running the tests in 'tests/test-knuthTAOCP.R' failed.
Complete output:
  > library(randtoolbox)
  Loading required package: rngWELL
  This is randtoolbox. For an overview, type 'help("randtoolbox")'.
  > 
  > setSeed(1302)
  > knuthTAOCP(1)
  [1] 0.8092848
  > 
  > proc.time()
     user  system elapsed 
     0.18    0.04    0.21 
Running the tests in 'tests/test-mjrec.R' failed.
Complete output:
  > 
  > library(randtoolbox)
  Loading required package: rngWELL
  This is randtoolbox. For an overview, type 'help("randtoolbox")'.
  > 
  > mytrace <- TRUE
  > mytrace <- FALSE
  > 
  > if(FALSE)
  + {
  + 
  + #degree 0
  + mjrec(1, 1, echo=mytrace)
  + 
  + #degree 3 : x^3+x^2+1, p306 Glasserman (2003)
  + p13 <- int2bit(13)
  + m1 <- 1
  + m2 <- m3 <- 3
  + 
  + prevmj <- cbind(int2bit(m1), int2bit(m2), int2bit(m3))
  + res <- mjrec(prevmj, p13, echo=mytrace)
  + m4 <- bit2int(res)
  + 
  + prevmj <- cbind(int2bit(m2), int2bit(m3), int2bit(m4))
  + res <- mjrec(prevmj, p13, echo=mytrace)
  + m5 <- bit2int(res)
  + 
  + c(m1, m2, m3, m4, m5)
  + 
  + #degree 1 : x+1, p319 Glasserman (2003)
  + p3 <- int2bit(3)
  + m1 <- 1 
  + res <- mjrec(int2bit(m1), p3, echo=mytrace)
  + m2 <- bit2int(res)
  + 
  + prevmj <- cbind(int2bit(m1), int2bit(m2))
  + res <- mjrec(prevmj, p3, echo=mytrace)
  + m3 <- bit2int(res)
  + 
  + prevmj <- cbind(int2bit(m1), int2bit(m2), int2bit(m3))
  + res <- mjrec(prevmj, p3, echo=mytrace)
  + m4 <- bit2int(res)
  + 
  + c(m1, m2, m3, m4)
  + 
  + }
  > 
  > proc.time()
     user  system elapsed 
     0.18    0.06    0.23 
Running the tests in 'tests/test-parallel-qmc.R' failed.
Complete output:
  > if(FALSE)
  + {
  +   library(randtoolbox)
  +   library(parallel)
  +   
  +   #init can be used to continue the sequence
  +   halton(1, init=TRUE)
  +   halton(10, init=FALSE)
  +   #should be the same
  +   halton(11, init=TRUE)
  +   
  +   #init can be used to continue the sequence
  +   sobol(1, init=TRUE)
  +   sobol(10, init=FALSE)
  +   #should be the same
  +   sobol(11, init=TRUE)
  +   
  +   
  +   sobol(1:10, scramb=3, init=TRUE, seed=4711) 
  +   sobol(1:10, scramb=3, init=TRUE, seed=6523) 
  +   
  +   
  +   
  +   if (.Platform$OS.type == "windows")
  +   {
  +     parallel <- "snow"
  +     type <- "PSOCK"
  +   }else
  +   {
  +     parallel <- "multicore" 
  +     type <- "FORK"
  +   }
  +   
  +   
  +   
  +   func <- function(i, n)
  +   {
  +     u <- sobol(n, scramb=3, init=TRUE, seed=4711*i)
  +     c(quantile(u), mean=mean(u), var=var(u))
  +   }
  +   
  +   clus <- parallel::makeCluster(2, type = type)
  +   parallel::clusterEvalQ(clus, library(randtoolbox))
  +   res <- parallel::parSapply(clus, 1:2, func, n=1e4)
  +   parallel::stopCluster(clus)
  +   
  +   res
  + }
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.18    0.01    0.18 
Running the tests in 'tests/test-runifInterface-LCG.R' failed.
Complete output:
  > library(randtoolbox)
  Loading required package: rngWELL
  This is randtoolbox. For an overview, type 'help("randtoolbox")'.
  > 
  > #see e.g. https://en.wikipedia.org/wiki/Linear_congruential_generator
  > 
  >   RNGkind()
  [1] "Mersenne-Twister" "Inversion"        "Rejection"       
  >   
  >   #Park Miller congruential generator : mod = 2147483647= 2^31-1, mult=16807, incr=0
  >   LCG.par <- c("2147483647", "16807", "0")
  >   set.generator(name="congruRand", mod=LCG.par[1], mult=LCG.par[2], incr=LCG.par[3], seed=12345)
  >   LCG <- get.description()
  >   LCG$parameters == LCG.par
   mod mult incr 
  TRUE TRUE TRUE 
  >   x1 <- runif(5)
  >   setSeed(12345)
  >   x2 <- congruRand(5, dim=1, mod=2^31-1, mult=16807, incr=0)
  >   print(cbind(x1, x2))
               x1         x2
  [1,] 0.09661653 0.09661653
  [2,] 0.83399463 0.83399463
  [3,] 0.94770250 0.94770250
  [4,] 0.03587859 0.03587859
  [5,] 0.01154585 0.01154585
  >   print(sum(abs(x1 - x2)))
  [1] 0
  >   
  >   RNGkind()
  [1] "user-supplied" "Inversion"     "Rejection"    
  >   
  >   # the Knuth Lewis RNG : mod=4294967296 == 2^32, mult=1664525, incr=1013904223
  >   LCG.par <- c("4294967296", "1664525", "1013904223")
  >   set.generator(name="congruRand", mod=LCG.par[1], mult=LCG.par[2], incr=LCG.par[3], seed=1)
  >   LCG <- get.description()
  >   LCG$parameters == LCG.par
   mod mult incr 
  TRUE TRUE TRUE 
  >   x1 <- runif(5)
  >   setSeed(1)
  >   x2 <- congruRand(5, dim=1, mod=4294967296, mult=1664525, incr=1013904223)
  >   print(cbind(x1, x2))
               x1         x2
  [1,] 0.23645553 0.23645553
  [2,] 0.36927067 0.36927067
  [3,] 0.50424203 0.50424203
  [4,] 0.70488326 0.70488326
  [5,] 0.05054363 0.05054363
  >   print(sum(abs(x1 - x2)))
  [1] 0
  >   
  > if(.Platform$OS.type != "windows")
  + {
  +   # the POSIX rand48 : 281474976710656 == 2^48
  +   LCG.par <- c("281474976710656", "25214903917", "11")
  +   set.generator(name="congruRand", mod=LCG.par[1], mult=LCG.par[2], incr=LCG.par[3], seed=1)
  +   LCG <- get.description()
  +   LCG$parameters == LCG.par
  +   x1 <- runif(5)
  +   setSeed(1)
  +   x2 <- congruRand(5, dim=1, mod=281474976710656, mult=25214903917, incr=11)
  +   print(cbind(x1, x2))
  +   print(sum(abs(x1 - x2)))
  + }
  >   
  > if(FALSE) #congruRand() does not handle 2^64 correctly but set.generator() does 
  + {
  +   
  +   # the MMIX RNG by Donald Knuth => produce two different result after the second term
  +   # 18446744073709551616 == 2^64
  +   LCG.par <- c("18446744073709551616", "1442695040888963407", "1013904223")
  +   set.generator(name="congruRand", mod=LCG.par[1], mult=LCG.par[2], incr=LCG.par[3], seed=1)
  +   LCG <- get.description()
  +   LCG$parameters == LCG.par
  +   x1 <- runif(5)
  +   setSeed(1)
  +   x2 <- congruRand(5, dim=1, mod=18446744073709551616, mult=1442695040888963407, incr=1013904223)
  +   print(cbind(x1, x2))
  +   #only first value is correct
  +   (1442695040888963407 * 1 + 1013904223) / 2^64
  +   
  +   #Haynes RNG
  +   LCG.par <- c("18446744073709551616", "636412233846793005", "1")
  +   set.generator(name="congruRand", mod=LCG.par[1], mult=LCG.par[2], incr=LCG.par[3], seed=1)
  +   LCG <- get.description()
  +   LCG$parameters == LCG.par
  +   x1 <- runif(5)
  +   setSeed(1)
  +   x2 <- congruRand(5, dim=1, mod=18446744073709551616, mult=636412233846793005, incr=1, echo = TRUE)
  +   print(cbind(x1, x2))
  +   
  +   #only first value is correct
  +   (636412233846793005 * 1 + 1) / 2^64
  + }
  > 
  > proc.time()
     user  system elapsed 
     0.17    0.12    0.26 
Running the tests in 'tests/test-runifInterface-nonLCG.R' failed.
Complete output:
  > library(randtoolbox)
  Loading required package: rngWELL
  This is randtoolbox. For an overview, type 'help("randtoolbox")'.
  > RNGkind()
  [1] "Mersenne-Twister" "Inversion"        "Rejection"       
  > 
  > n <- 10
  > 
  > #set WELL19937a
  > set.generator("WELL", version="19937a", seed=12345)
  > runif(n)
   [1] 0.96877622 0.93477110 0.64725061 0.82920786 0.56494618 0.87516860
   [7] 0.59501939 0.54398493 0.98080228 0.04542682
  > 
  > 
  > storedState <- get.description()
  > x <- runif(n)
  > 
  > y <- runif(n)
  > 
  > #Restore the generator from storedState and regenerate the same numbers
  > put.description(storedState)
  > all(x == runif(n))
  [1] TRUE
  > 
  > 
  > # generate the same random numbers as in Matlab
  > set.generator("MersenneTwister", initialization="init2002", resolution=53, seed=12345)
  > runif(n)
   [1] 0.9296161 0.3163756 0.1839188 0.2045603 0.5677250 0.5955447 0.9645145
   [8] 0.6531771 0.7489066 0.6535699
  > # [1] 0.9296161 0.3163756 0.1839188 0.2045603 0.5677250
  > # Matlab commands rand('twister', 12345); rand(1, 5) generate the same numbers,
  > # which in short format are   0.9296    0.3164    0.1839    0.2046    0.5677
  > 
  > 
  > storedState <- get.description()
  > 
  > proc.time()
     user  system elapsed 
     0.23    0.04    0.23 
Running the tests in 'tests/test-sobol-basic.R' failed.
Complete output:
  > library(randtoolbox)
  Loading required package: rngWELL
  This is randtoolbox. For an overview, type 'help("randtoolbox")'.
  > 
  > 
  > if(FALSE)
  + {
  +   
  +   n <- 10
  +   mymj <- list(
  +     c(1),
  +     c(1),
  +     c(1,3,7))
  +   mypj <- c(1, 3, 7)
  +   
  +   myV <- sobol.V(mymj ,mypj, bitnb=31, echo=FALSE)
  + 
  +     
  +   uD1 <- sobol.basic(n, myV[[1]], bitnb=31, echo=FALSE, output="real",
  +                           start=1)
  +   uD2 <- sobol.basic(n, myV[[2]], bitnb=31, echo=FALSE, output="real",
  +               start=1)
  +   uD3 <- sobol.basic(n, myV[[3]], bitnb=31, echo=FALSE, output="real",
  +               start=1)
  +   
  +   sobol.check <- read.csv("sobol.check.csv")
  +   
  +   sobol.check[1:n, 1:3] == cbind(uD1, uD2, uD3)
  +   
  +   
  +   sobol.R(n, 3)
  + }
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.21    0.04    0.25 
Running the tests in 'tests/test-sobol.V.R' failed.
Complete output:
  > 
  > library(randtoolbox)
  Loading required package: rngWELL
  This is randtoolbox. For an overview, type 'help("randtoolbox")'.
  > 
  > mytrace <- TRUE
  > mytrace <- FALSE
  > 
  > if(FALSE)
  + {
  + #p318 Glasserman (2003)
  + 
  + mymj <- list(
  + c(1,1,1),
  + c(1,3,5),
  + c(1,1,7))
  + mypj <- c(1, 3, 7)
  + 
  + sobol.V(mymj ,mypj, bitnb=5, echo=FALSE)
  + 
  + 
  + mymj <- list(
  +   c(1),
  +   c(1),
  +   c(1,1,7))
  + mypj <- c(1, 3, 7)
  + 
  + sobol.V(mymj ,mypj, bitnb=5, echo=FALSE)
  + 
  + }
  > 
  > proc.time()
     user  system elapsed 
     0.17    0.12    0.25