R Under development (unstable) (2026-07-22 r90289) -- "Unsuffered Consequences" Copyright (C) 2026 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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(PTT) > > # These deterministic reference values guard the core marginal and conditional > # calculations against numerical drift while allowing platform-level > # floating-point noise. > tolerance <- 1e-9 > > x <- c(seq(0.05, 0.45, length.out = 24), seq(0.6, 0.95, length.out = 16)) > grid <- c(0.1, 0.3, 0.5, 0.7, 0.9) > > apt.fit <- apt( + x, Xpred = grid, max.resol = 4, rho0 = 0.2, + n.grid = 3, n.s = 3 + ) > apt.expected <- c( + -1.22884277881542, -0.380595133618687, + 1.04073167934391, 1.04446417461813, 0.946856014560911, + 0.960353263602841, 0.965065744499516 + ) > stopifnot( + isTRUE(all.equal( + unname(c(apt.fit$logrho, apt.fit$logphi, apt.fit$predictive_densities)), + apt.expected, + tolerance = tolerance + )), + identical(unname(apt.fit$part_points_hmap), matrix(c(0, 15, 0, Inf), nrow = 1L)) + ) > > opt.fit <- opt(x, Xpred = grid, max.resol = 4, rho0 = 0.5) > opt.expected <- c( + -0.0778733915972794, -0.615273788962671, + 1.01464670747005, 1.01474115491321, 0.983823971413429, + 0.98542445662195, 0.986027934553703 + ) > stopifnot( + isTRUE(all.equal( + unname(c(opt.fit$logrho, opt.fit$logphi, opt.fit$predictive_densities)), + opt.expected, + tolerance = tolerance + )), + identical(unname(opt.fit$part_points_hmap), matrix(c(0, 15, 0, Inf), nrow = 1L)) + ) > > conditional.x <- seq(0.02, 0.98, length.out = 40) > conditional.y <- pmin( + 0.98, + pmax(0.02, 0.15 + 0.7 * conditional.x + 0.08 * sin(8 * pi * conditional.x)) + ) > conditional.fit <- cond.opt( + conditional.x, conditional.y, + Xpred = c(0.2, 0.5, 0.8), Ypred = c(0.25, 0.5, 0.75), + max.resX = 3, max.resY = 4 + ) cgbt.cpp:256:41: runtime error: shift exponent -65533 is negative #0 0x7f4995a9a378 in CondGBT::find_hmap_part() /data/gannet/ripley/R/packages/tests-clang-UBSAN/PTT/src/cgbt.cpp:256:41 #1 0x7f4995ab1a8d in fitCondPTTcpp(arma::Mat, arma::Mat, arma::Mat, arma::Mat, arma::Mat, arma::Mat, int, int, double, int, double, int, int, double, double, int, int, double, int) /data/gannet/ripley/R/packages/tests-clang-UBSAN/PTT/src/main.cpp:247:82 #2 0x7f4995a8e4d5 in _PTT_fitCondPTTcpp /data/gannet/ripley/R/packages/tests-clang-UBSAN/PTT/src/RcppExports.cpp:62:34 #3 0x55cfd7bcda4b in R_doDotCall (/data/gannet/ripley/R/R-clang/bin/exec/R+0x90a4b) #4 0x55cfd7bce33d in do_dotcall (/data/gannet/ripley/R/R-clang/bin/exec/R+0x9133d) #5 0x55cfd7c0cd53 in bcEval_loop eval.c #6 0x55cfd7c0631b in bcEval eval.c #7 0x55cfd7c05ad4 in Rf_eval (/data/gannet/ripley/R/R-clang/bin/exec/R+0xc8ad4) #8 0x55cfd7c1dc38 in R_execClosure eval.c #9 0x55cfd7c1d12a in applyClosure_core eval.c #10 0x55cfd7c069f6 in Rf_applyClosure (/data/gannet/ripley/R/R-clang/bin/exec/R+0xc99f6) #11 0x55cfd7c05f27 in Rf_eval (/data/gannet/ripley/R/R-clang/bin/exec/R+0xc8f27) #12 0x55cfd7c22f97 in do_set (/data/gannet/ripley/R/R-clang/bin/exec/R+0xe5f97) #13 0x55cfd7c05cff in Rf_eval (/data/gannet/ripley/R/R-clang/bin/exec/R+0xc8cff) #14 0x55cfd7c531d7 in Rf_ReplIteration (/data/gannet/ripley/R/R-clang/bin/exec/R+0x1161d7) #15 0x55cfd7c54cde in run_Rmainloop (/data/gannet/ripley/R/R-clang/bin/exec/R+0x117cde) #16 0x55cfd7c54d4a in Rf_mainloop (/data/gannet/ripley/R/R-clang/bin/exec/R+0x117d4a) #17 0x55cfd7b3edb7 in main (/data/gannet/ripley/R/R-clang/bin/exec/R+0x1db7) #18 0x7f49a3711574 in __libc_start_call_main (/lib64/libc.so.6+0x3574) (BuildId: 92b5376d35bb29c098175948cf3e7cbcae3aeae1) #19 0x7f49a3711627 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3627) (BuildId: 92b5376d35bb29c098175948cf3e7cbcae3aeae1) #20 0x55cfd7b3ecd4 in _start (/data/gannet/ripley/R/R-clang/bin/exec/R+0x1cd4) SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior cgbt.cpp:256:41 > conditional.expected <- c( + -28.8015601776622, 30.7668680880074, + 4.21400432146923, 4.44293777151951, 7.18750082136846 + ) > conditional.hmap.expected <- matrix( + c( + 0, 0, 0, 2, 4, 4, 6, + 7, 3, 1, 3, 7, 5, 7, + 0, 1, 2, 2, 1, 2, 2, + 1, 1, Inf, Inf, 1, Inf, Inf, + 3.10199679410356e-13, 0.0718176406024455, + 0.985628998307472, 0.976837618064303, + 0.0718176406024452, 0.976837618064303, 0.985628998307472 + ), + nrow = 7L + ) > stopifnot( + isTRUE(all.equal( + unname(c( + conditional.fit$logrho, + conditional.fit$logphi, + conditional.fit$predictive_densities + )), + conditional.expected, + tolerance = tolerance + )), + isTRUE(all.equal( + unname(conditional.fit$part_points_hmap), + conditional.hmap.expected, + tolerance = tolerance + )) + ) > > proc.time() user system elapsed 0.658 0.104 0.943