R Under development (unstable) (2025-07-25 r88451 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 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. > library(sfsmisc) > > options(digits=9) > > set.seed(12) > m <- matrix(round(rnorm(25),2), 5, 5); m <- 1+ m + t(m); diag(m) <- diag(m) + 4 > (mp <- posdefify(m)) [,1] [,2] [,3] [,4] [,5] [1,] 2.040000000 1.559508625 -0.887340889 -0.408171836 -0.245682172 [2,] 1.559508625 4.360000000 -0.533157355 1.705637933 2.344838314 [3,] -0.887340889 -0.533157355 3.440000000 1.195027865 1.353283301 [4,] -0.408171836 1.705637933 1.195027865 6.020000000 0.577514304 [5,] -0.245682172 2.344838314 1.353283301 0.577514304 2.940000000 > (mp. <- posdefify(m, method = "allEV")) [,1] [,2] [,3] [,4] [,5] [1,] 2.040000000 1.378740895 -0.424598775 -0.386773282 -0.434470464 [2,] 1.378740895 4.360000000 -0.613091776 1.507019105 2.225434128 [3,] -0.424598775 -0.613091776 3.440000000 0.940298040 1.156766185 [4,] -0.386773282 1.507019105 0.940298040 6.020000000 0.277226191 [5,] -0.434470464 2.225434128 1.156766185 0.277226191 2.940000000 > > stopifnot(eigen(mp, only.val=TRUE)$values > 0, + eigen(mp., only.val=TRUE)$values > 0, + all.equal(diag(m), diag(mp), tol= 1e-15), + all.equal(diag(m), diag(mp.),tol= 1e-15), + T) > > ## nearcor() > pr <- matrix(c(1, 0.477, 0.644, 0.478, 0.651, 0.826, + 0.477, 1, 0.516, 0.233, 0.682, 0.75, + 0.644, 0.516, 1, 0.599, 0.581, 0.742, + 0.478, 0.233, 0.599, 1, 0.741, 0.8, + 0.651, 0.682, 0.581, 0.741, 1, 0.798, + 0.826, 0.75, 0.742, 0.8, 0.798, 1), + nrow = 6, ncol = 6) > > nc. <- nearcor(pr, conv.tol = 1e-7) # default, 11 iter. > ncr <- nearcor(pr, conv.tol = 1e-15) # 27-28 iterations (because of conv.tol)! > ncr0 <- nearcor(pr, conv.tol = 1e-15, posd.tol = 0)# -> no posdefify step > parts <- setdiff(names(nc.), "iterations") > ## IGNORE_RDIFF_BEGIN > str(ncr) List of 4 $ cor : num [1:6, 1:6] 1 0.488 0.643 0.491 0.644 ... $ fnorm : num 0.0744 $ iterations: num 29 $ converged : logi TRUE - attr(*, "class")= chr "nearcor" > if(ncr$iterations != 27) { + cat(sprintf("On this platform, the number of iterations (for tol 1e-15) is not 27, but %d;\n", + ncr$iterations)) + cat("sessionInfoX() :\n") + print(sessionInfoX()) + } On this platform, the number of iterations (for tol 1e-15) is not 27, but 29; sessionInfoX() : Extended sessionInfo(): ----------------------- Capabilities: jpeg png tiff tcltk X11 aqua X X X X - - http/ftp sockets libxml fifo cledit iconv X X - X - X NLS Rprof profmem cairo ICU long.double X X X X X X libcurl X Sys.info: nodename CRANWIN3 user CRAN .Machine: List of 29 $ double.eps : num 2.22e-16 $ double.neg.eps : num 1.11e-16 $ double.xmin : num 2.23e-308 $ double.xmax : num 1.8e+308 $ double.base : int 2 $ double.digits : int 53 $ double.rounding : int 5 $ double.guard : int 0 $ double.ulp.digits : int -52 $ double.neg.ulp.digits : int -53 $ double.exponent : int 11 $ double.min.exp : int -1022 $ double.max.exp : int 1024 $ integer.max : int 2147483647 $ sizeof.long : int 4 $ sizeof.longlong : int 8 $ sizeof.longdouble : int 16 $ sizeof.pointer : int 8 $ sizeof.time_t : int 8 $ longdouble.eps : num 1.08e-19 $ longdouble.neg.eps : num 5.42e-20 $ longdouble.digits : int 64 $ longdouble.rounding : int 5 $ longdouble.guard : int 0 $ longdouble.ulp.digits : int -63 $ longdouble.neg.ulp.digits: int -64 $ longdouble.exponent : int 15 $ longdouble.min.exp : int -16382 $ longdouble.max.exp : int 16384 R was compiled by: C gcc.exe (GCC) 14.2.0 Fortran GNU Fortran (GCC) 14.2.0 LAPACK version: 3.12.1 External software (versions): zlib 1.3.1 bzlib 1.0.8, 13-Jul-2019 xz 5.8.1 libdeflate 1.24 zstd 1.5.7 PCRE 10.45 2025-02-05 ICU 77.1 TRE TRE 0.8.0 R_fixes (BSD) iconv win_iconv readline BLAS Graphical software (versions): cairo 1.18.4 cairoFT pango libpng 1.6.48 jpeg 9.6 libtiff LIBTIFF, Version 4.7.0 PCRE (regex) config.: ("UTF-8" = TRUE, "Unicode properties" = TRUE, JIT = FALSE, stack = FALSE) R executable linked against libR.* ['is R shared']: TRUE R_LIBS: libPath [.libPaths()] contents in addition to R_LIBS and .Library: [1] "D:/temp/2025_07_26_15_50_16_10394/RtmpcbTlye/RLIBS_c5c2a24158b" [2] "D:/RCompile/recent/R/library" ** RLIBS has entries not in .libPaths(): [1] "d:\\RCompile\\CRANincoming\\R-devel\\sfsmisc.Rcheck\\tests\\D" [2] "D:\\temp\\2025_07_26_15_50_16_10394\\RtmpcbTlye\\RLIBS_c5c2a24158b" Main R env. variables (for more, inspect the 'xR.env' component): [,1] R_ENVIRON "" R_PROFILE "" R_CHECK_ENVIRON "" ---------------- standard sessionInfo(): R Under development (unstable) (2025-07-25 r88451 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows Server 2022 x64 (build 20348) Matrix products: default LAPACK version 3.12.1 locale: [1] LC_COLLATE=C LC_CTYPE=German_Germany.utf8 [3] LC_MONETARY=C LC_NUMERIC=C [5] LC_TIME=C time zone: Europe/Berlin tzcode source: internal attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] sfsmisc_1.1-21 loaded via a namespace (and not attached): [1] compiler_4.6.0 tools_4.6.0 Warning message: In normalizePath(path.expand(path), winslash, mustWork) : path[1]="D": Das System kann die angegebene Datei nicht finden > ## IGNORE_RDIFF_END > str(ncr0[parts])# looks identical (with few digits accuracy) List of 3 $ cor : num [1:6, 1:6] 1 0.488 0.643 0.491 0.644 ... $ fnorm : num 0.0744 $ converged: logi TRUE > nr <- ncr$cor > > stopifnot(exprs = { + nc.$iterations == 11 + all.equal(nr[lower.tri(nr)], + c(0.48796803265083, 0.64265188295401, 0.49063868812228, 0.64409905497094, + 0.80871120142824, 0.51411473401472, 0.25066882763262, 0.67235131534931, + 0.72583206922437, 0.59682778611131, 0.58219178154582, 0.7449631866236, + 0.72988206459063, 0.77215024062758, 0.81319175546212), tol = 1e-12) + all.equal(ncr, ncr0, tolerance = 6e-6)# seen 6.6676e-7 + }) > > proc.time() user system elapsed 0.25 0.06 0.29