Running ‘testthat.R’ [115s/115s]
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 ( 160.322 )
  sigma=0.01 kernel=rbfdot lambda=0 nblocks=4 ( 11412.86 )
  sigma=0.1 kernel=rbfdot lambda=0 nblocks=4 ( 11328265 )
  sigma=1 kernel=rbfdot lambda=0 nblocks=4 ( 56124.79 )
  sigma=10 kernel=rbfdot lambda=0 nblocks=4 ( 1.140255 )
  sigma=100 kernel=rbfdot lambda=0 nblocks=4 ( 0.3273952 )
  sigma=1000 kernel=rbfdot lambda=0 nblocks=4 ( 0.4810798 )
  sigma=10000 kernel=rbfdot lambda=0 nblocks=4 ( 0.5095721 )
  sigma=0.001 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.5278205 )
  sigma=0.01 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.5345303 )
  sigma=0.1 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.5690366 )
  sigma=1 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.1704106 )
  sigma=10 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.1316284 )
  sigma=100 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.3275004 )
  sigma=1000 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.4809745 )
  sigma=10000 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.5095755 )
  sigma=0.001 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.5232168 )
  sigma=0.01 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.5326302 )
  sigma=0.1 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.5472105 )
  sigma=1 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.1758508 )
  sigma=10 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.119448 )
  sigma=100 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.3284704 )
  sigma=1000 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.4809394 )
  sigma=10000 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.5096064 )
  sigma=0.001 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.5218654 )
  sigma=0.01 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.5277002 )
  sigma=0.1 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.5349877 )
  sigma=1 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.2577536 )
  sigma=10 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.1336653 )
  sigma=100 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.3377181 )
  sigma=1000 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.4835951 )
  sigma=10000 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.5098887 )
  sigma=0.001 kernel=rbfdot lambda=1 nblocks=4 ( 0.5169996 )
  sigma=0.01 kernel=rbfdot lambda=1 nblocks=4 ( 0.5219457 )
  sigma=0.1 kernel=rbfdot lambda=1 nblocks=4 ( 0.5323419 )
  sigma=1 kernel=rbfdot lambda=1 nblocks=4 ( 0.4157463 )
  sigma=10 kernel=rbfdot lambda=1 nblocks=4 ( 0.2429731 )
  sigma=100 kernel=rbfdot lambda=1 nblocks=4 ( 0.4016357 )
  sigma=1000 kernel=rbfdot lambda=1 nblocks=4 ( 0.4961969 )
  sigma=10000 kernel=rbfdot lambda=1 nblocks=4 ( 0.5113701 )
  sigma=0.001 kernel=rbfdot lambda=10 nblocks=4 ( 0.5148171 )
  sigma=0.01 kernel=rbfdot lambda=10 nblocks=4 ( 0.5165662 )
  sigma=0.1 kernel=rbfdot lambda=10 nblocks=4 ( 0.5226703 )
  sigma=1 kernel=rbfdot lambda=10 nblocks=4 ( 0.5024327 )
  sigma=10 kernel=rbfdot lambda=10 nblocks=4 ( 0.4397586 )
  sigma=100 kernel=rbfdot lambda=10 nblocks=4 ( 0.4896633 )
  sigma=1000 kernel=rbfdot lambda=10 nblocks=4 ( 0.510046 )
  sigma=10000 kernel=rbfdot lambda=10 nblocks=4 ( 0.5129445 )
  sigma=0.001 kernel=rbfdot lambda=100 nblocks=4 ( 0.5139841 )
  sigma=0.01 kernel=rbfdot lambda=100 nblocks=4 ( 0.5142253 )
  sigma=0.1 kernel=rbfdot lambda=100 nblocks=4 ( 0.5152415 )
  sigma=1 kernel=rbfdot lambda=100 nblocks=4 ( 0.5124379 )
  sigma=10 kernel=rbfdot lambda=100 nblocks=4 ( 0.5043424 )
  sigma=100 kernel=rbfdot lambda=100 nblocks=4 ( 0.5106295 )
  sigma=1000 kernel=rbfdot lambda=100 nblocks=4 ( 0.5129488 )
  sigma=10000 kernel=rbfdot lambda=100 nblocks=4 ( 0.5132673 )
  predictors:  PC1 dependent:  PC2 
  sigma=0.001 kernel=rbfdot lambda=0 nblocks=4 ( 2950.651 )
  sigma=0.01 kernel=rbfdot lambda=0 nblocks=4 ( 4016.87 )
  sigma=0.1 kernel=rbfdot lambda=0 nblocks=4 ( 7139532 )
  sigma=1 kernel=rbfdot lambda=0 nblocks=4 ( 35074456992 )
  sigma=10 kernel=rbfdot lambda=0 nblocks=4 ( 58759975945 )
  Error in solve(Matrix(K + diag(lambda, N))) : 
    Lapack dgecon(): system computationally singular, reciprocal condition number = 1.03354e-16
  Error in solve(Matrix(K + diag(lambda, N))) : 
    Lapack dgecon(): system computationally singular, reciprocal condition number = 8.20444e-17
  Error in solve(Matrix(K + diag(lambda, N))) : 
    Lapack dgecon(): system computationally singular, reciprocal condition number = 7.12504e-17
  sigma=100 kernel=rbfdot lambda=0 nblocks=4 ( NA )
  sigma=1000 kernel=rbfdot lambda=0 nblocks=4 ( 211833.7 )
  sigma=10000 kernel=rbfdot lambda=0 nblocks=4 ( 40.06042 )
  sigma=0.001 kernel=rbfdot lambda=0.001 nblocks=4 ( 2.096955 )
  sigma=0.01 kernel=rbfdot lambda=0.001 nblocks=4 ( 2.107747 )
  sigma=0.1 kernel=rbfdot lambda=0.001 nblocks=4 ( 2.122668 )
  sigma=1 kernel=rbfdot lambda=0.001 nblocks=4 ( 2.210111 )
  sigma=10 kernel=rbfdot lambda=0.001 nblocks=4 ( 2.449336 )
  sigma=100 kernel=rbfdot lambda=0.001 nblocks=4 ( 4.95131 )
  sigma=1000 kernel=rbfdot lambda=0.001 nblocks=4 ( 4.667196 )
  sigma=10000 kernel=rbfdot lambda=0.001 nblocks=4 ( 2.441467 )
  sigma=0.001 kernel=rbfdot lambda=0.01 nblocks=4 ( 2.09589 )
  sigma=0.01 kernel=rbfdot lambda=0.01 nblocks=4 ( 2.101765 )
  sigma=0.1 kernel=rbfdot lambda=0.01 nblocks=4 ( 2.118858 )
  sigma=1 kernel=rbfdot lambda=0.01 nblocks=4 ( 2.212583 )
  sigma=10 kernel=rbfdot lambda=0.01 nblocks=4 ( 2.216107 )
  sigma=100 kernel=rbfdot lambda=0.01 nblocks=4 ( 2.682247 )
  sigma=1000 kernel=rbfdot lambda=0.01 nblocks=4 ( 2.691329 )
  sigma=10000 kernel=rbfdot lambda=0.01 nblocks=4 ( 2.108753 )
  sigma=0.001 kernel=rbfdot lambda=0.1 nblocks=4 ( 2.095075 )
  sigma=0.01 kernel=rbfdot lambda=0.1 nblocks=4 ( 2.096948 )
  sigma=0.1 kernel=rbfdot lambda=0.1 nblocks=4 ( 2.117414 )
  sigma=1 kernel=rbfdot lambda=0.1 nblocks=4 ( 2.159785 )
  sigma=10 kernel=rbfdot lambda=0.1 nblocks=4 ( 2.271605 )
  sigma=100 kernel=rbfdot lambda=0.1 nblocks=4 ( 2.293941 )
  sigma=1000 kernel=rbfdot lambda=0.1 nblocks=4 ( 2.167158 )
  sigma=10000 kernel=rbfdot lambda=0.1 nblocks=4 ( 2.077502 )
  sigma=0.001 kernel=rbfdot lambda=1 nblocks=4 ( 2.093003 )
  sigma=0.01 kernel=rbfdot lambda=1 nblocks=4 ( 2.093121 )
  sigma=0.1 kernel=rbfdot lambda=1 nblocks=4 ( 2.107613 )
  sigma=1 kernel=rbfdot lambda=1 nblocks=4 ( 2.144303 )
  sigma=10 kernel=rbfdot lambda=1 nblocks=4 ( 2.198198 )
  sigma=100 kernel=rbfdot lambda=1 nblocks=4 ( 2.159379 )
  sigma=1000 kernel=rbfdot lambda=1 nblocks=4 ( 2.078397 )
  sigma=10000 kernel=rbfdot lambda=1 nblocks=4 ( 2.047548 )
  sigma=0.001 kernel=rbfdot lambda=10 nblocks=4 ( 2.091212 )
  sigma=0.01 kernel=rbfdot lambda=10 nblocks=4 ( 2.091716 )
  sigma=0.1 kernel=rbfdot lambda=10 nblocks=4 ( 2.097795 )
  sigma=1 kernel=rbfdot lambda=10 nblocks=4 ( 2.111959 )
  sigma=10 kernel=rbfdot lambda=10 nblocks=4 ( 2.11847 )
  sigma=100 kernel=rbfdot lambda=10 nblocks=4 ( 2.092306 )
  sigma=1000 kernel=rbfdot lambda=10 nblocks=4 ( 2.066418 )
  sigma=10000 kernel=rbfdot lambda=10 nblocks=4 ( 2.06493 )
  sigma=0.001 kernel=rbfdot lambda=100 nblocks=4 ( 2.085669 )
  sigma=0.01 kernel=rbfdot lambda=100 nblocks=4 ( 2.085634 )
  sigma=0.1 kernel=rbfdot lambda=100 nblocks=4 ( 2.08582 )
  sigma=1 kernel=rbfdot lambda=100 nblocks=4 ( 2.087565 )
  sigma=10 kernel=rbfdot lambda=100 nblocks=4 ( 2.086425 )
  sigma=100 kernel=rbfdot lambda=100 nblocks=4 ( 2.080553 )
  sigma=1000 kernel=rbfdot lambda=100 nblocks=4 ( 2.077704 )
  sigma=10000 kernel=rbfdot lambda=100 nblocks=4 ( 2.077758 )
  predictors:  PC1 PC2 PC3 dependent:  PC4 
  sigma=0.001 kernel=rbfdot lambda=0 nblocks=4 ( 152.7554 )
  Error in solve(Matrix(K + diag(lambda, N))) : 
    Lapack routine dsytrf returned error code 24
  sigma=0.01 kernel=rbfdot lambda=0 nblocks=4 ( NA )
  sigma=0.1 kernel=rbfdot lambda=0 nblocks=4 ( 1.750748e+17 )
  sigma=1 kernel=rbfdot lambda=0 nblocks=4 ( 0.1441129 )
  sigma=10 kernel=rbfdot lambda=0 nblocks=4 ( 0.02598556 )
  sigma=100 kernel=rbfdot lambda=0 nblocks=4 ( 0.02371696 )
  Error in LU.dgC(a) : cs_lu(A) failed: near-singular A (or out of memory)
  sigma=1000 kernel=rbfdot lambda=0 nblocks=4 ( NA )
  sigma=10000 kernel=rbfdot lambda=0 nblocks=4 ( 0.02367483 )
  sigma=0.001 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.02688759 )
  sigma=0.01 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.02555228 )
  sigma=0.1 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.03469847 )
  sigma=1 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.04468682 )
  sigma=10 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.02415187 )
  sigma=100 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.02370331 )
  sigma=1000 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.02367452 )
  sigma=10000 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.02367483 )
  sigma=0.001 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.02550032 )
  sigma=0.01 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.0262482 )
  sigma=0.1 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.02528058 )
  sigma=1 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.0251696 )
  sigma=10 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.02343492 )
  sigma=100 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.02370391 )
  sigma=1000 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.0236745 )
  sigma=10000 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.02367484 )
  sigma=0.001 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.02443446 )
  sigma=0.01 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.02548117 )
  sigma=0.1 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.02579905 )
  sigma=1 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.0234738 )
  sigma=10 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.02371383 )
  sigma=100 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.02369266 )
  sigma=1000 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.02367462 )
  sigma=10000 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.02367493 )
  sigma=0.001 kernel=rbfdot lambda=1 nblocks=4 ( 0.02404365 )
  sigma=0.01 kernel=rbfdot lambda=1 nblocks=4 ( 0.02446648 )
  sigma=0.1 kernel=rbfdot lambda=1 nblocks=4 ( 0.0244948 )
  sigma=1 kernel=rbfdot lambda=1 nblocks=4 ( 0.02290621 )
  sigma=10 kernel=rbfdot lambda=1 nblocks=4 ( 0.02327384 )
  sigma=100 kernel=rbfdot lambda=1 nblocks=4 ( 0.02368297 )
  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.02389264 )
  sigma=0.01 kernel=rbfdot lambda=10 nblocks=4 ( 0.02395973 )
  sigma=0.1 kernel=rbfdot lambda=10 nblocks=4 ( 0.02401162 )
  sigma=1 kernel=rbfdot lambda=10 nblocks=4 ( 0.02347487 )
  sigma=10 kernel=rbfdot lambda=10 nblocks=4 ( 0.02356368 )
  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.02373926 )
  sigma=0.1 kernel=rbfdot lambda=100 nblocks=4 ( 0.0237444 )
  sigma=1 kernel=rbfdot lambda=100 nblocks=4 ( 0.02364795 )
  sigma=10 kernel=rbfdot lambda=100 nblocks=4 ( 0.02366286 )
  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 ( 1798.189 )
  sigma=0.01 kernel=rbfdot lambda=0 nblocks=4 ( 299864882 )
  sigma=0.1 kernel=rbfdot lambda=0 nblocks=4 ( 103827 )
  sigma=1 kernel=rbfdot lambda=0 nblocks=4 ( 6.489713e+14 )
  sigma=10 kernel=rbfdot lambda=0 nblocks=4 ( 0.2191373 )
  sigma=100 kernel=rbfdot lambda=0 nblocks=4 ( 0.07360749 )
  sigma=1000 kernel=rbfdot lambda=0 nblocks=4 ( 0.07503878 )
  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.08695881 )
  sigma=0.01 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.08337121 )
  sigma=0.1 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.08675422 )
  sigma=1 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.1616541 )
  sigma=10 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.08353482 )
  sigma=100 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.0740327 )
  sigma=1000 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.07504097 )
  sigma=10000 kernel=rbfdot lambda=0.001 nblocks=4 ( 0.07548306 )
  sigma=0.001 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.08623301 )
  sigma=0.01 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.08208725 )
  sigma=0.1 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.0799853 )
  sigma=1 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.09912345 )
  sigma=10 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.07836909 )
  sigma=100 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.07373605 )
  sigma=1000 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.07506302 )
  sigma=10000 kernel=rbfdot lambda=0.01 nblocks=4 ( 0.07550018 )
  sigma=0.001 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.08357832 )
  sigma=0.01 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.0879118 )
  sigma=0.1 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.08090096 )
  sigma=1 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.07700156 )
  sigma=10 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.07501808 )
  sigma=100 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.0740225 )
  sigma=1000 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.07524731 )
  sigma=10000 kernel=rbfdot lambda=0.1 nblocks=4 ( 0.07565807 )
  sigma=0.001 kernel=rbfdot lambda=1 nblocks=4 ( 0.08196944 )
  sigma=0.01 kernel=rbfdot lambda=1 nblocks=4 ( 0.08360549 )
  sigma=0.1 kernel=rbfdot lambda=1 nblocks=4 ( 0.08395288 )
  sigma=1 kernel=rbfdot lambda=1 nblocks=4 ( 0.07627989 )
  sigma=10 kernel=rbfdot lambda=1 nblocks=4 ( 0.07392259 )
  sigma=100 kernel=rbfdot lambda=1 nblocks=4 ( 0.07547905 )
  sigma=1000 kernel=rbfdot lambda=1 nblocks=4 ( 0.07626578 )
  sigma=10000 kernel=rbfdot lambda=1 nblocks=4 ( 0.07651293 )
  sigma=0.001 kernel=rbfdot lambda=10 nblocks=4 ( 0.08073092 )
  sigma=0.01 kernel=rbfdot lambda=10 nblocks=4 ( 0.08108913 )
  sigma=0.1 kernel=rbfdot lambda=10 nblocks=4 ( 0.08222214 )
  sigma=1 kernel=rbfdot lambda=10 nblocks=4 ( 0.07803291 )
  sigma=10 kernel=rbfdot lambda=10 nblocks=4 ( 0.07656637 )
  sigma=100 kernel=rbfdot lambda=10 nblocks=4 ( 0.07722481 )
  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.0785552 )
  sigma=0.01 kernel=rbfdot lambda=100 nblocks=4 ( 0.07858367 )
  sigma=0.1 kernel=rbfdot lambda=100 nblocks=4 ( 0.07858298 )
  sigma=1 kernel=rbfdot lambda=100 nblocks=4 ( 0.07780992 )
  sigma=10 kernel=rbfdot lambda=100 nblocks=4 ( 0.07755074 )
  sigma=100 kernel=rbfdot lambda=100 nblocks=4 ( 0.07763633 )
  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 = 0
  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, 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1.3, 1.4, 1.5, 1, 1.5, 1.1, 1.8, 1.3, 1.5, 1.2, 1.3, 1.4, 1.4, 1.7, 1.5, 1, 1.1, 
     1, 1.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 a whole number")
         if (fastkrr.nblocks < 1) 
             stop("fastkrr.nblocks must be at least 1")
         if (fastkrr.nblocks%%1 != 0) 
             stop("fastkrr.nblocks must be a whole number")
         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!")
         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, 4.4, 3.9, 3.5, 3.8, 3.8, 
     3.4, 3.7, 3.6, 3.3, 3.4, 3, 3.4, 3.5, 3.4, 3.2, 3.1, 3.4, 4.1, 4.2, 3.1, 3.2, 3.5, 
     3.6, 3, 3.4, 3.5,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.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[iIndices, ], kernel, data$y[iIndices], params$lambda)
  10: solve(Matrix(K + diag(lambda, N)))
  11: solve(Matrix(K + diag(lambda, N)))
  
  testthat results ================================================================
  OK: 109 SKIPPED: 0 FAILED: 1
  1. Error: rmse_by_ndim (@test_quality.R#30) 
  
  Error: testthat unit tests failed
  Execution halted