aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
Diffstat (limited to 'R')
-rw-r--r--R/mkinmod.R9
1 files changed, 6 insertions, 3 deletions
diff --git a/R/mkinmod.R b/R/mkinmod.R
index 3fff0878..149d2beb 100644
--- a/R/mkinmod.R
+++ b/R/mkinmod.R
@@ -273,7 +273,7 @@ mkinmod <- function(..., use_of_ff = "min", speclist = NULL)
}#}}}
# Create a function compiled from C code if possible #{{{
- if (require(ccSolve)) {
+ if (requireNamespace("ccSolve", quietly = TRUE)) {
diffs.C <- paste(diffs, collapse = ";\n")
diffs.C <- paste0(diffs.C, ";")
for (i in seq_along(diffs)) {
@@ -295,9 +295,12 @@ mkinmod <- function(..., use_of_ff = "min", speclist = NULL)
replacement <- paste0("* y[", i - 1, "]")
diffs.C <- gsub(pattern, replacement, diffs.C)
}
- if (sum(sapply(spec, function(x) x$type %in% c("SFO", "FOMC", "DFOP", "SFORB"))) == length(spec)) {
+ if (sum(sapply(spec, function(x) x$type %in%
+ c("SFO", "FOMC", "DFOP", "SFORB"))) == length(spec)) {
message("Compiling differential equation model from auto-generated C code...")
- model$compiled <- compile.ode(diffs.C, language = "C", parms = parms, declaration = "double time = *t;")
+ model$compiled <- ccSolve::compile.ode(diffs.C, language = "C",
+ parms = parms,
+ declaration = "double time = *t;")
}
}
# }}}

Contact - Imprint