Running ‘testthat.R’ [5s/7s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(SPOT)
  > 
  > test_check("SPOT")
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  SPOT
   --- call from context --- 
  krigingLikelihood(x, fX, fy, optimizeP, useLambda)
   --- call from argument --- 
  if (class(cholPsi) == "try-error") {
      penalty <- 10000 - min(eigen(Psi, symmetric = TRUE, only.values = TRUE)$values)
      return(list(NegLnLike = penalty, Psi = NA, Psinv = NA, mu = NA, 
          SSQ = NA))
  }
   --- R stacktrace ---
  where 1: krigingLikelihood(x, fX, fy, optimizeP, useLambda)
  where 2: FUN(newX[, i], ...)
  where 3: apply(x, 1, fitFun, fX, fy, optimizeP, useLambda)
  where 4: fun(matrix(x, 1), ...)
  where 5: fn(par, ...)
  where 6: (function (par) 
  fn(par, ...))(c(0.05, 0.05, 0))
  where 7: optim(par = x, fn = fn, lower = lower, upper = upper, control = control, 
      method = "L-BFGS-B", ...)
  where 8: fit$algTheta(x = x0, fun = function(x, fX, fy, optimizeP, useLambda) {
      if (!is.matrix(x)) {
          fitFun(x, fX, fy, optimizeP, useLambda)
      }
      else {
          apply(x, 1, fitFun, fX, fy, optimizeP, useLambda)
      }
  }, lower = LowerTheta, upper = UpperTheta, control = opts, fX = A, 
      fy = fit$y, optimizeP = fit$optimizeP, useLambda = fit$useLambda)
  where 9: control$model(x = x, y = y, control = control$modelControl)
  where 10: spotLoop(x = x, y = y, fun = fun, lower = lower, upper = upper, 
      control = control, ...)
  where 11 at testthat/test.inequalityConstraint.R#32: spot(, fun = funSphere, lower = c(-10, -20), upper = c(20, 8), 
      control = list(funEvals = 15, modelControl = list(target = "ei"), 
          optimizer = optimNLOPTR, optimizerControl = contr))
  where 12: eval(code, test_env)
  where 13: eval(code, test_env)
  where 14: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 15: doTryCatch(return(expr), name, parentenv, handler)
  where 16: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 17: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 20: tryCatchList(expr, classes, parentenv, handlers)
  where 21: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 22: test_code(desc, code, env = parent.frame())
  where 23 at testthat/test.inequalityConstraint.R#26: test_that("check SPOT+NLOPTR with inequality constraints but with default design", 
      {
          contr <- list()
          contr$eval_g_ineq <- function(x) 1 + x[1] - x[2]
          contr$funEvals <- 100
          contr$opts$algorithm <- "NLOPT_GN_ISRES"
          res <- spot(, fun = funSphere, lower = c(-10, -20), upper = c(20, 
              8), control = list(funEvals = 15, modelControl = list(target = "ei"), 
              optimizer = optimNLOPTR, optimizerControl = contr))
          res$xbest
          res$ybest
          expect_true(!all(apply(res$x, 1, contr$eval_g_ineq) <= 
              0))
      })
  where 24: eval(code, test_env)
  where 25: eval(code, test_env)
  where 26: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 27: doTryCatch(return(expr), name, parentenv, handler)
  where 28: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 29: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 30: doTryCatch(return(expr), name, parentenv, handler)
  where 31: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 32: tryCatchList(expr, classes, parentenv, handlers)
  where 33: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 34: test_code(NULL, exprs, env)
  where 35: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 41: FUN(X[[i]], ...)
  where 42: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 43: force(code)
  where 44: doWithOneRestart(return(expr), restart)
  where 45: withOneRestart(expr, restarts[[1L]])
  where 46: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 47: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 48: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 49: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 50: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 51: test_check("SPOT")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (x, AX, Ay, optimizeP = FALSE, useLambda = TRUE) 
  {
      nx <- nrow(AX)
      theta <- 10^x[1:nx]
      if (optimizeP) {
          AX <- abs(AX)^(x[(nx + 1):(2 * nx)])
      }
      lambda <- 0
      if (useLambda) 
          lambda <- 10^x[length(x)]
      if (any(theta == 0) || any(is.infinite(c(theta, lambda)))) {
          return(list(NegLnLike = 10000, Psi = NA, Psinv = NA, 
              mu = NA, ssq = NA))
      }
      n <- dim(Ay)[1]
      Psi <- exp(-matrix(colSums(theta * AX), n, n))
      if (useLambda) 
          Psi <- Psi + diag(lambda, n)
      if (any(is.infinite(Psi))) {
          penalty <- 10000
          return(list(NegLnLike = penalty, Psi = NA, Psinv = NA, 
              mu = NA, SSQ = NA))
      }
      kap <- rcond(Psi)
      if (is.na(kap)) 
          kap <- 0
      if (kap < 1e-10) {
          return(list(NegLnLike = 10000, Psi = NA, Psinv = NA, 
              mu = NA, SSQ = NA, a = NA, U = NA, isIndefinite = TRUE))
      }
      cholPsi <- try(chol(Psi), TRUE)
      if (class(cholPsi) == "try-error") {
          penalty <- 10000 - min(eigen(Psi, symmetric = TRUE, only.values = TRUE)$values)
          return(list(NegLnLike = penalty, Psi = NA, Psinv = NA, 
              mu = NA, SSQ = NA))
      }
      LnDetPsi <- 2 * sum(log(abs(diag(cholPsi))))
      Psinv <- try(chol2inv(cholPsi), TRUE)
      if (class(Psinv) == "try-error") {
          penalty <- 10000 - min(eigen(Psi, symmetric = TRUE, only.values = TRUE)$values)
          return(list(NegLnLike = penalty, Psi = NA, Psinv = NA, 
              mu = NA, SSQ = NA))
      }
      psisum <- sum(Psinv)
      if (psisum == 0) {
          psisum <- as.numeric(rep(1, n) %*% Psinv %*% rep(1, n))
          if (psisum == 0) {
              return(list(NegLnLike = 10000, Psi = NA, Psinv = NA, 
                  mu = NA, SSQ = NA))
          }
      }
      mu <- sum(Psinv %*% Ay)/psisum
      if (is.infinite(mu) | is.na(mu)) {
          return(list(NegLnLike = 10000, Psi = NA, Psinv = NA, 
              mu = NA, SSQ = NA))
      }
      yonemu <- Ay - mu
      SigmaSqr <- (t(yonemu) %*% Psinv %*% yonemu)/n
      if (SigmaSqr < 0) {
          return(list(NegLnLike = 10000 - SigmaSqr, Psi = NA, Psinv = NA, 
              mu = NA, SSQ = NA))
      }
      NegLnLike <- n * log(SigmaSqr) + LnDetPsi
      if (is.na(NegLnLike) | is.infinite(NegLnLike)) 
          return(list(NegLnLike = 10000, Psi = NA, Psinv = NA, 
              mu = NA, SSQ = NA))
      list(NegLnLike = NegLnLike, Psi = Psi, Psinv = Psinv, mu = mu, 
          yonemu = yonemu, ssq = SigmaSqr)
  }
  <bytecode: 0x55efe2fd2cc0>
  <environment: namespace:SPOT>
   --- function search by body ---
  Function krigingLikelihood in namespace SPOT has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1