From 558b96b4e3cfd1845677620976f09bad2c641ecb Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 17 Apr 2015 16:42:33 +0200 Subject: Make compiled FOMC and DFOP models work - Many thanks @karlines for the hint in ccSolve#1 how to declare the time variable and for writing the ccSolve package in the first place - Add tests for the compiled versions of the FOMC and DFOP models --- inst/unitTests/runit.mkinpredict.R | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'inst/unitTests/runit.mkinpredict.R') diff --git a/inst/unitTests/runit.mkinpredict.R b/inst/unitTests/runit.mkinpredict.R index d30bcfab..6635ea1f 100644 --- a/inst/unitTests/runit.mkinpredict.R +++ b/inst/unitTests/runit.mkinpredict.R @@ -34,6 +34,26 @@ test.SFO_solution_types <- function() checkEquals(SFO.analytical, SFO.eigen) } # }}} +# Check solution types for FOMC {{{ +test.FOMC_solution_types <- function() +{ + ot = seq(0, 100, by = 1) + FOMC <- mkinmod(parent = list(type = "FOMC")) + FOMC.analytical <- round(subset(mkinpredict(FOMC, c(alpha = 1, beta = 10), + c(parent = 100), ot, solution_type = "analytical"), time == 100), digits=5) + FOMC.deSolve <- round(subset(mkinpredict(FOMC, c(alpha = 1, beta = 10), + c(parent = 100), ot, solution_type = "deSolve"), use_compiled = FALSE, time == 100), digits=5) + checkEquals(FOMC.analytical, FOMC.deSolve) + + if (require(ccSolve)) { + checkTrue(!is.null(FOMC$compiled)) + FOMC.deSolve.compiled <- round(subset(mkinpredict(FOMC, c(alpha = 1, beta = 10), + c(parent = 100), ot, solution_type = "deSolve"), time == 100), digits=5) + checkEquals(FOMC.analytical, FOMC.deSolve.compiled) + } + +} # }}} + # Check model specification and solution types for SFO_SFO {{{ # Relative Tolerance is 0.01% # Do not use time 0, as eigenvalue based solution does not give 0 at time 0 for metabolites -- cgit v1.2.1