Skip to content

RcppCore/RcppEigen

Folders and files

NameName
Last commit message
Last commit date
Apr 4, 2025
Jul 20, 2023
Aug 24, 2024
Dec 5, 2020
Feb 29, 2024
Feb 29, 2024
Oct 31, 2019
May 24, 2019
Jun 7, 2021
Jan 16, 2022
Jun 6, 2021
Mar 29, 2020
Mar 14, 2017
Apr 4, 2025
Aug 24, 2024
Dec 18, 2013
Oct 6, 2023
May 16, 2024
Jun 15, 2011

Repository files navigation

RcppEigen: R and Eigen via Rcpp

CI License License CRAN r-universe Dependencies Coverage Status Debian package Last Commit Downloads (monthly) Downloads (total) CRAN use BioConductor use StackOverflow JSS

Synopsis

Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers and related algorithms. It supports dense and sparse matrices on integer, floating point and complex numbers, decompositions of such matrices, and solutions of linear systems. Its performance on many algorithms is comparable with some of the best implementations based on Lapack and level-3 BLAS.

RcppEigen provides an interface from R to and from Eigen by using the facilities offered by the Rcpp package for seamless R and C++ integration.

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.

Status

The package is mature and under active development, following the Eigen release cycle.

Documentation

The package contains a pdf vignette which is a pre-print of the paper by Bates and Eddelbuettel in JSS (2013, v52i05).

Authors

Douglas Bates, Dirk Eddelbuettel, Romain Francois, and Yixuan Qiu

License

GPL (>= 2)

About

Rcpp integration for the Eigen templated linear algebra library

Topics

Resources

License

Citation

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 14