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) > > set.seed(42) > x <- matrix(c(0.10, 0.20, 0.35, 0.65, 0.80, 0.90), ncol = 1) > pred <- matrix(c(0, 0.25, 0.50, 0.75, 1), ncol = 1) > > fit <- apt( + x, Xpred = pred, max.resol = 3, + n.grid = 2, n.s = 2, n.post.samples = 1 + ) > stopifnot( + length(fit$predictive_densities) == nrow(pred), + all(is.finite(fit$predictive_densities)), + all(fit$predictive_densities >= 0), + identical(colnames(fit$part_points_hmap), c("X1.l", "X1.u", "level", "state")), + identical(dim(fit$Omega), c(1L, 2L)), + length(fit$part_points_post_samples) == 1L + ) > > set.seed(99) > sample.a <- apt(x, max.resol = 3, n.grid = 2, n.s = 2, n.post.samples = 1) > set.seed(99) > sample.b <- apt(x, max.resol = 3, n.grid = 2, n.s = 2, n.post.samples = 1) > stopifnot(identical(sample.a$part_points_post_samples, sample.b$part_points_post_samples)) > > kernel.a <- apt(x, max.resol = 2, tran.mode = 2, rho0 = 0.1, n.grid = 2, n.s = 2) > kernel.b <- apt(x, max.resol = 2, tran.mode = 2, rho0 = 0.9, n.grid = 2, n.s = 2) > stopifnot( + identical(kernel.a$logrho, kernel.b$logrho), + identical(kernel.a$logphi, kernel.b$logphi) + ) > > standardized <- apt( + c(-3, -2, -1), Xpred = c(-3, -1), + Omega.type = "standardized", max.resol = 2, n.grid = 2, n.s = 2 + ) > stopifnot( + standardized$Omega[1, 1] < -3, + standardized$Omega[1, 2] > -1, + all(is.finite(standardized$predictive_densities)) + ) > > conditional <- cond.apt( + X = x, Y = rev(x), Xpred = pred[2:4, ], Ypred = pred[2:4, ], + max.resX = 2, max.resY = 2, n.grid = 2, n.s = 3 + ) cgbt.cpp:256:41: runtime error: shift exponent -65534 is negative #0 0x7fe3906c2378 in CondGBT::find_hmap_part() /data/gannet/ripley/R/packages/tests-clang-UBSAN/PTT/src/cgbt.cpp:256:41 #1 0x7fe3906d9a8d 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 0x7fe3906b64d5 in _PTT_fitCondPTTcpp /data/gannet/ripley/R/packages/tests-clang-UBSAN/PTT/src/RcppExports.cpp:62:34 #3 0x55fc26231a4b in R_doDotCall (/data/gannet/ripley/R/R-clang/bin/exec/R+0x90a4b) #4 0x55fc2623233d in do_dotcall (/data/gannet/ripley/R/R-clang/bin/exec/R+0x9133d) #5 0x55fc26270d53 in bcEval_loop eval.c #6 0x55fc2626a31b in bcEval eval.c #7 0x55fc26269ad4 in Rf_eval (/data/gannet/ripley/R/R-clang/bin/exec/R+0xc8ad4) #8 0x55fc26281c38 in R_execClosure eval.c #9 0x55fc2628112a in applyClosure_core eval.c #10 0x55fc2626a9f6 in Rf_applyClosure (/data/gannet/ripley/R/R-clang/bin/exec/R+0xc99f6) #11 0x55fc26269f27 in Rf_eval (/data/gannet/ripley/R/R-clang/bin/exec/R+0xc8f27) #12 0x55fc26286f97 in do_set (/data/gannet/ripley/R/R-clang/bin/exec/R+0xe5f97) #13 0x55fc26269cff in Rf_eval (/data/gannet/ripley/R/R-clang/bin/exec/R+0xc8cff) #14 0x55fc262b71d7 in Rf_ReplIteration (/data/gannet/ripley/R/R-clang/bin/exec/R+0x1161d7) #15 0x55fc262b8cde in run_Rmainloop (/data/gannet/ripley/R/R-clang/bin/exec/R+0x117cde) #16 0x55fc262b8d4a in Rf_mainloop (/data/gannet/ripley/R/R-clang/bin/exec/R+0x117d4a) #17 0x55fc261a2db7 in main (/data/gannet/ripley/R/R-clang/bin/exec/R+0x1db7) #18 0x7fe39e612574 in __libc_start_call_main (/lib64/libc.so.6+0x3574) (BuildId: 92b5376d35bb29c098175948cf3e7cbcae3aeae1) #19 0x7fe39e612627 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3627) (BuildId: 92b5376d35bb29c098175948cf3e7cbcae3aeae1) #20 0x55fc261a2cd4 in _start (/data/gannet/ripley/R/R-clang/bin/exec/R+0x1cd4) SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior cgbt.cpp:256:41 > stopifnot( + length(conditional$predictive_densities) == 3L, + all(is.finite(conditional$predictive_densities)), + identical(dim(conditional$OmegaX), c(1L, 2L)), + identical(dim(conditional$OmegaY), c(1L, 2L)) + ) > > stopifnot( + inherits(try(apt(c(-1, 0), max.resol = 2), silent = TRUE), "try-error"), + inherits(try(apt(x, max.resol = 15), silent = TRUE), "try-error"), + inherits(try(cond.apt(x, x, Xpred = 0.5), silent = TRUE), "try-error") + ) > > proc.time() user system elapsed 0.600 0.089 0.793