aboutsummaryrefslogtreecommitdiff
path: root/docs/articles/compiled_models.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/articles/compiled_models.html')
-rw-r--r--docs/articles/compiled_models.html90
1 files changed, 45 insertions, 45 deletions
diff --git a/docs/articles/compiled_models.html b/docs/articles/compiled_models.html
index 183c9658..17387187 100644
--- a/docs/articles/compiled_models.html
+++ b/docs/articles/compiled_models.html
@@ -84,7 +84,7 @@
<h1>Performance benefit by using compiled model definitions in mkin</h1>
<h4 class="author">Johannes Ranke</h4>
- <h4 class="date">2018-07-18</h4>
+ <h4 class="date">2018-09-06</h4>
<div class="hidden name"><code>compiled_models.Rmd</code></div>
@@ -97,37 +97,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"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">Sys.which</span>(<span class="st">"gcc"</span>)</code></pre></div>
+<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">Sys.which</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"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">library</span>(<span class="st">"mkin"</span>, <span class="dt">quietly =</span> <span class="ot">TRUE</span>)
-SFO_SFO &lt;-<span class="st"> </span><span class="kw"><a href="../reference/mkinmod.html">mkinmod</a></span>(
- <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>),
- <span class="dt">m1 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>))</code></pre></div>
+<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">library</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 &lt;-<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>
<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"><pre class="sourceCode r"><code class="sourceCode r"><span class="cf">if</span> (<span class="kw">require</span>(rbenchmark)) {
- b<span class="fl">.1</span> &lt;-<span class="st"> </span><span class="kw"><a href="http://www.rdocumentation.org/packages/rbenchmark/topics/benchmark">benchmark</a></span>(
- <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,
- <span class="dt">solution_type =</span> <span class="st">"deSolve"</span>,
- <span class="dt">use_compiled =</span> <span class="ot">FALSE</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),
- <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,
- <span class="dt">solution_type =</span> <span class="st">"eigen"</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),
- <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,
- <span class="dt">solution_type =</span> <span class="st">"deSolve"</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),
- <span class="dt">replications =</span> <span class="dv">3</span>)
- <span class="kw">print</span>(b<span class="fl">.1</span>)
- factor_SFO_SFO &lt;-<span class="st"> </span><span class="kw">round</span>(b<span class="fl">.1</span>[<span class="st">"1"</span>, <span class="st">"relative"</span>])
-} <span class="cf">else</span> {
- factor_SFO_SFO &lt;-<span class="st"> </span><span class="ot">NA</span>
- <span class="kw">print</span>(<span class="st">"R package benchmark is not available"</span>)
-}</code></pre></div>
+<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">require</span>(rbenchmark)) {</a>
+<a class="sourceLine" id="cb5-2" data-line-number="2"> b<span class="fl">.1</span> &lt;-<span class="st"> </span><span class="kw"><a href="http://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">print</span>(b<span class="fl">.1</span>)</a>
+<a class="sourceLine" id="cb5-12" data-line-number="12"> factor_SFO_SFO &lt;-<span class="st"> </span><span class="kw">round</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 &lt;-<span class="st"> </span><span class="ot">NA</span></a>
+<a class="sourceLine" id="cb5-15" data-line-number="15"> <span class="kw">print</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>
<pre><code>## Lade nötiges Paket: rbenchmark</code></pre>
<pre><code>## test replications elapsed relative user.self sys.self
-## 3 deSolve, compiled 3 2.044 1.000 2.043 0
-## 1 deSolve, not compiled 3 16.571 8.107 16.565 0
-## 2 Eigenvalue based 3 2.499 1.223 2.496 0
+## 3 deSolve, compiled 3 2.112 1.000 2.110 0
+## 1 deSolve, not compiled 3 16.633 7.875 16.624 0
+## 2 Eigenvalue based 3 2.637 1.249 2.635 0
## user.child sys.child
## 3 0 0
## 1 0 0
@@ -138,31 +138,31 @@ SFO_SFO &lt;-<span class="st"> </span><span class="kw"><a href="../reference/mki
<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"><pre class="sourceCode r"><code class="sourceCode r"><span class="cf">if</span> (<span class="kw">require</span>(rbenchmark)) {
- FOMC_SFO &lt;-<span class="st"> </span><span class="kw"><a href="../reference/mkinmod.html">mkinmod</a></span>(
- <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>),
- <span class="dt">m1 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>( <span class="st">"SFO"</span>))
-
- b<span class="fl">.2</span> &lt;-<span class="st"> </span><span class="kw"><a href="http://www.rdocumentation.org/packages/rbenchmark/topics/benchmark">benchmark</a></span>(
- <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,
- <span class="dt">use_compiled =</span> <span class="ot">FALSE</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>),
- <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>),
- <span class="dt">replications =</span> <span class="dv">3</span>)
- <span class="kw">print</span>(b<span class="fl">.2</span>)
- factor_FOMC_SFO &lt;-<span class="st"> </span><span class="kw">round</span>(b<span class="fl">.2</span>[<span class="st">"1"</span>, <span class="st">"relative"</span>])
-} <span class="cf">else</span> {
- factor_FOMC_SFO &lt;-<span class="st"> </span><span class="ot">NA</span>
- <span class="kw">print</span>(<span class="st">"R package benchmark is not available"</span>)
-}</code></pre></div>
+<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">require</span>(rbenchmark)) {</a>
+<a class="sourceLine" id="cb8-2" data-line-number="2"> FOMC_SFO &lt;-<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> &lt;-<span class="st"> </span><span class="kw"><a href="http://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">print</span>(b<span class="fl">.2</span>)</a>
+<a class="sourceLine" id="cb8-12" data-line-number="12"> factor_FOMC_SFO &lt;-<span class="st"> </span><span class="kw">round</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 &lt;-<span class="st"> </span><span class="ot">NA</span></a>
+<a class="sourceLine" id="cb8-15" data-line-number="15"> <span class="kw">print</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>
<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 3.592 1.000 3.589 0
-## 1 deSolve, not compiled 3 35.340 9.839 35.324 0
+## 2 deSolve, compiled 3 3.720 1.000 3.718 0
+## 1 deSolve, not compiled 3 34.677 9.322 34.661 0
## user.child sys.child
## 2 0 0
## 1 0 0</code></pre>
-<p>Here we get a performance benefit of a factor of 10 using the version of the differential equation model compiled from C code!</p>
-<p>This vignette was built with mkin 0.9.47.1 on</p>
+<p>Here we get a performance benefit of a factor of 9 using the version of the differential equation model compiled from C code!</p>
+<p>This vignette was built with mkin 0.9.47.2 on</p>
<pre><code>## R version 3.5.1 (2018-07-02)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Debian GNU/Linux 9 (stretch)</code></pre>

Contact - Imprint