Movatterモバイル変換


[0]ホーム

URL:


RcppEigen: R and Eigen viaRcpp

CILicenseLicenseCRANr-universeDependenciesCoverage StatusDebian packageLast CommitDownloads (monthly)Downloads (total)CRAN useBioConductor useStackOverflowJSS

Synopsis

Eigen isa C++ template library for linear algebra: matrices, vectors, numericalsolvers and related algorithms. It supports dense and sparse matrices oninteger, floating point and complex numbers, decompositions of suchmatrices, and solutions of linear systems. Its performance on manyalgorithms is comparable with some of the best implementations based onLapack and level-3BLAS.

RcppEigen provides an interface from R to and fromEigen byusing the facilities offered by theRcpp package forseamless R and C++ integration.

Examples

A few examples are over at theRcpp Gallery. A simpleone is

#include<RcppEigen.h>// [[Rcpp::depends(RcppEigen)]]using Eigen::Map;// 'maps' rather than copiesusing Eigen::MatrixXd;// variable size matrix, double precisionusing Eigen::VectorXd;// variable size vector, double precisionusing 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 RcppEigenpackage, and to export thegetEigenValues() function – butreadthefull post for details.

Status

The package is mature and under active development, following theEigenrelease cycle.

Documentation

The package contains a pdf vignette which is a pre-print of thepaper by Bates andEddelbuettel in JSS (2013, v52i05).

Authors

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

License

GPL (>= 2)


[8]ページ先頭

©2009-2025 Movatter.jp