<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/rcpparmadillo-0-7-900-2-0/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://dirk.eddelbuettel.com/blog/2017/06/04#rcpparmadillo_0.7.900.2.0"> Thinking inside the box </a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><img alt="armadillo image" src="https://i0.wp.com/arma.sourceforge.net/img/armadillo_logo.png?w=248" data-recalc-dims="1"></p>
<p>The new <a rel="nofollow" href="http://dirk.eddelbuettel.com/code/rcpp.armadillo.html" target="_blank">RcppArmadillo</a> release 0.7.900.2.0 is now on <a rel="nofollow" href="https://cran.r-project.org/" target="_blank">CRAN</a>, and the <a rel="nofollow" href="https://www.debian.org/" target="_blank">Debian</a> package was just updated as well.</p>
<p><a rel="nofollow" href="http://arma.sourceforge.net/" target="_blank">Armadillo</a> is a powerful and expressive C++ template library for linear algebra aiming towards a good balance between speed and ease of use with a syntax deliberately close to a Matlab. <a rel="nofollow" href="http://dirk.eddelbuettel.com/code/rcpp.armadillo.html" target="_blank">RcppArmadillo</a> integrates this library with the <a rel="nofollow" href="https://www.r-project.org/" target="_blank">R</a> environment and language–and is widely used by (currently) 350 other packages on <a rel="nofollow" href="https://cran.r-project.org/" target="_blank">CRAN</a>—an increase of 32 since the last <a rel="nofollow" href="https://cran.r-project.org/" target="_blank">CRAN</a> release of 0.7.800.2.0 in April!</p>
<p>With the 7.900.* series of <a rel="nofollow" href="http://arma.sourceforge.net/" target="_blank">Armadillo</a>, Conrad has started to more fully utilize <a rel="nofollow" href="http://www.openmp.org/" target="_blank">OpenMP</a> (also see <a rel="nofollow" href="https://en.wikipedia.org/wiki/OpenMP" target="_blank">Wikipedia on OpenMP</a>) for operations that can be parallelized. To use this in <em>your package</em> you need to update its <code>src/Makevars{,.win}</code> file similarly to what the skeleton default now uses</p>
<pre><code>PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) 
PKG_LIBS = $(SHLIB_OPENMP_CFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)</code></pre>
<p>and you may want to enable C++11 while you are at it—though this may pose issues with older-than-ancient RHEL installations which are still (way too) pervasive so we do not do it by default (yet).</p>
<p>Here, we once again rely on the build infrastructure automagically provided by R itself: if and when <a rel="nofollow" href="http://www.openmp.org/" target="_blank">OpenMP</a> is available, R will use it via <code>$(SHLIB_OPENMP_CXXFLAGS)</code> etc; see the <a rel="nofollow" href="https://cran.r-project.org/doc/manuals/r-release/R-exts.html#OpenMP-support" target="_blank">fine WRE manual for details</a>. That said, some operating systems make this harder than other, and macOS usually takes the crown. See for example <a rel="nofollow" href="http://thecoatlessprofessor.com/programming/openmp-in-r-on-os-x/" target="_blank">this blog post by James</a> for surviving in that environment. I am a little short of details because on Linux these things just work, and have for well over a decade. The <a rel="nofollow" href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">rcpp-devel mailing list</a> will be the best place for questions.</p>
<p>Changes in this release relative to the previous <a rel="nofollow" href="http://cran.r-project.org/" target="_blank">CRAN</a> release are as follows:</p>
<blockquote>
<h4>Changes in RcppArmadillo version 0.7.900.2.0 (2017-06-02)</h4>
<ul>
<li>
<p>Upgraded to Armadillo release 7.900.2 (Evil Banana Republic)</p>
<ul>
<li>
<p>Expanded <code>clamp()</code> to handle cubes</p>
</li>
<li>
<p>Computationally expensive element-wise functions (such as <code>exp()</code>, <code>log()</code>, <code>cos()</code>, etc) can now be automatically sped up via OpenMP; this requires a C++11/C++14 compiler with OpenMP 3.0+ support for GCC and clang compilers</p>
</li>
<li>
<p>One caveat: when using GCC, use of <code>-march=native</code> in conjunction with <code>-fopenmp</code> may lead to speed regressions on recent processors</p>
</li>
</ul>
</li>
<li>
<p>Added gcc 7 to support compiler check (James Balamuta in <a rel="nofollow" href="https://github.com/RcppCore/RcppArmadillo/pull/128" target="_blank">#128</a> addressing <a rel="nofollow" href="https://github.com/RcppCore/RcppArmadillo/issues/126" target="_blank">#126</a>).</p>
</li>
<li>
<p>A unit test helper function for <code>rmultinom</code> was corrected (<a rel="nofollow" href="https://github.com/RcppCore/RcppArmadillo/pull/133" target="_blank">#133</a>).</p>
</li>
<li>
<p>OpenMP support was added to the skeleton helper in <code>inline.R</code></p>
</li>
</ul>
</blockquote>
<p>Courtesy of <a rel="nofollow" href="http://dirk.eddelbuettel.com/cranberries/" target="_blank">CRANberries</a>, there is a <a rel="nofollow" href="http://dirk.eddelbuettel.com/cranberries/2017/06/04#RcppArmadillo_0.7.900.2.0" target="_blank">diffstat report</a>. More detailed information is on the <a rel="nofollow" href="http://dirk.eddelbuettel.com/code/rcpp.armadillo.html" target="_blank">RcppArmadillo page</a>. Questions, comments etc should go to the <a rel="nofollow" href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">rcpp-devel mailing list</a> off the <a rel="nofollow" href="http://r-forge.r-project.org/projects/rcpp/" target="_blank">R-Forge</a> page.</p>
<p>
This post by <a rel="nofollow" href="http://dirk.eddelbuettel.com/" target="_blank">Dirk Eddelbuettel</a> originated on his <a rel="nofollow" href="http://dirk.eddelbuettel.com/blog/" target="_blank">Thinking inside the box</a> blog. Please report excessive re-aggregation in third-party for-profit settings.</p>
<p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://dirk.eddelbuettel.com/blog/2017/06/04#rcpparmadillo_0.7.900.2.0"> Thinking inside the box </a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...

	<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/ZakpQGQ9OSs" height="1"></a></div>