diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2019-03-04 10:12:43 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2019-03-04 10:12:43 +0100 |
commit | d0a358a8f4fd03c95536409523e492eb15726f44 (patch) | |
tree | fefa34562fb4557921d88f64c6827401a9c1ed99 /docs/articles/web_only/compiled_models.html | |
parent | 4e85356bbe535aaf5bc7dc25238ed6a8d1f9913c (diff) |
Review tests and examples based on winbuilder results
Static documentation rebuilt by pkgdown
Diffstat (limited to 'docs/articles/web_only/compiled_models.html')
-rw-r--r-- | docs/articles/web_only/compiled_models.html | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/docs/articles/web_only/compiled_models.html b/docs/articles/web_only/compiled_models.html index 3d49d262..1d96ea76 100644 --- a/docs/articles/web_only/compiled_models.html +++ b/docs/articles/web_only/compiled_models.html @@ -88,7 +88,7 @@ <h1>Performance benefit by using compiled model definitions in mkin</h1> <h4 class="author">Johannes Ranke</h4> - <h4 class="date">2019-02-26</h4> + <h4 class="date">2019-03-04</h4> <div class="hidden name"><code>compiled_models.Rmd</code></div> @@ -101,37 +101,37 @@ <h2 class="hasAnchor"> <a href="#model-that-can-also-be-solved-with-eigenvalues" class="anchor"></a>Model that can also be solved with Eigenvalues</h2> <p>This evaluation is taken from the example section of mkinfit. When using an mkin version equal to or greater than 0.9-36 and a C compiler (gcc) is available, you will see a message that the model is being compiled from autogenerated C code when defining a model using mkinmod. The <code><a href="../../reference/mkinmod.html">mkinmod()</a></code> function checks for presence of the gcc compiler using</p> -<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Sys.which">Sys.which</a></span>(<span class="st">"gcc"</span>)</a></code></pre></div> +<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Sys.which">Sys.which</a></span>(<span class="st">"gcc"</span>)</a></code></pre></div> <pre><code>## gcc ## "/usr/bin/gcc"</code></pre> <p>First, we build a simple degradation model for a parent compound with one metabolite.</p> -<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(<span class="st">"mkin"</span>, <span class="dt">quietly =</span> <span class="ot">TRUE</span>)</a> -<a class="sourceLine" id="cb3-2" data-line-number="2">SFO_SFO <-<span class="st"> </span><span class="kw"><a href="../../reference/mkinmod.html">mkinmod</a></span>(</a> -<a class="sourceLine" id="cb3-3" data-line-number="3"> <span class="dt">parent =</span> <span class="kw"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"m1"</span>),</a> -<a class="sourceLine" id="cb3-4" data-line-number="4"> <span class="dt">m1 =</span> <span class="kw"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>))</a></code></pre></div> +<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(<span class="st">"mkin"</span>, <span class="dt">quietly =</span> <span class="ot">TRUE</span>)</a> +<a class="sourceLine" id="cb3-2" title="2">SFO_SFO <-<span class="st"> </span><span class="kw"><a href="../../reference/mkinmod.html">mkinmod</a></span>(</a> +<a class="sourceLine" id="cb3-3" title="3"> <span class="dt">parent =</span> <span class="kw"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"m1"</span>),</a> +<a class="sourceLine" id="cb3-4" title="4"> <span class="dt">m1 =</span> <span class="kw"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>))</a></code></pre></div> <pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre> <p>We can compare the performance of the Eigenvalue based solution against the compiled version and the R implementation of the differential equations using the benchmark package.</p> -<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="cf">if</span> (<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">require</a></span>(rbenchmark)) {</a> -<a class="sourceLine" id="cb5-2" data-line-number="2"> b<span class="fl">.1</span> <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/rbenchmark/topics/benchmark">benchmark</a></span>(</a> -<a class="sourceLine" id="cb5-3" data-line-number="3"> <span class="st">"deSolve, not compiled"</span> =<span class="st"> </span><span class="kw"><a href="../../reference/mkinfit.html">mkinfit</a></span>(SFO_SFO, FOCUS_<span class="dv">2006</span>_D,</a> -<a class="sourceLine" id="cb5-4" data-line-number="4"> <span class="dt">solution_type =</span> <span class="st">"deSolve"</span>,</a> -<a class="sourceLine" id="cb5-5" data-line-number="5"> <span class="dt">use_compiled =</span> <span class="ot">FALSE</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),</a> -<a class="sourceLine" id="cb5-6" data-line-number="6"> <span class="st">"Eigenvalue based"</span> =<span class="st"> </span><span class="kw"><a href="../../reference/mkinfit.html">mkinfit</a></span>(SFO_SFO, FOCUS_<span class="dv">2006</span>_D,</a> -<a class="sourceLine" id="cb5-7" data-line-number="7"> <span class="dt">solution_type =</span> <span class="st">"eigen"</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),</a> -<a class="sourceLine" id="cb5-8" data-line-number="8"> <span class="st">"deSolve, compiled"</span> =<span class="st"> </span><span class="kw"><a href="../../reference/mkinfit.html">mkinfit</a></span>(SFO_SFO, FOCUS_<span class="dv">2006</span>_D,</a> -<a class="sourceLine" id="cb5-9" data-line-number="9"> <span class="dt">solution_type =</span> <span class="st">"deSolve"</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),</a> -<a class="sourceLine" id="cb5-10" data-line-number="10"> <span class="dt">replications =</span> <span class="dv">3</span>)</a> -<a class="sourceLine" id="cb5-11" data-line-number="11"> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(b<span class="fl">.1</span>)</a> -<a class="sourceLine" id="cb5-12" data-line-number="12"> factor_SFO_SFO <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">round</a></span>(b<span class="fl">.1</span>[<span class="st">"1"</span>, <span class="st">"relative"</span>])</a> -<a class="sourceLine" id="cb5-13" data-line-number="13">} <span class="cf">else</span> {</a> -<a class="sourceLine" id="cb5-14" data-line-number="14"> factor_SFO_SFO <-<span class="st"> </span><span class="ot">NA</span></a> -<a class="sourceLine" id="cb5-15" data-line-number="15"> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(<span class="st">"R package benchmark is not available"</span>)</a> -<a class="sourceLine" id="cb5-16" data-line-number="16">}</a></code></pre></div> +<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" title="1"><span class="cf">if</span> (<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">require</a></span>(rbenchmark)) {</a> +<a class="sourceLine" id="cb5-2" title="2"> b<span class="fl">.1</span> <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/rbenchmark/topics/benchmark">benchmark</a></span>(</a> +<a class="sourceLine" id="cb5-3" title="3"> <span class="st">"deSolve, not compiled"</span> =<span class="st"> </span><span class="kw"><a href="../../reference/mkinfit.html">mkinfit</a></span>(SFO_SFO, FOCUS_<span class="dv">2006</span>_D,</a> +<a class="sourceLine" id="cb5-4" title="4"> <span class="dt">solution_type =</span> <span class="st">"deSolve"</span>,</a> +<a class="sourceLine" id="cb5-5" title="5"> <span class="dt">use_compiled =</span> <span class="ot">FALSE</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),</a> +<a class="sourceLine" id="cb5-6" title="6"> <span class="st">"Eigenvalue based"</span> =<span class="st"> </span><span class="kw"><a href="../../reference/mkinfit.html">mkinfit</a></span>(SFO_SFO, FOCUS_<span class="dv">2006</span>_D,</a> +<a class="sourceLine" id="cb5-7" title="7"> <span class="dt">solution_type =</span> <span class="st">"eigen"</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),</a> +<a class="sourceLine" id="cb5-8" title="8"> <span class="st">"deSolve, compiled"</span> =<span class="st"> </span><span class="kw"><a href="../../reference/mkinfit.html">mkinfit</a></span>(SFO_SFO, FOCUS_<span class="dv">2006</span>_D,</a> +<a class="sourceLine" id="cb5-9" title="9"> <span class="dt">solution_type =</span> <span class="st">"deSolve"</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),</a> +<a class="sourceLine" id="cb5-10" title="10"> <span class="dt">replications =</span> <span class="dv">3</span>)</a> +<a class="sourceLine" id="cb5-11" title="11"> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(b<span class="fl">.1</span>)</a> +<a class="sourceLine" id="cb5-12" title="12"> factor_SFO_SFO <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">round</a></span>(b<span class="fl">.1</span>[<span class="st">"1"</span>, <span class="st">"relative"</span>])</a> +<a class="sourceLine" id="cb5-13" title="13">} <span class="cf">else</span> {</a> +<a class="sourceLine" id="cb5-14" title="14"> factor_SFO_SFO <-<span class="st"> </span><span class="ot">NA</span></a> +<a class="sourceLine" id="cb5-15" title="15"> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(<span class="st">"R package benchmark is not available"</span>)</a> +<a class="sourceLine" id="cb5-16" title="16">}</a></code></pre></div> <pre><code>## Lade nötiges Paket: rbenchmark</code></pre> <pre><code>## test replications elapsed relative user.self sys.self -## 3 deSolve, compiled 3 2.309 1.000 2.307 0 -## 1 deSolve, not compiled 3 17.535 7.594 17.527 0 -## 2 Eigenvalue based 3 2.846 1.233 2.844 0 +## 3 deSolve, compiled 3 2.313 1.000 2.312 0 +## 1 deSolve, not compiled 3 17.602 7.610 17.595 0 +## 2 Eigenvalue based 3 2.853 1.233 2.851 0 ## user.child sys.child ## 3 0 0 ## 1 0 0 @@ -142,26 +142,26 @@ <h2 class="hasAnchor"> <a href="#model-that-can-not-be-solved-with-eigenvalues" class="anchor"></a>Model that can not be solved with Eigenvalues</h2> <p>This evaluation is also taken from the example section of mkinfit.</p> -<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1"><span class="cf">if</span> (<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">require</a></span>(rbenchmark)) {</a> -<a class="sourceLine" id="cb8-2" data-line-number="2"> FOMC_SFO <-<span class="st"> </span><span class="kw"><a href="../../reference/mkinmod.html">mkinmod</a></span>(</a> -<a class="sourceLine" id="cb8-3" data-line-number="3"> <span class="dt">parent =</span> <span class="kw"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"FOMC"</span>, <span class="st">"m1"</span>),</a> -<a class="sourceLine" id="cb8-4" data-line-number="4"> <span class="dt">m1 =</span> <span class="kw"><a href="../../reference/mkinsub.html">mkinsub</a></span>( <span class="st">"SFO"</span>))</a> -<a class="sourceLine" id="cb8-5" data-line-number="5"></a> -<a class="sourceLine" id="cb8-6" data-line-number="6"> b<span class="fl">.2</span> <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/rbenchmark/topics/benchmark">benchmark</a></span>(</a> -<a class="sourceLine" id="cb8-7" data-line-number="7"> <span class="st">"deSolve, not compiled"</span> =<span class="st"> </span><span class="kw"><a href="../../reference/mkinfit.html">mkinfit</a></span>(FOMC_SFO, FOCUS_<span class="dv">2006</span>_D,</a> -<a class="sourceLine" id="cb8-8" data-line-number="8"> <span class="dt">use_compiled =</span> <span class="ot">FALSE</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),</a> -<a class="sourceLine" id="cb8-9" data-line-number="9"> <span class="st">"deSolve, compiled"</span> =<span class="st"> </span><span class="kw"><a href="../../reference/mkinfit.html">mkinfit</a></span>(FOMC_SFO, FOCUS_<span class="dv">2006</span>_D, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),</a> -<a class="sourceLine" id="cb8-10" data-line-number="10"> <span class="dt">replications =</span> <span class="dv">3</span>)</a> -<a class="sourceLine" id="cb8-11" data-line-number="11"> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(b<span class="fl">.2</span>)</a> -<a class="sourceLine" id="cb8-12" data-line-number="12"> factor_FOMC_SFO <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">round</a></span>(b<span class="fl">.2</span>[<span class="st">"1"</span>, <span class="st">"relative"</span>])</a> -<a class="sourceLine" id="cb8-13" data-line-number="13">} <span class="cf">else</span> {</a> -<a class="sourceLine" id="cb8-14" data-line-number="14"> factor_FOMC_SFO <-<span class="st"> </span><span class="ot">NA</span></a> -<a class="sourceLine" id="cb8-15" data-line-number="15"> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(<span class="st">"R package benchmark is not available"</span>)</a> -<a class="sourceLine" id="cb8-16" data-line-number="16">}</a></code></pre></div> +<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" title="1"><span class="cf">if</span> (<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">require</a></span>(rbenchmark)) {</a> +<a class="sourceLine" id="cb8-2" title="2"> FOMC_SFO <-<span class="st"> </span><span class="kw"><a href="../../reference/mkinmod.html">mkinmod</a></span>(</a> +<a class="sourceLine" id="cb8-3" title="3"> <span class="dt">parent =</span> <span class="kw"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"FOMC"</span>, <span class="st">"m1"</span>),</a> +<a class="sourceLine" id="cb8-4" title="4"> <span class="dt">m1 =</span> <span class="kw"><a href="../../reference/mkinsub.html">mkinsub</a></span>( <span class="st">"SFO"</span>))</a> +<a class="sourceLine" id="cb8-5" title="5"></a> +<a class="sourceLine" id="cb8-6" title="6"> b<span class="fl">.2</span> <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/rbenchmark/topics/benchmark">benchmark</a></span>(</a> +<a class="sourceLine" id="cb8-7" title="7"> <span class="st">"deSolve, not compiled"</span> =<span class="st"> </span><span class="kw"><a href="../../reference/mkinfit.html">mkinfit</a></span>(FOMC_SFO, FOCUS_<span class="dv">2006</span>_D,</a> +<a class="sourceLine" id="cb8-8" title="8"> <span class="dt">use_compiled =</span> <span class="ot">FALSE</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),</a> +<a class="sourceLine" id="cb8-9" title="9"> <span class="st">"deSolve, compiled"</span> =<span class="st"> </span><span class="kw"><a href="../../reference/mkinfit.html">mkinfit</a></span>(FOMC_SFO, FOCUS_<span class="dv">2006</span>_D, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),</a> +<a class="sourceLine" id="cb8-10" title="10"> <span class="dt">replications =</span> <span class="dv">3</span>)</a> +<a class="sourceLine" id="cb8-11" title="11"> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(b<span class="fl">.2</span>)</a> +<a class="sourceLine" id="cb8-12" title="12"> factor_FOMC_SFO <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">round</a></span>(b<span class="fl">.2</span>[<span class="st">"1"</span>, <span class="st">"relative"</span>])</a> +<a class="sourceLine" id="cb8-13" title="13">} <span class="cf">else</span> {</a> +<a class="sourceLine" id="cb8-14" title="14"> factor_FOMC_SFO <-<span class="st"> </span><span class="ot">NA</span></a> +<a class="sourceLine" id="cb8-15" title="15"> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(<span class="st">"R package benchmark is not available"</span>)</a> +<a class="sourceLine" id="cb8-16" title="16">}</a></code></pre></div> <pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre> <pre><code>## test replications elapsed relative user.self sys.self -## 2 deSolve, compiled 3 4.071 1.000 4.069 0 -## 1 deSolve, not compiled 3 37.139 9.123 37.123 0 +## 2 deSolve, compiled 3 4.049 1.000 4.047 0 +## 1 deSolve, not compiled 3 37.135 9.171 37.119 0 ## user.child sys.child ## 2 0 0 ## 1 0 0</code></pre> |