* using log directory ‘/home/hornik/tmp/R.check/r-patched-gcc/Work/PKGS/kergp.Rcheck’ * using R version 4.4.1 Patched (2024-08-05 r86980) * using platform: x86_64-pc-linux-gnu * R was compiled by gcc-14 (Debian 14.2.0-1) 14.2.0 GNU Fortran (Debian 14.2.0-1) 14.2.0 * running under: Debian GNU/Linux trixie/sid * using session charset: UTF-8 * checking for file ‘kergp/DESCRIPTION’ ... OK * checking extension type ... Package * this is package ‘kergp’ version ‘0.5.7’ * 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 serialization versions ... OK * checking whether package ‘kergp’ can be installed ... OK See 'https://www.r-project.org/nosvn/R.check/r-patched-linux-x86_64/kergp-00install.html' for details. * used C compiler: ‘gcc-14 (Debian 14.2.0-1) 14.2.0’ * 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 ... [1s/2s] OK * checking whether the package can be loaded with stated dependencies ... [1s/2s] OK * checking whether the package can be unloaded cleanly ... [1s/1s] OK * checking whether the namespace can be loaded with stated dependencies ... [1s/1s] OK * checking whether the namespace can be unloaded cleanly ... [1s/2s] OK * checking loading without being on the library search path ... [1s/2s] 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 ... [21s/29s] OK * checking Rd files ... [1s/2s] 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 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 pragmas in C/C++ headers and code ... OK * checking compilation flags used ... OK * checking compiled code ... OK * checking sizes of PDF files under ‘inst/doc’ ... OK * checking installed files from ‘inst/doc’ ... OK * checking examples ... [9s/13s] ERROR Running examples in ‘kergp-Ex.R’ failed The error most likely occurred in: > base::assign(".ptime", proc.time(), pos = "CheckExEnv") > ### Name: gp > ### Title: Gaussian Process Model > ### Aliases: gp > > ### ** Examples > > ## ================================================================== > ## Example 1. Data sampled from a GP model with a known covTS object > ## ================================================================== > set.seed(1234) > myCov <- covTS(inputs = c("Temp", "Humid"), + kernel = "k1Matern5_2", + dep = c(range = "input"), + value = c(range = 0.4)) > ## change coefficients (variances) > coef(myCov) <- c(0.5, 0.8, 2, 16) > d <- myCov@d; n <- 20 > ## design matrix > X <- matrix(runif(n*d), nrow = n, ncol = d) > colnames(X) <- inputNames(myCov) > ## generate the GP realization > myGp <- gp(formula = y ~ 1, data = data.frame(y = rep(0, n), X), + cov = myCov, estim = FALSE, + beta = 10, varNoise = 0.05) > y <- simulate(myGp, cond = FALSE)$sim Loading required package: MASS > > ## parIni: add noise to true parameters > parCovIni <- coef(myCov) > parCovIni[] <- 0.9 * parCovIni[] + 0.1 * runif(length(parCovIni)) > coefLower(myCov) <- rep(1e-2, 4) > coefUpper(myCov) <- c(5, 5, 20, 20) > est <- gp(y ~ 1, data = data.frame(y = y, X), + cov = myCov, + noise = TRUE, + varNoiseLower = 1e-2, + varNoiseIni = 1.0, + parCovIni = parCovIni) Warning in nloptr.add.default.options(opts.user = opts, x0 = x0, num_constraints_ineq = num_constraints_ineq, : No termination criterion specified, using default(relative x-tolerance = 1e-04) > summary(est) Call: gp(formula = y ~ 1, data = data.frame(y = y, X), cov = myCov, noise = TRUE, varNoiseLower = 0.01, varNoiseIni = 1, parCovIni = parCovIni) Number of observations: 20 Trend coef.: Value (Intercept) 6.468396 Covariance whith class "covTS" Tensor sum covariance kernel o Dimension 'd' (nb of inputs): 2 o Kernel (1D): "Matern nu = 5/2" with parameters: "range" o One parameter by input: range: YES o Number of parameters: 4 o Param. values: Temp Humid range 0.8562201 1.356954 var 2.2592352 15.459578 Noise variance: 0.041 > coef(est) (Intercept) range.Temp range.Humid var.Temp var.Humid varNoise 6.46839553 0.85622010 1.35695422 2.25923522 15.45957780 0.04114952 > > ## ======================================================================= > ## Example 2. Predicting an additive function with an additive GP model > ## ======================================================================= > > ## Not run: > ##D > ##D addfun6d <- function(x){ > ##D res <- x[1]^3 + cos(pi * x[2]) + abs(x[3]) * sin(x[3]^2) + > ##D 3 * x[4]^3 + 3 * cos(pi * x[5]) + 3 * abs(x[6]) * sin(x[6]^2) > ##D } > ##D > ##D ## 'Fit' is for the learning set, 'Val' for the validation set > ##D set.seed(123) > ##D nFit <- 50 > ##D nVal <- 200 > ##D d <- 6 > ##D inputs <- paste("x", 1L:d, sep = "") > ##D > ##D ## create design matrices with DiceDesign package > ##D require(DiceDesign) > ##D require(DiceKriging) > ##D set.seed(0) > ##D dataFitIni <- DiceDesign::lhsDesign(nFit, d)$design > ##D dataValIni <- DiceDesign::lhsDesign(nVal, d)$design > ##D dataFit <- DiceDesign::maximinSA_LHS(dataFitIni)$design > ##D dataVal <- DiceDesign::maximinSA_LHS(dataValIni)$design > ##D > ##D colnames(dataFit) <- colnames(dataVal) <- inputs > ##D testfun <- addfun6d > ##D dataFit <- data.frame(dataFit, y = apply(dataFit, 1, testfun)) > ##D dataVal <- data.frame(dataVal, y = apply(dataVal, 1, testfun)) > ##D > ##D ## Creation of "CovTS" object with one range by input > ##D myCov <- covTS(inputs = inputs, d = d, kernel = "k1Matern3_2", > ##D dep = c(range = "input")) > ##D > ##D ## Creation of a gp object > ##D fitgp <- gp(formula = y ~ 1, data = dataFit, > ##D cov = myCov, noise = TRUE, > ##D parCovIni = rep(1, 2*d), > ##D parCovLower = c(rep(1e-4, 2*d)), > ##D parCovUpper = c(rep(5, d), rep(10,d))) > ##D > ##D predTS <- predict(fitgp, newdata = as.matrix(dataVal[ , inputs]), type = "UK")$mean > ##D > ##D ## Classical tensor product kernel as a reference for comparison > ##D fitRef <- DiceKriging::km(formula = ~1, > ##D design = dataFit[ , inputs], > ##D response = dataFit$y, covtype="matern3_2") > ##D predRef <- predict(fitRef, > ##D newdata = as.matrix(dataVal[ , inputs]), > ##D type = "UK")$mean > ##D ## Compare TS and Ref > ##D RMSE <- data.frame(TS = sqrt(mean((dataVal$y - predTS)^2)), > ##D Ref = sqrt(mean((dataVal$y - predRef)^2)), > ##D row.names = "RMSE") > ##D print(RMSE) > ##D > ##D Comp <- data.frame(y = dataVal$y, predTS, predRef) > ##D plot(predRef ~ y, data = Comp, col = "black", pch = 4, > ##D xlab = "True", ylab = "Predicted", > ##D main = paste("Prediction on a validation set (nFit = ", > ##D nFit, ", nVal = ", nVal, ").", sep = "")) > ##D points(predTS ~ y, data = Comp, col = "red", pch = 20) > ##D abline(a = 0, b = 1, col = "blue", lty = "dotted") > ##D legend("bottomright", pch = c(4, 20), col = c("black", "red"), > ##D legend = c("Ref", "Tensor Sum")) > ## End(Not run) > > ##======================================================================= > ## Example 3: a 'covMan' kernel with 3 implementations > ##======================================================================= > > d <- 4 > > ## -- Define a 4-dimensional covariance structure with a kernel in R > > myGaussFunR <- function(x1, x2, par) { + h <- (x1 - x2) / par[1] + SS2 <- sum(h^2) + d2 <- exp(-SS2) + kern <- par[2] * d2 + d1 <- 2 * kern * SS2 / par[1] + attr(kern, "gradient") <- c(theta = d1, sigma2 = d2) + return(kern) + } > > myGaussR <- covMan(kernel = myGaussFunR, + hasGrad = TRUE, + d = d, + parLower = c(theta = 0.0, sigma2 = 0.0), + parUpper = c(theta = Inf, sigma2 = Inf), + parNames = c("theta", "sigma2"), + label = "Gaussian kernel: R implementation") > > ## -- The same, still in R, but with a kernel admitting matrices as arguments > > myGaussFunRVec <- function(x1, x2, par) { + # x1, x2 : matrices with same number of columns 'd' (dimension) + n <- nrow(x1) + d <- ncol(x1) + SS2 <- 0 + for (j in 1:d){ + Aj <- outer(x1[ , j], x2[ , j], "-") + Hj2 <- (Aj / par[1])^2 + SS2 <- SS2 + Hj2 + } + D2 <- exp(-SS2) + kern <- par[2] * D2 + D1 <- 2 * kern * SS2 / par[1] + attr(kern, "gradient") <- list(theta = D1, sigma2 = D2) + + return(kern) + } > > myGaussRVec <- covMan( + kernel = myGaussFunRVec, + hasGrad = TRUE, + acceptMatrix = TRUE, + d = d, + parLower = c(theta = 0.0, sigma2 = 0.0), + parUpper = c(theta = Inf, sigma2 = Inf), + parNames = c("theta", "sigma2"), + label = "Gaussian kernel: vectorised R implementation" + ) > > ## -- The same, with inlined C code > ## (see also another example with Rcpp by typing: ?kergp). > > if (require(inline)) { + + kernCode <- " + SEXP kern, dkern; + int nprotect = 0, d; + double SS2 = 0.0, d2, z, *rkern, *rdkern; + + d = LENGTH(x1); + PROTECT(kern = allocVector(REALSXP, 1)); nprotect++; + PROTECT(dkern = allocVector(REALSXP, 2)); nprotect++; + rkern = REAL(kern); + rdkern = REAL(dkern); + + for (int i = 0; i < d; i++) { + z = ( REAL(x1)[i] - REAL(x2)[i] ) / REAL(par)[0]; + SS2 += z * z; + } + + d2 = exp(-SS2); + rkern[0] = REAL(par)[1] * d2; + rdkern[1] = d2; + rdkern[0] = 2 * rkern[0] * SS2 / REAL(par)[0]; + + SET_ATTR(kern, install(\"gradient\"), dkern); + UNPROTECT(nprotect); + return kern; + " + myGaussFunC <- cfunction(sig = signature(x1 = "numeric", x2 = "numeric", + par = "numeric"), + body = kernCode) + + myGaussC <- covMan(kernel = myGaussFunC, + hasGrad = TRUE, + d = d, + parLower = c(theta = 0.0, sigma2 = 0.0), + parUpper = c(theta = Inf, sigma2 = Inf), + parNames = c("theta", "sigma2"), + label = "Gaussian kernel: C/inline implementation") + + } Loading required package: inline Attaching package: ‘inline’ The following object is masked from ‘package:Rcpp’: registerPlugin ERROR(s) during compilation: source code errors or compiler configuration errors! make cmd is make -f '/home/hornik/tmp/R.check/r-patched-gcc/Work/build/etc/Makeconf' -f '/home/hornik/tmp/R.check/r-patched-gcc/Work/build/share/make/shlib.mk' -f '/home/hornik/.R/Makevars-gcc' SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB='file16d6045a41a070.so' CXX_DEFS=-DR_NO_REMAP OBJECTS='file16d6045a41a070.o' make would use make[1]: Entering directory '/home/hornik/tmp/scratch/RtmpnuoQ8h' g++-14 -std=gnu++17 -I"/home/hornik/tmp/R.check/r-patched-gcc/Work/build/include" -DNDEBUG -I/usr/local/include -D_FORTIFY_SOURCE=3 -fpic -g -O2 -Wall -pedantic -mtune=native -DR_NO_REMAP -c file16d6045a41a070.cpp -o file16d6045a41a070.o if test "zfile16d6045a41a070.o" != "z"; then \ echo g++-14 -std=gnu++17 -shared -L"/home/hornik/tmp/R.check/r-patched-gcc/Work/build/lib" -Wl,-O1 -o file16d6045a41a070.so file16d6045a41a070.o -L"/home/hornik/tmp/R.check/r-patched-gcc/Work/build/lib" -lR; \ g++-14 -std=gnu++17 -shared -L"/home/hornik/tmp/R.check/r-patched-gcc/Work/build/lib" -Wl,-O1 -o file16d6045a41a070.so file16d6045a41a070.o -L"/home/hornik/tmp/R.check/r-patched-gcc/Work/build/lib" -lR; \ fi make[1]: Leaving directory '/home/hornik/tmp/scratch/RtmpnuoQ8h' Program source: 1: #include 2: #include 3: #include 4: 5: 6: extern "C" { 7: SEXP file16d6045a41a070 ( SEXP x1, SEXP x2, SEXP par ); 8: } 9: 10: SEXP file16d6045a41a070 ( SEXP x1, SEXP x2, SEXP par ) { 11: 12: SEXP kern, dkern; 13: int nprotect = 0, d; 14: double SS2 = 0.0, d2, z, *rkern, *rdkern; 15: 16: d = LENGTH(x1); 17: PROTECT(kern = allocVector(REALSXP, 1)); nprotect++; 18: PROTECT(dkern = allocVector(REALSXP, 2)); nprotect++; 19: rkern = REAL(kern); 20: rdkern = REAL(dkern); 21: 22: for (int i = 0; i < d; i++) { 23: z = ( REAL(x1)[i] - REAL(x2)[i] ) / REAL(par)[0]; 24: SS2 += z * z; 25: } 26: 27: d2 = exp(-SS2); 28: rkern[0] = REAL(par)[1] * d2; 29: rdkern[1] = d2; 30: rdkern[0] = 2 * rkern[0] * SS2 / REAL(par)[0]; 31: 32: SET_ATTR(kern, install("gradient"), dkern); 33: UNPROTECT(nprotect); 34: return kern; 35: 36: warning("your C program does not return anything!"); 37: return R_NilValue; 38: } Compilation ERROR, function(s)/method(s) not created! Error in compileCode(f, code, language, verbose) : | ^~~~file16d6045a41a070.cpp:36:3: error: ‘warning’ was not declared in this scope; did you mean ‘Rf_warning’? 36 | warning("your C program does not return anything!"); | ^~~~~~~ | Rf_warningmake[1]: *** [/home/hornik/tmp/R.check/r-patched-gcc/Work/build/etc/Makeconf:202: file16d6045a41a070.o] Error 1 Calls: cfunction -> compileCode Execution halted * checking PDF version of manual ... [9s/14s] OK * checking HTML version of manual ... [6s/10s] OK * checking for non-standard things in the check directory ... OK * DONE Status: 1 ERROR