Running ‘testthat.R’ [180s/195s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(dimRed)
  Loading required package: DRR
  Loading required package: kernlab
  Loading required package: CVST
  Loading required package: Matrix
  
  Attaching package: 'dimRed'
  
  The following object is masked from 'package:stats':
  
      embed
  
  The following object is masked from 'package:base':
  
      as.data.frame
  
  > 
  > test_check("dimRed")
  predictors:  PC1 PC2 dependent:  PC3 
  sigma=0.001 kernel=rbfdot lambda=0 nblocks=4 ( 10190.54 )
  sigma=0.01 kernel=rbfdot lambda=0 nblocks=4 ( 401.4719 )
  sigma=0.1 kernel=rbfdot lambda=0 nblocks=4 ( 64328.66 )
  sigma=1 kernel=rbfdot lambda=0 nblocks=4 ( 19926.7 )
  sigma=10 kernel=rbfdot lambda=0 nblocks=4 ( 0.3231828 )
  sigma=100 kernel=rbfdot lambda=0 nblocks=4 ( 0.3291381 )
  sigma=1000 kernel=rbfdot lambda=0 nblocks=4 ( 0.4789609 )
  sigma=10000 kernel=rbfdot lambda=0 nblocks=4 ( 0.5033222 )
  sigma=0.001 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.5153333 )
  sigma=0.01 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.520292 )
  sigma=0.1 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.5676093 )
  sigma=1 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.1569957 )
  sigma=10 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.1228571 )
  sigma=100 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.333147 )
  sigma=1000 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.4792605 )
  sigma=10000 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.5033218 )
  sigma=0.001 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.5141774 )
  sigma=0.01 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.5180153 )
  sigma=0.1 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.5320436 )
  sigma=1 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.1651657 )
  sigma=10 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.1118086 )
  sigma=100 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.3301745 )
  sigma=1000 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.4791811 )
  sigma=10000 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.5033572 )
  sigma=0.001 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.5142584 )
  sigma=0.01 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.5166389 )
  sigma=0.1 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.5240325 )
  sigma=1 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.2367567 )
  sigma=10 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.1211781 )
  sigma=100 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.3433785 )
  sigma=1000 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.481372 )
  sigma=10000 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.5036816 )
  sigma=0.001 kernel=rbfdot lambda=1 nblocks=4 ( 0.5106708 )
  sigma=0.01 kernel=rbfdot lambda=1 nblocks=4 ( 0.5130244 )
  sigma=0.1 kernel=rbfdot lambda=1 nblocks=4 ( 0.5190234 )
  sigma=1 kernel=rbfdot lambda=1 nblocks=4 ( 0.4029153 )
  sigma=10 kernel=rbfdot lambda=1 nblocks=4 ( 0.2288994 )
  sigma=100 kernel=rbfdot lambda=1 nblocks=4 ( 0.4025164 )
  sigma=1000 kernel=rbfdot lambda=1 nblocks=4 ( 0.4925192 )
  sigma=10000 kernel=rbfdot lambda=1 nblocks=4 ( 0.5053974 )
  sigma=0.001 kernel=rbfdot lambda=10 nblocks=4 ( 0.5090641 )
  sigma=0.01 kernel=rbfdot lambda=10 nblocks=4 ( 0.5105608 )
  sigma=0.1 kernel=rbfdot lambda=10 nblocks=4 ( 0.5123673 )
  sigma=1 kernel=rbfdot lambda=10 nblocks=4 ( 0.4917366 )
  sigma=10 kernel=rbfdot lambda=10 nblocks=4 ( 0.4303395 )
  sigma=100 kernel=rbfdot lambda=10 nblocks=4 ( 0.4850726 )
  sigma=1000 kernel=rbfdot lambda=10 nblocks=4 ( 0.5047589 )
  sigma=10000 kernel=rbfdot lambda=10 nblocks=4 ( 0.5072375 )
  sigma=0.001 kernel=rbfdot lambda=100 nblocks=4 ( 0.5083056 )
  sigma=0.01 kernel=rbfdot lambda=100 nblocks=4 ( 0.5084437 )
  sigma=0.1 kernel=rbfdot lambda=100 nblocks=4 ( 0.5088194 )
  sigma=1 kernel=rbfdot lambda=100 nblocks=4 ( 0.5058801 )
  sigma=10 kernel=rbfdot lambda=100 nblocks=4 ( 0.4981683 )
  sigma=100 kernel=rbfdot lambda=100 nblocks=4 ( 0.5050979 )
  sigma=1000 kernel=rbfdot lambda=100 nblocks=4 ( 0.5073445 )
  sigma=10000 kernel=rbfdot lambda=100 nblocks=4 ( 0.5076171 )
  predictors:  PC1 dependent:  PC2 
  sigma=0.001 kernel=rbfdot lambda=0 nblocks=4 ( 4675.401 )
  sigma=0.01 kernel=rbfdot lambda=0 nblocks=4 ( 47078.39 )
  sigma=0.1 kernel=rbfdot lambda=0 nblocks=4 ( 247379.8 )
  sigma=1 kernel=rbfdot lambda=0 nblocks=4 ( 379800937531 )
  sigma=10 kernel=rbfdot lambda=0 nblocks=4 ( 1.341811e+14 )
  sigma=100 kernel=rbfdot lambda=0 nblocks=4 ( 146680389389 )
  sigma=1000 kernel=rbfdot lambda=0 nblocks=4 ( 2359715 )
  sigma=10000 kernel=rbfdot lambda=0 nblocks=4 ( 12.31864 )
  sigma=0.001 kernel=rbfdot lambda=0.001 nblocks=4 ( 2.098092 )
  sigma=0.01 kernel=rbfdot lambda=0.001 nblocks=4 ( 2.098889 )
  sigma=0.1 kernel=rbfdot lambda=0.001 nblocks=4 ( 2.095771 )
  sigma=1 kernel=rbfdot lambda=0.001 nblocks=4 ( 1.86527 )
  sigma=10 kernel=rbfdot lambda=0.001 nblocks=4 ( 2.430765 )
  sigma=100 kernel=rbfdot lambda=0.001 nblocks=4 ( 4.077326 )
  sigma=1000 kernel=rbfdot lambda=0.001 nblocks=4 ( 3.262199 )
  sigma=10000 kernel=rbfdot lambda=0.001 nblocks=4 ( 2.403103 )
  sigma=0.001 kernel=rbfdot lambda=0.01 nblocks=4 ( 2.096894 )
  sigma=0.01 kernel=rbfdot lambda=0.01 nblocks=4 ( 2.09841 )
  sigma=0.1 kernel=rbfdot lambda=0.01 nblocks=4 ( 2.099919 )
  sigma=1 kernel=rbfdot lambda=0.01 nblocks=4 ( 1.847376 )
  sigma=10 kernel=rbfdot lambda=0.01 nblocks=4 ( 1.908734 )
  sigma=100 kernel=rbfdot lambda=0.01 nblocks=4 ( 2.393634 )
  sigma=1000 kernel=rbfdot lambda=0.01 nblocks=4 ( 2.262045 )
  sigma=10000 kernel=rbfdot lambda=0.01 nblocks=4 ( 2.154884 )
  sigma=0.001 kernel=rbfdot lambda=0.1 nblocks=4 ( 2.100273 )
  sigma=0.01 kernel=rbfdot lambda=0.1 nblocks=4 ( 2.098542 )
  sigma=0.1 kernel=rbfdot lambda=0.1 nblocks=4 ( 2.092292 )
  sigma=1 kernel=rbfdot lambda=0.1 nblocks=4 ( 1.840829 )
  sigma=10 kernel=rbfdot lambda=0.1 nblocks=4 ( 1.916014 )
  sigma=100 kernel=rbfdot lambda=0.1 nblocks=4 ( 2.103585 )
  sigma=1000 kernel=rbfdot lambda=0.1 nblocks=4 ( 1.917492 )
  sigma=10000 kernel=rbfdot lambda=0.1 nblocks=4 ( 2.025074 )
  sigma=0.001 kernel=rbfdot lambda=1 nblocks=4 ( 2.092192 )
  sigma=0.01 kernel=rbfdot lambda=1 nblocks=4 ( 2.097044 )
  sigma=0.1 kernel=rbfdot lambda=1 nblocks=4 ( 2.095374 )
  sigma=1 kernel=rbfdot lambda=1 nblocks=4 ( 1.897724 )
  sigma=10 kernel=rbfdot lambda=1 nblocks=4 ( 1.849346 )
  sigma=100 kernel=rbfdot lambda=1 nblocks=4 ( 1.86811 )
  sigma=1000 kernel=rbfdot lambda=1 nblocks=4 ( 1.895816 )
  sigma=10000 kernel=rbfdot lambda=1 nblocks=4 ( 2.013504 )
  sigma=0.001 kernel=rbfdot lambda=10 nblocks=4 ( 2.087669 )
  sigma=0.01 kernel=rbfdot lambda=10 nblocks=4 ( 2.090482 )
  sigma=0.1 kernel=rbfdot lambda=10 nblocks=4 ( 2.091853 )
  sigma=1 kernel=rbfdot lambda=10 nblocks=4 ( 2.021084 )
  sigma=10 kernel=rbfdot lambda=10 nblocks=4 ( 1.91539 )
  sigma=100 kernel=rbfdot lambda=10 nblocks=4 ( 1.945848 )
  sigma=1000 kernel=rbfdot lambda=10 nblocks=4 ( 2.015754 )
  sigma=10000 kernel=rbfdot lambda=10 nblocks=4 ( 2.060799 )
  sigma=0.001 kernel=rbfdot lambda=100 nblocks=4 ( 2.084328 )
  sigma=0.01 kernel=rbfdot lambda=100 nblocks=4 ( 2.08471 )
  sigma=0.1 kernel=rbfdot lambda=100 nblocks=4 ( 2.085755 )
  sigma=1 kernel=rbfdot lambda=100 nblocks=4 ( 2.072811 )
  sigma=10 kernel=rbfdot lambda=100 nblocks=4 ( 2.045763 )
  sigma=100 kernel=rbfdot lambda=100 nblocks=4 ( 2.058844 )
  sigma=1000 kernel=rbfdot lambda=100 nblocks=4 ( 2.072612 )
  sigma=10000 kernel=rbfdot lambda=100 nblocks=4 ( 2.078689 )
  trace= 0 
  predictors:  PC1 PC2 PC3 dependent:  PC4 
  sigma=0.001 kernel=rbfdot lambda=0 nblocks=4 ( 77.88972 )
  Error in solve(Matrix(K + diag(lambda, N))) : 
    Lapack routine dsytrf returned error code 17
  sigma=0.01 kernel=rbfdot lambda=0 nblocks=4 ( NA )
  sigma=0.1 kernel=rbfdot lambda=0 nblocks=4 ( 19.46038 )
  sigma=1 kernel=rbfdot lambda=0 nblocks=4 ( 0.09128517 )
  sigma=10 kernel=rbfdot lambda=0 nblocks=4 ( 0.02319341 )
  Error in .local(a, b, ...) : 
    cs_lu(A) failed: near-singular A (or out of memory)
  sigma=100 kernel=rbfdot lambda=0 nblocks=4 ( NA )
  sigma=1000 kernel=rbfdot lambda=0 nblocks=4 ( 0.02367448 )
  Error in LU.dgC(a) : cs_lu(A) failed: near-singular A (or out of memory)
  sigma=10000 kernel=rbfdot lambda=0 nblocks=4 ( NA )
  sigma=0.001 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.02744837 )
  sigma=0.01 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.02555067 )
  sigma=0.1 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.0415567 )
  sigma=1 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.04472533 )
  sigma=10 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.0239199 )
  sigma=100 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.02373176 )
  sigma=1000 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.02367448 )
  sigma=10000 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.02367483 )
  sigma=0.001 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.02535591 )
  sigma=0.01 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.02682242 )
  sigma=0.1 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.02616967 )
  sigma=1 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.02651097 )
  sigma=10 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.02407558 )
  sigma=100 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.02370263 )
  sigma=1000 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.02367453 )
  sigma=10000 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.02367484 )
  sigma=0.001 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.02450198 )
  sigma=0.01 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.02526671 )
  sigma=0.1 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.02529563 )
  sigma=1 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.02258951 )
  sigma=10 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.02349889 )
  sigma=100 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.02370924 )
  sigma=1000 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.02367465 )
  sigma=10000 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.02367493 )
  sigma=0.001 kernel=rbfdot lambda=1 nblocks=4 ( 0.0240368 )
  sigma=0.01 kernel=rbfdot lambda=1 nblocks=4 ( 0.02444953 )
  sigma=0.1 kernel=rbfdot lambda=1 nblocks=4 ( 0.02489816 )
  sigma=1 kernel=rbfdot lambda=1 nblocks=4 ( 0.02283171 )
  sigma=10 kernel=rbfdot lambda=1 nblocks=4 ( 0.02333317 )
  sigma=100 kernel=rbfdot lambda=1 nblocks=4 ( 0.0236838 )
  sigma=1000 kernel=rbfdot lambda=1 nblocks=4 ( 0.02367529 )
  sigma=10000 kernel=rbfdot lambda=1 nblocks=4 ( 0.02367546 )
  sigma=0.001 kernel=rbfdot lambda=10 nblocks=4 ( 0.02389181 )
  sigma=0.01 kernel=rbfdot lambda=10 nblocks=4 ( 0.02396487 )
  sigma=0.1 kernel=rbfdot lambda=10 nblocks=4 ( 0.02403682 )
  sigma=1 kernel=rbfdot lambda=10 nblocks=4 ( 0.02343847 )
  sigma=10 kernel=rbfdot lambda=10 nblocks=4 ( 0.02356672 )
  sigma=100 kernel=rbfdot lambda=10 nblocks=4 ( 0.02367646 )
  sigma=1000 kernel=rbfdot lambda=10 nblocks=4 ( 0.02367602 )
  sigma=10000 kernel=rbfdot lambda=10 nblocks=4 ( 0.02367605 )
  sigma=0.001 kernel=rbfdot lambda=100 nblocks=4 ( 0.02373598 )
  sigma=0.01 kernel=rbfdot lambda=100 nblocks=4 ( 0.02373904 )
  sigma=0.1 kernel=rbfdot lambda=100 nblocks=4 ( 0.02374159 )
  sigma=1 kernel=rbfdot lambda=100 nblocks=4 ( 0.02364777 )
  sigma=10 kernel=rbfdot lambda=100 nblocks=4 ( 0.02366282 )
  sigma=100 kernel=rbfdot lambda=100 nblocks=4 ( 0.0236762 )
  sigma=1000 kernel=rbfdot lambda=100 nblocks=4 ( 0.02367617 )
  sigma=10000 kernel=rbfdot lambda=100 nblocks=4 ( 0.02367618 )
  predictors:  PC1 PC2 dependent:  PC3 
  sigma=0.001 kernel=rbfdot lambda=0 nblocks=4 ( 236.0927 )
  sigma=0.01 kernel=rbfdot lambda=0 nblocks=4 ( 14411.71 )
  sigma=0.1 kernel=rbfdot lambda=0 nblocks=4 ( 7727306 )
  sigma=1 kernel=rbfdot lambda=0 nblocks=4 ( 12.94553 )
  Error in solve(Matrix(K + diag(lambda, N))) : 
    Lapack routine dsytrf returned error code 21
  sigma=10 kernel=rbfdot lambda=0 nblocks=4 ( NA )
  sigma=100 kernel=rbfdot lambda=0 nblocks=4 ( 0.0735983 )
  sigma=1000 kernel=rbfdot lambda=0 nblocks=4 ( 0.07503883 )
  Error in LU.dgC(a) : cs_lu(A) failed: near-singular A (or out of memory)
  sigma=10000 kernel=rbfdot lambda=0 nblocks=4 ( NA )
  sigma=0.001 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.08757301 )
  sigma=0.01 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.08512199 )
  sigma=0.1 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.09361091 )
  sigma=1 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.1594499 )
  sigma=10 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.07438738 )
  sigma=100 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.07389088 )
  sigma=1000 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.07504111 )
  sigma=10000 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.07548306 )
  sigma=0.001 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.08582708 )
  sigma=0.01 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.08537647 )
  sigma=0.1 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.0810363 )
  sigma=1 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.08416448 )
  sigma=10 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.08123806 )
  sigma=100 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.07391615 )
  sigma=1000 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.07506293 )
  sigma=10000 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.07550018 )
  sigma=0.001 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.08366763 )
  sigma=0.01 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.08647113 )
  sigma=0.1 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.07865068 )
  sigma=1 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.0784933 )
  sigma=10 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.07469427 )
  sigma=100 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.07391945 )
  sigma=1000 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.07524897 )
  sigma=10000 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.07565807 )
  sigma=0.001 kernel=rbfdot lambda=1 nblocks=4 ( 0.08211416 )
  sigma=0.01 kernel=rbfdot lambda=1 nblocks=4 ( 0.08487662 )
  sigma=0.1 kernel=rbfdot lambda=1 nblocks=4 ( 0.08487795 )
  sigma=1 kernel=rbfdot lambda=1 nblocks=4 ( 0.07443147 )
  sigma=10 kernel=rbfdot lambda=1 nblocks=4 ( 0.07414795 )
  sigma=100 kernel=rbfdot lambda=1 nblocks=4 ( 0.07535754 )
  sigma=1000 kernel=rbfdot lambda=1 nblocks=4 ( 0.07626643 )
  sigma=10000 kernel=rbfdot lambda=1 nblocks=4 ( 0.07651293 )
  sigma=0.001 kernel=rbfdot lambda=10 nblocks=4 ( 0.08073838 )
  sigma=0.01 kernel=rbfdot lambda=10 nblocks=4 ( 0.08119048 )
  sigma=0.1 kernel=rbfdot lambda=10 nblocks=4 ( 0.0823716 )
  sigma=1 kernel=rbfdot lambda=10 nblocks=4 ( 0.07791994 )
  sigma=10 kernel=rbfdot lambda=10 nblocks=4 ( 0.0765422 )
  sigma=100 kernel=rbfdot lambda=10 nblocks=4 ( 0.07722765 )
  sigma=1000 kernel=rbfdot lambda=10 nblocks=4 ( 0.07741497 )
  sigma=10000 kernel=rbfdot lambda=10 nblocks=4 ( 0.07746377 )
  sigma=0.001 kernel=rbfdot lambda=100 nblocks=4 ( 0.07855508 )
  sigma=0.01 kernel=rbfdot lambda=100 nblocks=4 ( 0.07857929 )
  sigma=0.1 kernel=rbfdot lambda=100 nblocks=4 ( 0.07858197 )
  sigma=1 kernel=rbfdot lambda=100 nblocks=4 ( 0.07781048 )
  sigma=10 kernel=rbfdot lambda=100 nblocks=4 ( 0.07755085 )
  sigma=100 kernel=rbfdot lambda=100 nblocks=4 ( 0.07763628 )
  sigma=1000 kernel=rbfdot lambda=100 nblocks=4 ( 0.07765804 )
  sigma=10000 kernel=rbfdot lambda=100 nblocks=4 ( 0.07766344 )
  ── 1. Error: rmse_by_ndim (@test_quality.R#30)  ────────────────────────────────
  Lapack dgecon(): system computationally singular, reciprocal condition number = 2.63523e-17
  1: embed(ir, "DRR", ndim = ndims(ir)) at testthat/test_quality.R:30
  2: embed(ir, "DRR", ndim = ndims(ir))
  3: .local(.data, ...)
  4: do.call(methodObject@fun, args)
  5: (function (data, pars, keep.org.data = TRUE) 
     {
         chckpkg("DRR")
         chckpkg("kernlab")
         meta <- data@meta
         orgdata <- if (keep.org.data) 
             data@data
         else NULL
         indata <- data@data
         res <- do.call(DRR::drr, c(list(X = indata), pars))
         outdata <- res$fitted.data
         colnames(outdata) <- paste0("DRR", 1:ncol(outdata))
         appl <- function(x) {
             appl.meta <- if (inherits(x, "dimRedData")) 
                 x@meta
             else data.frame()
             proj <- if (inherits(x, "dimRedData")) 
                 x@data
             else x
             if (ncol(proj) != ncol(data@data)) 
                 stop("x must have the same number of dimensions ", "as the original data")
             appl.out <- new("dimRedData", data = res$apply(proj), meta = appl.meta)
             dimnames(appl.out@data) <- list(rownames(x), paste0("DRR", seq_len(ncol(appl.out@data))))
             return(appl.out)
         }
         inv <- function(x) {
             appl.meta <- if (inherits(x, "dimRedData")) 
                 x@meta
             else data.frame()
             proj <- if (inherits(x, "dimRedData")) 
                 x@data
             else x
             if (ncol(proj) > ncol(data@data)) 
                 stop("x must have less or equal number of dimensions ", "as the original data")
             inv.out <- new("dimRedData", data = res$inverse(proj), meta = appl.meta)
             dimnames(inv.out@data) <- list(rownames(proj), colnames(data@data))
             return(inv.out)
         }
         return(new("dimRedResult", data = new("dimRedData", data = outdata, meta = meta), 
             org.data = orgdata, apply = appl, inverse = inv, has.org.data = keep.org.data, 
             has.apply = TRUE, has.inverse = TRUE, method = "drr", pars = pars))
     })(data = new("dimRedData", data = structure(c(5.1, 4.9, 4.7, 4.6, 5, 5.4, 4.6, 5, 
     4.4, 4.9, 5.4, 4.8, 4.8, 4.3, 5.8, 5.7, 5.4, 5.1, 5.7, 5.1, 5.4, 5.1, 4.6, 5.1, 4.8, 
     5, 5, 5.2, 5.2, 4.7, 4.8, 5.4, 5.2, 5.5, 4.9, 5, 5.5, 4.9, 4.4, 5.1, 5, 4.5, 4.4, 
     5, 5.1, 4.8, 5.1, 4.6, 5.3, 5, 7, 6.4, 6.9, 5.5, 6.5, 5.7, 6.3, 4.9, 6.6, 5.2, 5, 
     5.9, 6, 6.1, 5.6, 6.7, 5.6, 5.8, 6.2, 5.6, 5.9, 6.1, 6.3, 6.1, 6.4, 6.6, 6.8, 6.7, 
     6, 5.7, 5.5, 5.5, 5.8, 6, 5.4, 6, 6.7, 6.3, 5.6, 5.5, 5.5, 6.1, 5.8, 5, 5.6, 5.7, 
     5.7, 6.2, 5.1, 5.7, 6.3, 5.8, 7.1, 6.3, 6.5, 7.6, 4.9, 7.3, 6.7, 7.2, 6.5, 6.4, 6.8, 
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2, 1.6, 1.5, 1.6, 1.5, 1.3, 1.3, 1.3, 1.2, 1.4, 1.2, 1, 1.3, 1.2, 1.3, 1.3, 
     1.1, 1.3, 2.5, 1.9, 2.1, 1.8, 2.2, 2.1, 1.7, 1.8, 1.8, 2.5, 2, 1.9, 2.1, 2, 2.4, 
     2.3, 1.8, 2.2, 2.3, 1.5, 2.3, 2, 2, 1.8, 2.1, 1.8, 1.8, 1.8, 2.1, 1.6, 1.9, 2, 2.2, 
     1.5, 1.4, 2.3, 2.4, 1.8, 1.8, 2.1, 2.4, 2.3, 1.9, 2.3, 2.5, 2.3, 1.9, 2, 2.3, 1.8
     ), .Dim = c(150L, 4L), .Dimnames = list(NULL, c("Sepal.Length", "Sepal.Width", "Petal.Length", 
     "Petal.Width"))), meta = structure(list(Species = structure(c(1L, 1L, 1L, 1L, 1L, 
     1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
     1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
     1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
     2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
     2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
     3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
     3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("setosa", 
     "versicolor", "virginica"), class = "factor")), class = "data.frame", row.names = c(NA, 
     -150L))), keep.org.data = TRUE, pars = list(ndim = 4L, lambda = c(0, 0.001, 0.01, 
     0.1, 1, 10, 100), kernel = "rbfdot", kernel.pars = list(sigma = c(0.001, 0.01, 0.1, 
     1, 10, 100, 1000, 10000)), pca = TRUE, pca.center = TRUE, pca.scale = FALSE, fastcv = FALSE, 
         cv.folds = 5, fastcv.test = NULL, fastkrr.nblocks = 4, verbose = TRUE))
  6: do.call(DRR::drr, c(list(X = indata), pars))
  7: (function (X, ndim = ncol(X), lambda = c(0, 10^(-3:2)), kernel = "rbfdot", kernel.pars = list(sigma = 10^(-3:4)), 
         pca = TRUE, pca.center = TRUE, pca.scale = FALSE, fastcv = FALSE, cv.folds = 5, 
         fastcv.test = NULL, fastkrr.nblocks = 4, verbose = TRUE) 
     {
         if ((!fastcv) && (cv.folds <= 1)) 
             stop("need more than one fold for crossvalidation")
         if (cv.folds%%1 != 0) 
             stop("cv.folds must be an integer")
         if (fastkrr.nblocks < 1) 
             stop("fastkrr.nblocks must be > 1")
         if (fastkrr.nblocks%%1 != 0) 
             stop("fastkrr.nblocks must be an integer")
         if (!requireNamespace("CVST")) 
             stop("require the 'CVST' package")
         if (!requireNamespace("kernlab")) 
             stop("require 'kernlab' package")
         if (ndim < ncol(X)) 
             warning("ndim < data dimensionality, ", "the inverse functions will be incomplete!")
         devnull <- if (Sys.info()["sysname"] != "Windows") 
             "/dev/null"
         else "NUL"
         if (!verbose) {
             devnull1 <- file(devnull, "wt")
             sink(devnull1, type = "message")
             on.exit({
                 sink(file = NULL, type = "message")
                 close(devnull1)
             }, add = TRUE)
         }
         if (!verbose) {
             devnull2 <- file(devnull, "wt")
             sink(devnull2, type = "output")
             on.exit({
                 sink()
                 close(devnull2)
             }, add = TRUE)
         }
         if (ndim > ncol(X)) 
             ndim <- ncol(X)
         if (pca) {
             pca <- stats::prcomp(X, center = pca.center, scale. = pca.scale)
             if (!pca.center) 
                 pca$center <- rep(0, ncol(X))
             if (!pca.scale) 
                 pca$scale <- rep(1, ncol(X))
         }
         else {
             pca <- list()
             pca$x <- X
             pca$rotation <- diag(1, ncol(X), ncol(X))
             pca$center <- rep(0, ncol(X))
             pca$scale <- rep(1, ncol(X))
         }
         alpha <- pca$x
         d <- ndim
         kpars <- kernel.pars
         kpars$kernel <- kernel
         kpars$lambda <- lambda
         kpars$nblocks <- fastkrr.nblocks
         krrl <- constructFastKRRLearner()
         p <- do.call(CVST::constructParams, kpars)
         Y <- matrix(NA_real_, nrow = nrow(X), ncol = d)
         models <- list()
         if (d > 1) 
             for (i in d:2) {
                 message(Sys.time(), ": Constructing Axis ", d - i + 1, "/", d)
                 data <- CVST::constructData(x = alpha[, 1:(i - 1), drop = FALSE], y = alpha[, 
                     i])
                 cat("predictors: ", colnames(alpha)[1:(i - 1)], "dependent: ", colnames(alpha)[i], 
                     "\n")
                 res <- if (fastcv) {
                     CVST::fastCV(data, krrl, p, CVST::constructCVSTModel(), test = fastcv.test, 
                       verbose = verbose)
                 }
                 else {
                     CVST::CV(data, krrl, p, fold = cv.folds, verbose = verbose)
                 }
                 model <- krrl$learn(data, res[[1]])
                 models[[i]] <- model
                 Y[, i] <- as.matrix(alpha[, i] - krrl$predict(model, data))
             }
         message(Sys.time(), ": Constructing Axis ", d, "/", d)
         Y[, 1] <- alpha[, 1]
         models[[1]] <- list()
         appl <- function(x) {
             dat <- scale(x, pca$center, pca$scale)
             dat <- dat %*% pca$rotation
             outdat <- matrix(NA_real_, ncol = d, nrow = nrow(x))
             if (d > 1) 
                 for (i in d:2) outdat[, i] <- dat[, i] - krrl$predict(models[[i]], CVST::constructData(x = dat[, 
                     1:(i - 1), drop = FALSE], y = NA))
             outdat[, 1] <- dat[, 1]
             return(outdat)
         }
         inv <- function(x) {
             dat <- cbind(x, matrix(0, nrow(x), ncol(X) - ncol(x)))
             outdat <- dat
             if (d > 1) 
                 for (i in 2:d) outdat[, i] <- dat[, i] + krrl$predict(models[[i]], CVST::constructData(x = outdat[, 
                     1:(i - 1), drop = FALSE], y = NA))
             outdat <- outdat %*% t(pca$rotation)
             outdat <- sweep(outdat, 2L, pca$scale, "*")
             outdat <- sweep(outdat, 2L, pca$center, "+")
             return(outdat)
         }
         return(list(fitted.data = Y, pca.means = pca$center, pca.scale = pca$scale, pca.rotation = pca$rotation, 
             models = models, apply = appl, inverse = inv))
     })(X = structure(c(5.1, 4.9, 4.7, 4.6, 5, 5.4, 4.6, 5, 4.4, 4.9, 5.4, 4.8, 4.8, 4.3, 
     5.8, 5.7, 5.4, 5.1, 5.7, 5.1, 5.4, 5.1, 4.6, 5.1, 4.8, 5, 5, 5.2, 5.2, 4.7, 4.8, 
     5.4, 5.2, 5.5, 4.9, 5, 5.5, 4.9, 4.4, 5.1, 5, 4.5, 4.4, 5, 5.1, 4.8, 5.1, 4.6, 5.3, 
     5, 7, 6.4, 6.9, 5.5, 6.5, 5.7, 6.3, 4.9, 6.6, 5.2, 5, 5.9, 6, 6.1, 5.6, 6.7, 5.6, 
     5.8, 6.2, 5.6, 5.9, 6.1, 6.3, 6.1, 6.4, 6.6, 6.8, 6.7, 6, 5.7, 5.5, 5.5, 5.8, 6, 
     5.4, 6, 6.7, 6.3, 5.6, 5.5, 5.5, 6.1, 5.8, 5, 5.6, 5.7, 5.7, 6.2, 5.1, 5.7, 6.3, 
     5.8, 7.1, 6.3, 6.5, 7.6, 4.9, 7.3, 6.7, 7.2, 6.5, 6.4, 6.8, 5.7, 5.8, 6.4, 6.5, 7.7, 
     7.7, 6, 6.9, 5.6, 7.7, 6.3, 6.7, 7.2, 6.2, 6.1, 6.4, 7.2, 7.4, 7.9, 6.4, 6.3, 6.1, 
     7.7, 6.3, 6.4, 6, 6.9, 6.7, 6.9, 5.8, 6.8, 6.7, 6.7, 6.3, 6.5, 6.2, 5.9, 3.5, 3, 
     3.2, 3.1, 3.6, 3.9, 3.4, 3.4, 2.9, 3.1, 3.7, 3.4, 3, 3, 4,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4, 2.3, 2.4, 
     1.8, 1.8, 2.1, 2.4, 2.3, 1.9, 2.3, 2.5, 2.3, 1.9, 2, 2.3, 1.8), .Dim = c(150L, 4L
     ), .Dimnames = list(NULL, c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width"
     ))), ndim = 4L, lambda = c(0, 0.001, 0.01, 0.1, 1, 10, 100), kernel = "rbfdot", kernel.pars = list(
         sigma = c(0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000)), pca = TRUE, pca.center = TRUE, 
         pca.scale = FALSE, fastcv = FALSE, cv.folds = 5, fastcv.test = NULL, fastkrr.nblocks = 4, 
         verbose = TRUE)
  8: krrl$learn(data, res[[1]])
  9: krr(data$x[i_indices, ], kernel, data$y[i_indices], params$lambda)
  10: solve(Matrix(K + diag(lambda, N)))
  11: solve(Matrix(K + diag(lambda, N)))
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  OK: 108 SKIPPED: 0 FAILED: 1
  1. Error: rmse_by_ndim (@test_quality.R#30) 
  
  Error: testthat unit tests failed
  Execution halted