R Under development (unstable) (2023-12-09 r85665 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. > library(grDevices, pos = "package:base", verbose = FALSE) > library( stats, pos = "package:base", verbose = FALSE) > library( utils, pos = "package:base", verbose = FALSE) > > library(fastbeta) > options(warn = 2L, error = if (interactive()) recover) > > beta <- function (t, a = 1e-01, b = 1e-05) + b * (1 + a * cospi(t / 26)) > nu <- function (t) 1e+03 > mu <- function (t) 1e-03 > > S0 <- 5e+04 > I0 <- 1e+03 > R0 <- 1e+06 - S0 - I0 > constants <- c(S0 = S0, I0 = I0, R0 = R0, gamma = 0.5, delta = 0) > > n <- 250L > prob <- 0.1 > delay <- diff(pgamma(0:8, 2.5)) > > ## At the very least, these should not signal warnings or > ## errors unexpectedly, and the compiled and uncompiled > ## code should generate equal results > > X00 <- sir(n, beta, nu, mu, constants, stochastic = FALSE, + prob, delay, useCompiled = FALSE) > > X01 <- sir(n, beta, nu, mu, constants, stochastic = FALSE, + prob, delay, useCompiled = TRUE) > > set.seed(0L) > X10 <- sir(n, beta, nu, mu, constants, stochastic = TRUE, + prob, delay, useCompiled = FALSE) > > set.seed(0L) > X11 <- sir(n, beta, nu, mu, constants, stochastic = TRUE, + prob, delay, useCompiled = TRUE) > > stopifnot(exprs = { + all.equal(X00, X01) + all.equal(X10, X11) + is.double(X11) + is.mts(X11) + identical(dim(X11), c(n + 1L, 6L)) + identical(dimnames(X11), list(NULL, c("S", "I", "R", "B", "Z", "Z.obs"))) + identical(tsp(X11), c(0, n, 1)) + !anyNA(X11[-1L, ]) + min(X11, na.rm = TRUE) >= 0 + }) > > if (dev.interactive(TRUE)) + plot(X11) > > tools::assertError(sir(0L, beta, nu, mu, constants)) > > proc.time() user system elapsed 0.18 0.06 0.23 > > proc.time() user system elapsed 0.18 0.06 0.23