RcppEigen

RcppEigen provides an interface from R to and from Eigen, a performant C++ template library for linear algebra, matrices, vectors, numerical solvers, and related algorithms. RcppEigen uses the Rcpp interface between R and C++.

Are there examples?

A few examples are over at the Rcpp Gallery. A simple one is

#include <RcppEigen.h>

// [[Rcpp::depends(RcppEigen)]]

using Eigen::Map;                       // 'maps' rather than copies
using Eigen::MatrixXd;                  // variable size matrix, double precision
using Eigen::VectorXd;                  // variable size vector, double precision
using Eigen::SelfAdjointEigenSolver;    // one of the eigenvalue solvers

// [[Rcpp::export]]
VectorXd getEigenValues(Map<MatrixXd> M) {
    SelfAdjointEigenSolver<MatrixXd> es(M);
    return es.eigenvalues();
}

which can be turned into a function callable from R via a simple

sourceCpp("eigenExample.cpp")

due to the two Rcpp directives to use headers from the RcppEigen package, and to export the getEigenValues() function -- but read the full post for details.

Is there more documentation?

The package is described in a Journal of Statistical Software paper. A preprint of the paper is included as the vignette.

Where do I get it?

The package is on CRAN

It is now also available via CRAN so

R> install.packages("RcppEigen")

should work. The source code repository on GitHub is available too.

Authors

RcppEigen is written by Doug Bates, Romain Francois, Dirk Eddelbuettel and Yixuan Qiu. It is maintained by Dirk Eddelbuettel.

License

RcppEigen is licensed under the GNU GPL version 2 or later. It includes Eigen which is (mostly) released under the Mozilla Public License (version 2).

Initially created: Thu Mar 11 11:14:31 CST 2010
Last modified: Thu Dec 22 10:40:10 CST 2016