Description Details Caution Using RcppBlaze Author(s) References
RcppBlaze construct a bridge between R and Blaze.
'Blaze' is an open-source, high-performance C++ math library for dense and sparse arithmetic. With its state-of-the-art Smart Expression Template implementation Blaze combines the elegance and ease of use of a domain-specific language with HPC-grade performance, making it one of the most intuitive and fastest C++ math libraries available. The Blaze library offers:
high performance through the integration of BLAS libraries and manually tuned HPC math kernels
vectorization by SSE, SSE2, SSE3, SSSE3, SSE4, AVX, AVX2, AVX-512, FMA, and SVML
parallel execution by OpenMP, C++11 threads and Boost threads (Boost threads is disables in RcppBlaze)
the intuitive and easy to use API of a domain specific language
unified arithmetic with dense and sparse vectors and matrices
thoroughly tested matrix and vector arithmetic
completely portable, high quality C++ source code
The RcppBlaze package includes the header files from the Blaze library with disabling some functionalities related to link to the thread and system libraries which make RcppBlaze be a header-only library. Therefore, users do not need to install Blaze and the dependency Boost. Blaze is licensed under the New (Revised) BSD license, while RcppBlaze (the Rcpp bindings/bridge to Blaze) is licensed under the GNU GPL version 2 or later, as is the rest of Rcpp.
Note that since Blaze has committed to C++14 which does not used by most R users from version 3.0, we will use the version 2.6 of Blaze which is C++98 compatible to support the most compilers and system.
On the windows x64 with Rtools33, Rtools34, std::ptrdiff_s
is defined as long long unsigned int
,
so do not direct wrap the dimention of matrix or the size of vector to output in case the compiling error occurs.
The simplest way to get started is to create a skeleton of a package
using RcppBlaze
. This can be done conveniently by the
RcppBlaze.package.skeleton
function.
The important steps are
Include the RcppBlaze.h header file, which also includes blaze/Blaze.h.
Import Rcpp
, LinkingTo Rcpp
, BH
and RcppBlaze
by adding these lines to the DESCRIPTION file:
Imports: Rcpp (>= 0.11.0) LinkingTo: Rcpp, BH, RcppBlaze
Link against the BLAS
and LAPACK
libraries, by adding following two lines in the Makevars and
Makevars.win files:
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
For RcppBlaze: Chingchuan Chen Maintainer: Chingchuan Chen <zw12356@gmail.com> For blaze: Klaus Iglberger, Georg Hager, Christian Godenschwager, Tobias Scharpff
Blaze project: https://bitbucket.org/blaze-lib/blaze
K. Iglberger, G. Hager, J. Treibig, and U. Ruede: Expression Templates Revisited: A Performance Analysis of Current Methodologies. SIAM Journal on Scientific Computing, 34(2): C42–C69, 2012
K. Iglberger, G. Hager, J. Treibig, and U. Ruede: High Performance Smart Expression Template Math Libraries. Proceedings of the 2nd International Workshop on New Algorithms and Programming Models for the Manycore Era (APMM 2012) at HPCS 2012
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.