Skip to content

Commit 903e7e9

Browse files
committed
small updates to dmvnorm_arma
1 parent 7f14258 commit 903e7e9

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

_posts/2013-07-13-dmvnorm_arma.md

+12-7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: Faster Multivariate Normal densities with RcppArmadillo and OpenMP
33
author: Nino Hardt, Dicko Ahmadou, Benjamin Christoffersen
44
license: GPL (>= 2)
55
tags: armadillo openmp featured
6+
updated: Feb 2, 2020
67
summary: Fast implementation of Multivariate Normal density using RcppArmadillo and OpenMP.
78
layout: post
89
src: 2013-07-13-dmvnorm_arma.Rmd
@@ -179,6 +180,10 @@ variables for us:
179180
// [[Rcpp::plugins(openmp)]]
180181
{% endhighlight %}
181182

183+
When used in a package, the standard `src/Makevars` supplied by the package
184+
ensures the variable `$(SHLIB_OPENMP_CXXFLAGS)` is used. It relies on the R
185+
configuration to automatically add OpenMP support where available.
186+
182187
We also need to set the number of cores to be used before running the
183188
compiled functions. One way is to use `detectCores()` from the `parallel`
184189
package.
@@ -335,13 +340,13 @@ benchmark(
335340

336341
<pre class="output">
337342
test replications elapsed relative
338-
4 dmvnrm_arma_mc 100 0.931 1.000
339-
6 dmvnrm_arma_fast 100 3.617 3.885
340-
3 dmvnrm_arma 100 5.572 5.985
341-
5 dmvnrm_arma_old 100 7.739 8.313
342-
2 dmvnorm_arma 100 9.219 9.902
343-
7 dMvn 100 12.453 13.376
344-
1 dmvnorm 100 14.326 15.388
343+
4 dmvnrm_arma_mc 100 0.875 1.000
344+
6 dmvnrm_arma_fast 100 3.622 4.139
345+
3 dmvnrm_arma 100 5.274 6.027
346+
5 dmvnrm_arma_old 100 7.433 8.495
347+
2 dmvnorm_arma 100 8.649 9.885
348+
7 dMvn 100 12.563 14.358
349+
1 dmvnorm 100 14.637 16.728
345350
</pre>
346351

347352
Lastly, we show that the functions yield the same results:

src/2013-07-13-dmvnorm_arma.Rmd

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: Faster Multivariate Normal densities with RcppArmadillo and OpenMP
33
author: Nino Hardt, Dicko Ahmadou, Benjamin Christoffersen
44
license: GPL (>= 2)
55
tags: armadillo openmp featured
6+
updated: Feb 2, 2020
67
summary: Fast implementation of Multivariate Normal density using RcppArmadillo and OpenMP.
78
---
89

@@ -173,6 +174,10 @@ variables for us:
173174
// [[Rcpp::plugins(openmp)]]
174175
```
175176

177+
When used in a package, the standard `src/Makevars` supplied by the package
178+
ensures the variable `$(SHLIB_OPENMP_CXXFLAGS)` is used. It relies on the R
179+
configuration to automatically add OpenMP support where available.
180+
176181
We also need to set the number of cores to be used before running the
177182
compiled functions. One way is to use `detectCores()` from the `parallel`
178183
package.

0 commit comments

Comments
 (0)