* using log directory ‘/home/hornik/tmp/CRAN_special_noSuggests/rlibkriging.Rcheck’ * using R Under development (unstable) (2025-07-18 r88431) * using platform: x86_64-pc-linux-gnu * R was compiled by gcc-14 (Debian 14.2.0-19) 14.2.0 GNU Fortran (Debian 14.2.0-19) 14.2.0 * running under: Debian GNU/Linux 13 (trixie) * using session charset: UTF-8 * checking for file ‘rlibkriging/DESCRIPTION’ ... OK * checking extension type ... Package * this is package ‘rlibkriging’ version ‘0.9-2’ * package encoding: UTF-8 * checking CRAN incoming feasibility ... [5s/6s] NOTE Maintainer: ‘Yann Richet ’ New submission Package was archived on CRAN Possibly misspelled words in DESCRIPTION: Ciyou (47:5) Nocedal (47:36) Sanderson (45:90) Zhu (47:11) CRAN repository db overrides: X-CRAN-Comment: Archived on 2025-06-16 as issues were not corrected in time. * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking whether package ‘rlibkriging’ can be installed ... [186s/149s] OK * used C++ compiler: ‘g++-14 (Debian 14.2.0-19) 14.2.0’ * checking C++ specification ... OK * checking package directory ... OK * checking for future file timestamps ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking code files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... [0s/0s] OK * checking whether the package can be loaded with stated dependencies ... [0s/0s] OK * checking whether the package can be unloaded cleanly ... [0s/0s] OK * checking whether the namespace can be loaded with stated dependencies ... [0s/0s] OK * checking whether the namespace can be unloaded cleanly ... [0s/0s] OK * checking loading without being on the library search path ... [0s/0s] OK * checking use of S3 registration ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... [6s/6s] OK * checking Rd files ... [1s/1s] OK * checking Rd metadata ... OK * checking Rd line widths ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking line endings in shell scripts ... OK * checking line endings in C/C++/Fortran sources/headers ... OK * checking line endings in Makefiles ... OK * checking compilation flags in Makevars ... OK * checking for GNU extensions in Makefiles ... OK * checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK * checking use of PKG_*FLAGS in Makefiles ... OK * checking use of SHLIB_OPENMP_*FLAGS in Makefiles ... OK * checking include directives in Makefiles ... OK * checking pragmas in C/C++ headers and code ... OK * checking compilation flags used ... OK * checking compiled code ... OK * checking examples ... [3s/3s] OK * checking for unstated dependencies in ‘tests’ ... OK * checking tests ... [82s/82s] ERROR Running ‘test-AllKrigingConcistency.R’ [2s/2s] Running ‘test-KrigingCopy.R’ [1s/1s] Running ‘test-KrigingFit.R’ [1s/1s] Running ‘test-KrigingLeaveOneOut.R’ [2s/2s] Running ‘test-KrigingLeaveOneOut_3d.R’ [1s/1s] Running ‘test-KrigingLogLik.R’ [2s/2s] Running ‘test-KrigingLogLikGradHess.R’ [5s/5s] Running ‘test-KrigingMethods.R’ [2s/2s] Running ‘test-KrigingPredict.R’ [8s/8s] Running ‘test-KrigingSimulate.R’ [1s/1s] Running ‘test-KrigingUpdate.R’ [1s/1s] Running ‘test-KrigingUpdateSimulate.R’ [2s/2s] Running ‘test-LinearAlgebra.R’ [1s/1s] Running ‘test-NoiseKrigingFit.R’ [1s/1s] Running ‘test-NoiseKrigingLogLik.R’ [2s/2s] Running ‘test-NoiseKrigingMethods.R’ [2s/2s] Running ‘test-NoiseKrigingPredict.R’ [6s/6s] Running ‘test-NoiseKrigingSimulate.R’ [3s/3s] Running ‘test-NoiseKrigingUpdate.R’ [1s/1s] Running ‘test-NoiseKrigingUpdateSimulate.R’ [2s/2s] Running ‘test-NuggetKrigingFit.R’ [1s/1s] Running ‘test-NuggetKrigingLogLik.R’ [3s/3s] Running ‘test-NuggetKrigingLogMargPost.R’ [5s/5s] Running ‘test-NuggetKrigingMethods.R’ [2s/2s] Running ‘test-NuggetKrigingPredict.R’ [5s/5s] Running ‘test-NuggetKrigingSimulate.R’ [1s/1s] Running ‘test-NuggetKrigingUpdate.R’ [1s/1s] Running ‘test-NuggetKrigingUpdateSimulate.R’ [2s/2s] Running ‘test-RobustGaSP-Nugget.R’ [0s/0s] Running ‘test-RobustGaSP.R’ [1s/1s] Running ‘test-RobustGaSPtrendlinear.R’ [1s/1s] Running ‘test-RobustGaSPvsKrigingLMP.R’ [1s/1s] Running ‘test-RobustGaSPvsNuggetKrigingLMP.R’ [0s/0s] Running ‘test-SaveLoad.R’ [1s/1s] Running ‘test-asDiceKriging.R’ [6s/6s] Running ‘test-estimnone.R’ [1s/1s] Running ‘test-normalize.R’ [2s/2s] Running ‘test-rlibkriging-demo.R’ [1s/1s] Running ‘test-unstableLL.R’ [1s/1s] Running the tests in ‘tests/test-KrigingFit.R’ failed. Complete output: > library(testthat) > Sys.setenv('OMP_THREAD_LIMIT'=2) > library(rlibkriging) Attaching package: 'rlibkriging' The following objects are masked from 'package:base': load, save > > context("Fit: 1D") > > f = function(x) 1-1/2*(sin(12*x)/(1+x)+2*cos(7*x)*x^5+0.7) > n <- 5 > set.seed(123) > X <- as.matrix(runif(n)) > y = f(X) > k = NULL > r = NULL > k = DiceKriging::km(design=X,response=y,covtype = "gauss",control = list(trace=F)) > r <- Kriging(y, X, "gauss") > > ll = Vectorize(function(x) logLikelihoodFun(r,x)$logLikelihood) > plot(ll,xlim=c(0.000001,10)) > for (x in seq(0.000001,10,,11)){ + envx = new.env() + ll2x = logLikelihoodFun(r,x)$logLikelihood + gll2x = logLikelihoodFun(r,x,return_grad = T)$logLikelihoodGrad + arrows(x,ll2x,x+.1,ll2x+.1*gll2x,col='red') + } > > theta_ref = optimize(ll,interval=c(0.001,2),maximum=T)$maximum > abline(v=theta_ref,col='black') > abline(v=as.list(r)$theta,col='red') > abline(v=k@covariance@range.val,col='blue') > > test_that(desc="Fit: 1D / fit of theta by DiceKriging is right", + expect_equal(theta_ref, k@covariance@range.val, tol= 1e-3)) Test passed 😸 > > test_that(desc="Fit: 1D / fit of theta by libKriging is right", + expect_equal(array(theta_ref), array(as.list(r)$theta), tol= 0.01)) Test passed 🥳 > > ############################################################# > > context("Fit: 2D (Branin)") > > f = function(X) apply(X,1,DiceKriging::branin) > n <- 15 > set.seed(1234) > X <- cbind(runif(n),runif(n)) > y = f(X) > k = NULL > r = NULL > k = DiceKriging::km(design=X,response=y,covtype = "gauss",control = list(trace=F),parinit = c(.2,.5)) > r <- Kriging(y, X, "gauss", parameters=list(theta=matrix(c(.2,.5),ncol=2))) > > ll = function(X) {if (!is.matrix(X)) X = matrix(X,ncol=2); + # print(dim(X)); + apply(X,1, + function(x) { + # print(dim(x)) + #print(matrix(unlist(x),ncol=2)); + y=-logLikelihoodFun(r,matrix(unlist(x),ncol=2))$logLikelihood + #print(y); + y})} > #DiceView::contourview(ll,xlim=c(0.01,2),ylim=c(0.01,2)) > x=seq(0.01,2,,5) > contour(x,x,matrix(ll(as.matrix(expand.grid(x,x))),nrow=length(x)),nlevels = 30) > > theta_ref = optim(par=matrix(c(.2,.5),ncol=2),ll,lower=c(0.01,0.01),upper=c(2,2),method="L-BFGS-B")$par > points(theta_ref,col='black') > points(as.list(r)$theta[1],as.list(r)$theta[2],col='red') > points(k@covariance@range.val[1],k@covariance@range.val[2],col='blue') > > test_that(desc="Fit: 2D (Branin) / fit of theta 2D is _quite_ the same that DiceKriging one", + expect_equal(ll(array(as.list(r)$theta)), ll(k@covariance@range.val), tol=1e-1)) Test passed 😸 > > > > ############################################################# > > context("Fit: 2D (Branin) multistart") > > f = function(X) apply(X,1,DiceKriging::branin) > n <- 15 > set.seed(1234) > X <- cbind(runif(n),runif(n)) > y = f(X) > k = NULL > r = NULL > > parinit = matrix(runif(10*ncol(X)),ncol=ncol(X)) > k <- tryCatch( # needed to catch warning due to %dopar% usage when using multistart + withCallingHandlers( + { + error_text <- "No error." + DiceKriging::km(design=X,response=y,covtype = "gauss",multistart = 10, parinit=parinit,control = list(trace=F)) + }, + warning = function(e) { + error_text <<- trimws(paste0("WARNING: ", e)) + invokeRestart("muffleWarning") + } + ), + error = function(e) { + return(list(value = NA, error_text = trimws(paste0("ERROR: ", e)))) + }, + finally = { + } + ) > r <- Kriging(y, X, "gauss", parameters=list(theta=parinit)) > l = as.list(r) > > # save(list=ls(),file="fit-2d-multistart.Rdata") > > ll = function(X) {if (!is.matrix(X)) X = matrix(X,ncol=2); + # print(dim(X)); + apply(X,1, + function(x) { + # print(dim(x)) + #print(matrix(unlist(x),ncol=2)); + y=-logLikelihoodFun(r,matrix(unlist(x),ncol=2))$logLikelihood + #print(y); + y})} > #DiceView::contourview(ll,xlim=c(0.01,2),ylim=c(0.01,2)) > x=seq(0.01,2,,5) > contour(x,x,matrix(ll(as.matrix(expand.grid(x,x))),nrow=length(x)),nlevels = 30) > > theta_ref = optim(par=matrix(c(.2,.5),ncol=2),ll,lower=c(0.01,0.01),upper=c(2,2),method="L-BFGS-B")$par > points(theta_ref,col='black') > points(as.list(r)$theta[1],as.list(r)$theta[2],col='red') > points(k@covariance@range.val[1],k@covariance@range.val[2],col='blue') Error in k@covariance : no applicable method for `@` applied to an object of class "list" Calls: points Execution halted Running the tests in ‘tests/test-NoiseKrigingFit.R’ failed. Complete output: > library(testthat) > Sys.setenv('OMP_THREAD_LIMIT'=2) > library(rlibkriging) Attaching package: 'rlibkriging' The following objects are masked from 'package:base': load, save > > ##library(rlibkriging, lib.loc="bindings/R/Rlibs") > ##library(testthat) > > context("Fit: 1D") > > f = function(x) 1-1/2*(sin(12*x)/(1+x)+2*cos(7*x)*x^5+0.7) > n <- 5 > set.seed(123) > X <- as.matrix(runif(n)) > y = f(X) + 0.1*rnorm(nrow(X)) > k = NULL > r = NULL > k = DiceKriging::km(design=X,response=y,noise.var=rep(0.1^2,nrow(X)),covtype = "gauss",control = list(trace=F),nugget.estim=F,optim.method='BFGS',multistart = 20) Error in f(model, envir = envir.logLik) : Package "foreach" not found Calls: -> f Execution halted Running the tests in ‘tests/test-NuggetKrigingFit.R’ failed. Complete output: > library(testthat) > Sys.setenv('OMP_THREAD_LIMIT'=2) > library(rlibkriging) Attaching package: 'rlibkriging' The following objects are masked from 'package:base': load, save > > ##library(rlibkriging, lib.loc="bindings/R/Rlibs") > ##library(testthat) > > context("Fit: 1D") > > f = function(x) 1-1/2*(sin(12*x)/(1+x)+2*cos(7*x)*x^5+0.7) > n <- 5 > set.seed(123) > X <- as.matrix(runif(n)) > y = f(X) > k = NULL > r = NULL > k = DiceKriging::km(design=X,response=y,covtype = "gauss",control = list(trace=F),nugget.estim=T,optim.method='BFGS',multistart = 20) Error in f(model, envir = envir.logLik) : Package "foreach" not found Calls: -> f Execution halted Running the tests in ‘tests/test-RobustGaSP-Nugget.R’ failed. Complete output: > library(testthat) > Sys.setenv('OMP_THREAD_LIMIT'=2) > library(rlibkriging) Attaching package: 'rlibkriging' The following objects are masked from 'package:base': load, save > > ##library(rlibkriging, lib.loc="bindings/R/Rlibs") > ##library(testthat) > > if(!requireNamespace('RobustGaSP', quietly = TRUE)) { + skip('RobustGaSP not available') + } Error: Reason: RobustGaSP not available Execution halted Running the tests in ‘tests/test-RobustGaSP.R’ failed. Complete output: > library(testthat) > Sys.setenv('OMP_THREAD_LIMIT'=2) > library(rlibkriging) Attaching package: 'rlibkriging' The following objects are masked from 'package:base': load, save > > ##library(rlibkriging, lib.loc="bindings/R/Rlibs") > ##library(testthat) > > if(!requireNamespace('RobustGaSP', quietly = TRUE)) { + skip('RobustGaSP not available') + } Error: Reason: RobustGaSP not available Execution halted Running the tests in ‘tests/test-RobustGaSPtrendlinear.R’ failed. Complete output: > library(testthat) > Sys.setenv('OMP_THREAD_LIMIT'=2) > library(rlibkriging) Attaching package: 'rlibkriging' The following objects are masked from 'package:base': load, save > > ##library(testthat) > Sys.setenv('OMP_THREAD_LIMIT'=2) > #library(rlibkriging) > > if(!requireNamespace('RobustGaSP', quietly = TRUE)) { + skip('RobustGaSP not available') + } Error: Reason: RobustGaSP not available Execution halted Running the tests in ‘tests/test-RobustGaSPvsKrigingLMP.R’ failed. Complete output: > library(testthat) > Sys.setenv('OMP_THREAD_LIMIT'=2) > library(rlibkriging) Attaching package: 'rlibkriging' The following objects are masked from 'package:base': load, save > > kernel_type = function(kernel) { + if (kernel=="matern3_2") return("matern_3_2") + if (kernel=="matern5_2") return("matern_5_2") + stop(paste0("Cannot use ",kernel)) + } > kernel_type_num = function(kernel) { + if (kernel=="matern3_2") return(2) + if (kernel=="matern5_2") return(3) + stop(paste0("Cannot use ",kernel)) + } > > for (kernel in c("matern5_2","matern3_2")) { + context(paste0("Check Marginal Posterior for kernel ",kernel)) + + f = function(x) 1-1/2*(sin(12*x)/(1+x)+2*cos(7*x)*x^5+0.7) + plot(f) + n <- 5 + set.seed(123) + X <- as.matrix(runif(n)) + y = f(X) + points(X,y) + + k = RobustGaSP::rgasp(design=X,response=y,kernel_type=kernel_type(kernel)) + + lmp = function(theta) { + #cat("theta: ",theta,"\n") + lml = RobustGaSP::log_marginal_lik(param=log(1/theta),nugget=k@nugget,nugget_est=k@nugget.est, + R0=k@R0,X=k@X,zero_mean=k@zero_mean,output=k@output,kernel_type=kernel_type_num(kernel),alpha=k@alpha) + #cat(" lml: ",lml,"\n") + larp = RobustGaSP::log_approx_ref_prior(param=log(1/theta),nugget=k@nugget,nugget_est=k@nugget.est, + CL=k@CL,a=0.2,b=1/(length(y))^{1/dim(as.matrix(X))[2]}*(0.2+dim(as.matrix(X))[2])) + #cat(" larp: ",larp,"\n") + return(lml+larp) + } + + plot(Vectorize(lmp),ylab="LMP",xlab="theta",xlim=c(0.01,2),ylim=c(-5,5)) + abline(v=1/k@beta_hat) + + lmp_deriv = function(theta) { + #cat("theta: ",theta,"\n") + lml_d = RobustGaSP::log_marginal_lik_deriv(param=log(1/theta),nugget=k@nugget,nugget_est=k@nugget.est, + R0=k@R0,X=k@X,zero_mean=k@zero_mean,output=k@output,kernel_type=kernel_type_num(kernel),alpha=k@alpha) + #cat(" lml_d: ",lml_d,"\n") + larp_d = RobustGaSP::log_approx_ref_prior_deriv(param=log(1/theta),nugget=k@nugget,nugget_est=k@nugget.est, + CL=k@CL,a=0.2,b=1/(length(y))^{1/dim(as.matrix(X))[2]}*(0.2+dim(as.matrix(X))[2])) + #cat(" larp_d: ",larp_d,"\n") + return((lml_d + larp_d)* 1/theta * (-1/theta)) + } + + for (x in seq(0.01,2,,11)){ + arrows(x,lmp(x),x+.1,lmp(x)+.1*lmp_deriv(x)) + } + + #library(rlibkriging) + r <- Kriging(y, X, kernel, objective="LMP") + ## Should be equal: + #lmp(1.0); lmp_deriv(1.0); + #logMargPostFun(r,1.0,return_grad = T) + #lmp(0.1); lmp_deriv(0.1); + #logMargPostFun(r,0.1,return_grad = T) + #ll2 = function(theta) logMargPostFun(r,theta)$logMargPost + # plot(Vectorize(ll2),col='red',add=T,xlim=c(0.01,2)) # FIXME fails with "error: chol(): decomposition failed" + for (x in seq(0.01,2,,11)){ + ll2x = logMargPostFun(r,x)$logMargPost + gll2x = logMargPostFun(r,x,return_grad = T)$logMargPostGrad + arrows(x,ll2x,x+.1,ll2x+.1*gll2x,col='red') + } + + precision <- 1e-8 # the following tests should work with it, since the computations are analytical + x=.5 + test_that(desc="logMargPost is the same that RobustGaSP one", + expect_equal(logMargPostFun(r,x)$logMargPost[1],lmp(x),tolerance = precision)) + + test_that(desc="logMargPost Grad is the same that RobustGaSP one", + expect_equal(logMargPostFun(r,x,return_grad = T)$logMargPostGrad[1],lmp_deriv(x),tolerance= precision)) + } Error in loadNamespace(x) : there is no package called 'RobustGaSP' Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart Execution halted Running the tests in ‘tests/test-RobustGaSPvsNuggetKrigingLMP.R’ failed. Complete output: > library(testthat) > Sys.setenv('OMP_THREAD_LIMIT'=2) > library(rlibkriging) Attaching package: 'rlibkriging' The following objects are masked from 'package:base': load, save > > if(!requireNamespace('RobustGaSP', quietly = TRUE)) { + skip('RobustGaSP not available') + } Error: Reason: RobustGaSP not available Execution halted * checking PDF version of manual ... [4s/4s] OK * checking HTML version of manual ... [2s/2s] OK * checking for non-standard things in the check directory ... OK * checking for detritus in the temp directory ... OK * DONE Status: 1 ERROR, 1 NOTE