R Under development (unstable) (2023-11-28 r85645 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > #### Testing the Exponential Condition Number computations > > library(expm) Loading required package: Matrix Attaching package: 'expm' The following object is masked from 'package:Matrix': expm > > mSource <- function(file, ...) source(system.file(file, ..., + package = "expm", mustWork=TRUE), + keep.source = FALSE) > mSource("test-tools.R")## -> assertError(), rMat() Loading required package: tools > ## getting examples where we know expm(.) "exactly": > mSource("demo", "exact-fn.R") > > M <- xct10$m > eC <- list(expmCondF = 566.582631819923, + expmCond1 = 137.455837652872) > C1 <- expmCond(M, "exact") > (C2 <- expmCond(M, "1.est", expm=FALSE)) [1] 137.4558 > (C3. <- expmCond(M, "F.est", abstol = 0.1)[[1]]) [1] 566.5826 attr(,"iter") [1] 2 > (C3.1 <- expmCond(M, "F.est", abstol = 0.01, reltol = 1e-12)[[1]]) [1] 566.5826 attr(,"iter") [1] 3 > > stopifnot(all.equal(C1[1:2], eC, tolerance = 1e-14), + all.equal(C2 , eC$expmCond1, tolerance = 1e-14), + all.equal(C3. , eC$expmCondF, tolerance = 1e-14, check.attributes = FALSE), + all.equal(C3.1, eC$expmCondF, tolerance = 1e-14, check.attributes = FALSE)) > > cat('Time elapsed: ', (p1 <- proc.time()),'\n') # for ``statistical reasons'' Time elapsed: 1.57 0.21 1.79 NA NA > > ## cat('Time elapsed: ',(p2 <- proc.time())-p1,'\n') # for ``statistical reasons'' > > ## cat('Time elapsed: ',(p3 <- proc.time())-p2,'\n') # for ``statistical reasons'' > > proc.time() user system elapsed 1.59 0.21 1.81