R Under development (unstable) (2024-08-21 r87038 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 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(DPQ) > > set.seed(17) > x <- rlnorm(500) > dg.R.1 <- sapply(x, dgamma.R, shape = 11.111) > dg.R.1L <- sapply(x, dgamma.R, shape = 11.111, log = TRUE) > ## print observed differences > all.equal(dgamma (x, 11.111 ), dg.R.1, tolerance = 0) # 7.844e-16 [1] "Mean relative difference: 1.067218e-15" > all.equal(dgamma (x, 11.111, log=TRUE), dg.R.1L, tolerance = 0) # 2.148e-16 [1] "Mean relative difference: 2.30355e-16" > stopifnot(exprs = { + all.equal(dg.R.1, dgamma.R(x, 11.111 ), tolerance = 0) # just vectorization + all.equal(dg.R.1L, dgamma.R(x, 11.111, log=TRUE), tolerance = 0) # " " + all.equal(dg.R.1, dgamma(x, 11.111 ), tolerance = 1e-14) + all.equal(dg.R.1L, dgamma(x, 11.111, log=TRUE), tolerance = 1e-14) + all.equal(dgamma (x, 14.99), tolerance = 2e-15, + dgamma.R(x, 14.99, dpois_r_args = list(verbose=TRUE) -> dgR149)) + }) dpois_raw(): M = 500 > > > > > proc.time() user system elapsed 0.40 0.01 0.42