RcppArmadillo: Accelerating R with high-performance C plus plus linear algebra

被引:276
作者
Eddelbuettel, Dirk
Sanderson, Conrad [1 ,2 ]
机构
[1] NICTA, St Lucia, Qld 4067, Australia
[2] Queensland Univ Technol, Brisbane, Qld 4000, Australia
关键词
Software; R; C plus; Linear algebra; INTEGRATION;
D O I
10.1016/j.csda.2013.02.005
中图分类号
TP39 [计算机的应用];
学科分类号
081203 ; 0835 ;
摘要
The R statistical environment and language has demonstrated particular strengths for interactive development of statistical algorithms, as well as data modelling and visualisation. Its current implementation has an interpreter at its core which may result in a performance penalty in comparison to directly executing user algorithms in the native machine code of the host CPU. In contrast, the C++ language has no built-in visualisation capabilities, handling of linear algebra or even basic statistical algorithms; however, user programs are converted to high-performance machine code, ahead of execution. A new method avoids possible speed penalties in R by using the Rcpp extension package in conjunction with the Armadillo C++ matrix library. In addition to the inherent performance advantages of compiled code, Armadillo provides an easy-to-use template-based meta-programming framework, allowing the automatic pooling of several linear algebra operations into one, which in turn can lead to further speedups. With the aid of Rcpp and Armadillo, conversion of linear algebra centred algorithms from R to C++ becomes straightforward. The algorithms retain the overall structure as well as readability, all while maintaining a bidirectional link with the host R environment. Empirical timing comparisons of R and C++ implementations of a Kalman filtering algorithm indicate a speedup of several orders of magnitude. (C) 2013 Elsevier B.V. All rights reserved.
引用
收藏
页码:1054 / 1063
页数:10
相关论文
共 18 条
[1]  
Abrahams D., 2004, C TEMPLATE METAPROGR
[2]  
[Anonymous], 2013, SEAMLESS R C INTEGRA
[3]  
[Anonymous], 2010, Armadillo: An open source C++ linear algebra library for fast prototyping and computationally intensive experiments"
[4]  
Demmel J.W., 1997, APPL NUMERICAL LINEA
[5]  
Eddelbuettel D., 2012, Rcpp: seamless R and C++ integration
[6]  
Eddelbuettel D, 2011, J STAT SOFTW, V40, P1
[7]  
Francois Romain., 2012, RCPPARMADILLO RCPP I
[8]  
Kurzak J., 2010, SCI COMPUTING MULTIC
[9]   An unscented Kalman smoother for volatility extraction: Evidence from stock prices and options [J].
Li, Junye .
COMPUTATIONAL STATISTICS & DATA ANALYSIS, 2013, 58 :15-26
[10]  
Meyers S., 2005, EFFECTIVE C 55 SPECI