[Rcpp-commits] r3349 - in pkg/RcppEigen: inst/doc vignettes
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Nov 14 20:32:29 CET 2011
Author: dmbates
Date: 2011-11-14 20:32:28 +0100 (Mon, 14 Nov 2011)
New Revision: 3349
Added:
pkg/RcppEigen/inst/doc/Rcpp.bib
pkg/RcppEigen/inst/doc/RcppEigen-intro-jss.tex
Removed:
pkg/RcppEigen/vignettes/Rcpp.bib
pkg/RcppEigen/vignettes/RcppEigen-intro-jss.tex
Log:
Move vignette sources back into inst/doc
Copied: pkg/RcppEigen/inst/doc/Rcpp.bib (from rev 3345, pkg/RcppEigen/vignettes/Rcpp.bib)
===================================================================
--- pkg/RcppEigen/inst/doc/Rcpp.bib (rev 0)
+++ pkg/RcppEigen/inst/doc/Rcpp.bib 2011-11-14 19:32:28 UTC (rev 3349)
@@ -0,0 +1,491 @@
+ at String{CRAN = "http://CRAN.R-Project.org/" }
+ at String{manuals = CRAN # "doc/manuals/" }
+ at String{RCoreTeam = "{R Development Core Team}" }
+ at String{RFoundation = "R Foundation for Statistical Computing" }
+ at String{R-Forge = "http://R-Forge.R-Project.org/" }
+
+ at Misc{cpp11,
+ author = "ISO/IEC",
+ organization = "{International Organization for Standardization}",
+ title = "C++ 2011 Standard Document 14882:2011",
+ howpublished = {ISO/IEC Standard Group for Information Technology / Programming Languages / C++},
+ year = 2011,
+ url = "http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=50372",
+ urlansi = "http://webstore.ansi.org/RecordDetail.aspx?sku=ISO/IEC%2014882:2011"
+}
+
+ at manual{Abrahams+Grosse-Kunstleve:2003:Boost.Python,
+ author = { David Abrahams and Ralf W. Grosse-Kunstleve },
+ organization = "Boost Consulting",
+ title = "Building Hybrid Systems with Boost.Python",
+ year = 2003,
+ url = "http://www.boostpro.com/writing/bpl.pdf"
+}
+
+ at Book{Abrahams+Gurtovoy:2004:TemplateMetaprogramming,
+ author = {David Abrahams and Aleksey Gurtovoy},
+ title = {{C++} {T}emplate {M}etaprogramming: Concepts, Tools
+ and Techniques from {B}oost and Beyond},
+ publisher = {Addison-Wesley},
+ year = 2004,
+ address = {Boston}
+}
+
+ at Manual{Armstrong:2009:RAbstraction,
+ title = {{RAbstraction}: {C++} abstraction for {R} objects},
+ author = {Whit Armstrong},
+ year = 2009,
+ note = {Code repository last updated 2009-07-22.},
+ url = {http://github.com/armstrtw/rabstraction}
+}
+
+ at Manual{Armstrong:2009:RObjects,
+ title = {{RObjects}: {C++} wrapper for R objects (a better
+ implementation of {RAbstraction}},
+ author = {Whit Armstrong},
+ year = 2009,
+ note = {Code repository last updated 2009-11-28.},
+ url = {http://github.com/armstrtw/RObjects}
+}
+
+ at InProceedings{Bates+DebRoy:2001:C++Classes,
+ author = {Douglas M. Bates and Saikat DebRoy},
+ title = {{C++} Classes for {R} Objects},
+ booktitle = {Proceedings of the 2nd International Workshop on Distributed
+ Statistical Computing, March 15--17, 2001, Technische
+ Universit\"at Wien, Vienna, Austria},
+ editor = {Kurt Hornik and Friedrich Leisch},
+ year = {2001},
+ url = {http://www.ci.tuwien.ac.at/Conferences/DSC-2001/Proceedings/},
+ note = {ISSN 1609-395X}
+}
+
+
+ at Misc{Brokken:2011:Cpp,
+ author = {Frank B. Brokken},
+ title = {C++ Annotations},
+ howpublished = {Electronic book, University of Groningen},
+ year = 2011,
+ url = {http://www.icce.rug.nl/documents/cplusplus/}
+}
+
+ at Book{Chambers:2008:SoDA,
+ author = {John M. Chambers},
+ title = {Software for Data Analysis: Programming with {R}},
+ publisher = {Springer-Verlag},
+ year = 2008,
+ series = {Statistics and Computing},
+ address = {Heidelberg},
+ note = {{ISBN} 978-0-387-75935-7}
+}
+
+ at Manual{CRAN:RInside,
+ title = {RInside: C++ classes to embed R in C++ applications},
+ author = {Dirk Eddelbuettel and Romain Fran\c{c}ois},
+ year = 2010,
+ note = {R package version 0.2.3},
+ url = CRAN # "package=RInside"
+}
+
+ at Manual{CRAN:RProtoBuf,
+ title = {RProtoBuf: R Interface to the Protocol Buffers API},
+ author = {Romain Fran\c{c}ois and Dirk Eddelbuettel},
+ year = 2011,
+ note = {R package version 0.2.3},
+ url = CRAN # "package=RProtoBuf"
+}
+
+ at Manual{CRAN:RQuantLib,
+ title = {RQuantLib: {R} interface to the {QuantLib} library},
+ author = {Dirk Eddelbuettel and Khanh Nguyen},
+ year = 2011,
+ note = {R package version 0.3.6},
+ url = CRAN # "package=RQuantLib"
+}
+
+ at Article{JSS:Rcpp,
+ title = {{Rcpp}: Seamless {R} and {C++} Integration},
+ author = {Dirk Eddelbuettel and Romain Fran\c{c}ois},
+ journal = {Journal of Statistical Software},
+ year = 2011,
+ volume = 40,
+ number = 8,
+ pages = {1--18},
+ url = {http://www.jstatsoft.org/v40/i08/},
+}
+
+ at Manual{CRAN:Rcpp,
+ title = {{Rcpp}: Seamless {R} and {C++} Integration},
+ author = {Dirk Eddelbuettel and Romain Fran\c{c}ois},
+ year = 2011,
+ note = {R package version 0.9.4},
+ url = CRAN # "package=Rcpp"
+}
+
+ at Manual{CRAN:RcppArmadillo,
+ title = {RcppArmadillo: Rcpp integration for Armadillo
+ templated linear algebra library},
+ author = {Romain Fran\c{c}ois and Dirk Eddelbuettel and
+ Douglas Bates},
+ year = 2011,
+ note = {R package version 0.2.18},
+ url = CRAN # "package=RcppArmadillo"
+}
+
+ at Manual{CRAN:RcppClassic,
+ title = {RcppClassic: Deprecated 'classic' Rcpp API},
+ author = {Dirk Eddelbuettel and Romain Fran\c{c}ois},
+ year = 2011,
+ note = {R package version 0.9.1},
+ url = CRAN # "package=RcppClassic"
+}
+
+ at Manual{CRAN:RcppDE,
+ title = {RcppDE: Global optimization by differential evolution in C++},
+ author = {Dirk Eddelbuettel},
+ year = 2010,
+ note = {R package version 0.1.0},
+ url = CRAN # "package=RcppDE"
+}
+
+ at Manual{CRAN:RcppExamples,
+ title = {RcppExamples: Examples using {Rcpp} to interface {R}
+ and {C++}},
+ author = {Dirk Eddelbuettel and Romain Fran\c{c}ois},
+ year = 2010,
+ note = {R package version 0.1.2},
+ url = CRAN # "package=RcppExamples"
+}
+
+ at Manual{CRAN:RcppGSL,
+ title = {RcppGSL: Rcpp integration for GNU GSL vectors and matrices},
+ author = {Romain Fran\c{c}ois and Dirk Eddelbuettel},
+ year = 2011,
+ note = {R package version 0.1.1},
+ url = CRAN # "package=RcppGSL"
+}
+
+ at Manual{CRAN:Rserve,
+ title = {Rserve: Binary R server},
+ author = {Simon Urbanek},
+ year = 2011,
+ note = {R package version 0.6-3},
+ url = CRAN # "package=Rserve"
+}
+
+ at Manual{CRAN:cxxPack,
+ title = {cxxpack: {R/C++} Tools for Literate Statistical
+ Practice},
+ author = {Dominick Samperi},
+ year = 2010,
+ note = {R package version 7.0.6},
+ url = CRAN # "package=cxxPack"
+}
+
+ at Manual{CRAN:highlight,
+ title = {highlight: Syntax highlighter},
+ author = {Romain Fran\c{c}ois},
+ year = 2010,
+ note = {R package version 0.2-5},
+ url = CRAN # "package=highlight"
+}
+
+ at Manual{CRAN:inline,
+ title = {inline: Inline C, C++, Fortran function calls from
+ R},
+ author = {Oleg Sklyar and Duncan Murdoch and Mike Smith and
+ Dirk Eddelbuettel and Romain Fran\c{c}ois},
+ year = 2010,
+ note = {R package version 0.3.8},
+ url = CRAN # "package=inline"
+}
+
+ at Manual{CRAN:Matrix,
+ title = {Matrix: Sparse and Dense Matrix Classes and Methods},
+ author = {Douglas Bates and Martin Maechler},
+ year = 2011,
+ note = {R package version 1.0-2},
+ url = CRAN # "package=Matrix"
+}
+
+ at Manual{CRAN:minqa,
+ title = {minqa: Derivative-free optimization algorithms by
+ quadratic approximation},
+ author = {Douglas Bates and Katharine M. Mullen and John
+ C. Nash and Ravi Varadhan},
+ year = 2011,
+ note = {R package version 1.1.15},
+ url = CRAN # "package=minqa"
+}
+
+ at Manual{CRAN:rbenchmark,
+ title = {rbenchmark: Benchmarking routine for R},
+ author = {Wacek Kusnierczyk},
+ year = 2010,
+ note = {R package version 0.3},
+ url = CRAN # "package=rbenchmark"
+}
+
+; see http://eigen.tuxfamily.org/index.php?title=BibTeX
+; replaced 'howpublished' with 'url' and updated year to 2011
+ at MISC{Eigen:Web,
+ author = {Ga\"{e}l Guennebaud and Beno\^{i}t Jacob and others},
+ title = {Eigen v3},
+ year = 2011,
+ url = {http://eigen.tuxfamily.org},
+}
+
+ at Article{Gropp+Lusk+Doss+Skjellum:1996:MPI,
+ author = {William Gropp and Ewing Lusk and Nathan Doss and Anthony Skjellum},
+ title = {A high-performance, portable implementation of the {MPI} message passing interface standard},
+ journal = {Parallel Computing},
+ year = 1996,
+ url = {http://dx.doi.org/10.1016/0167-8191(96)00024-5},
+ volume = 22,
+ number = 6,
+ pages = {789--828}
+}
+
+ at Book{Gropp+Lusk+Skjellum:1999:MPI,
+ author = {William Gropp and Ewing Lusk and Anthony Skjellum},
+ title = {Using {MPI}: Portable Parallel Programming with the Message Passing Interface},
+ publisher = {MIT Press},
+ year = 1999,
+ series = {Scientific and Engineering Computation Series},
+ edition = {2nd},
+ month = {November},
+ note = {{ISBN} 978-0-262-57132-6}}
+
+ at Manual{GSL,
+ title = {{GNU} {S}cientific {L}ibrary {R}eference {M}anual},
+ author = {Mark Galassi and Jim Davies and James Theiler and Brian Gough and Gerard Jungman and Patrick Alken and Michael Booth and Fabrice Rossi},
+ year = {2010},
+ edition = {3rd},
+ note = {Version 1.14. {ISBN} 0954612078},
+ url = {http://www.gnu.org/software/gsl}
+}
+
+ at Unpublished{Java+Gaile+Manly:2007:RCpp,
+ author = {James J. Java and Daniel P. Gaile and Kenneth
+ E. Manly},
+ title = {{R/Cpp}: Interface Classes to Simplify Using {R}
+ Objects in {C++} Extensions},
+ note = {Unpublished manuscript, University at Buffalo},
+ url =
+ {http://sphhp.buffalo.edu/biostat/research/techreports/UB_Biostatistics_TR0702.pdf},
+ month = {July},
+ year = 2007
+}
+
+ at InProceedings{Leisch:2008:Tutorial,
+ author = {Friedrich Leisch},
+ title = {Tutorial on {C}reating \proglang{R} {P}ackages},
+ booktitle = {COMPSTAT 2008 -- Proceedings in Computational
+ Statistics},
+ year = 2008,
+ editor = {Paula Brito},
+ address = {Heidelberg},
+ publisher = {Physica Verlag},
+ url = CRAN # "doc/contrib/Leisch-CreatingPackages.pdf"
+}
+
+ at Manual{Liang:2008:rcppbind,
+ title = {rcppbind: {A} template library for R/C++ developers},
+ author = {Gang Liang},
+ year = 2008,
+ note = {R package version 1.0},
+ url = R-Forge # "projects/rcppbind"
+}
+
+ at Book{Lippman+Lajoie+Moo:2005:Cpp_Primer,
+ author = {Stanley B. Lippman and Jos\'{e}e Lajoie and Barbara E. Moo},
+ title = {The C++ Primer},
+ publisher = {Addison-Wesley},
+ address = {Boston},
+ year = 2005,
+ edition = {4th}
+}
+
+ at book{Meyers:1995:MoreEffectiveC++,
+ author = {Scott Meyers},
+ title = {More Effective C++: 35 New Ways to Improve Your
+ Programs and Designs},
+ year = 1995,
+ note = {{ISBN} 020163371X},
+ publisher = {Addison-Wesley},
+ address = {Boston}
+}
+
+ at book{Meyers:2001:EffectiveSTL,
+ author = {Scott Meyers},
+ title = {Effective STL: 50 specific ways to improve your use
+ of the standard template library},
+ year = 2001,
+ note = {{ISBN} 0-201-74962-9},
+ publisher = {Addison-Wesley},
+ address = {Essex}
+}
+
+ at book{Meyers:2005:EffectiveC++,
+ author = {Scott Meyers},
+ title = {Effective C++: 55 Specific Ways to Improve Your
+ Programs and Designs},
+ year = 2005,
+ note = {{ISBN} 978-0321334879},
+ publisher = {Addison-Wesley},
+ address = {Boston},
+ edition = {3rd},
+}
+
+ at Book{Plauger+Et+Al:2000:STL,
+ author = {P.J. Plauger and Alexander Stepanov and Meng Lee and
+ David R. Musser},
+ title = {The {C++} Standard Template Library},
+ publisher = {Prentice Hall PTR},
+ year = 2000,
+ note = {{ISBN} 978-0134376332},
+}
+
+ at manual{R:Administration,
+ author = RCoreTeam,
+ organization = RFoundation,
+ address = {Vienna, Austria},
+ year = 2010,
+ title = "R Installation and Administration",
+ note = {{ISBN} 3-900051-09-7},
+ url = manuals # "R-admin.html"
+}
+
+ at manual{R:Extensions,
+ author = RCoreTeam,
+ organization = RFoundation,
+ address = {Vienna, Austria},
+ year = 2011,
+ title = "Writing R extensions",
+ note = {{ISBN} 3-900051-11-9},
+ url = manuals # "R-exts.html"
+}
+
+ at manual{R:Internals,
+ author = RCoreTeam,
+ organization = RFoundation,
+ address = {Vienna, Austria},
+ year = 2011,
+ title = "R internals",
+ note = {{ISBN} 3-900051-14-3},
+ url = manuals # "R-ints.html"
+}
+
+ at manual{R:Main,
+ title = {R: A Language and Environment for Statistical
+ Computing},
+ author = RCoreTeam,
+ organization = RFoundation,
+ address = {Vienna, Austria},
+ year = 2011,
+ note = {{ISBN} 3-900051-07-0},
+ url = {http://www.R-project.org/},
+}
+
+ at manual{R:Language,
+ author = RCoreTeam,
+ organization = RFoundation,
+ address = {Vienna, Austria},
+ year = 2011,
+ title = "R language",
+ note = {{ISBN} 3-900051-13-5},
+ url = manuals # "R-lang.html"
+}
+
+ at InProceedings{Runnalls:2009:CXXR,
+ author = {Andrew Runnalls},
+ title = {Aspects of {CXXR} internals},
+ booktitle = {Directions in Statistical Computing},
+ address = {University of Copenhagen, Denmark},
+ year = 2009
+}
+
+ at Manual{Samperi:2009:RcppTemplate,
+ title = {RcppTemplate: Rcpp {R/C++} Object Mapping Library
+ and Package Template},
+ author = {Dominick Samperi},
+ year = 2009,
+ note = {(Archived) R package version 6.1},
+ url = CRAN # "/src/contrib/Archive/RcppTemplate"
+}
+
+ at TechReport{Sanderson:2010:Armadillo,
+ author = {Conrad Sanderson},
+ title = {{Armadillo}: {An} open source {C++} Algebra Library
+ for Fast Prototyping and Computationally Intensive
+ Experiments },
+ institution = {{NICTA}},
+ year = 2010,
+ url = "http://arma.sf.net"
+}
+
+ at Book{Stroustrup:1997:Cpp,
+ author = {Bjarne Stroustrup},
+ title = {The C++ Programming Language},
+ publisher = {Addison-Wesley},
+ address = {Boston},
+ year = 1997,
+ edition = {3rd}
+}
+
+ at Article{TempleLang:2009:ModestProposal,
+ author = {Duncan {Temple Lang}},
+ title = {A modest proposal: an approach to making the
+ internal {R} system extensible},
+ journal = {Computational Statistics},
+ year = 2009,
+ volume = 24,
+ number = 2,
+ pages = {271-281},
+ month = {May}
+}
+
+ at Article{TempleLang:2009:RGCCTranslationUnit,
+ author = {Duncan {Temple Lang}},
+ title = {Working with meta-data from {C/C++} code in {R}: the
+ {RGCCTranslationUnit} package},
+ journal = {Computational Statistics},
+ year = 2009,
+ volume = 24,
+ number = 2,
+ pages = {283-293},
+ month = {May}
+}
+
+ at InProceedings{Urbanek:2003:Rserve,
+ author = {Simon Urbanek},
+ title = {{Rserve}: A Fast Way to Provide {R} Functionality to
+ Applications},
+ booktitle = {Proceedings of the 3rd International Workshop on Distributed
+ Statistical Computing, Vienna, Austria},
+ editor = {Kurt Hornik and Friedrich Leisch and Achim Zeileis},
+ year = {2003},
+ url = {http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Proceedings/},
+ note = {{ISSN 1609-395X}}
+}
+
+ at Book{Vandevoorde+Josuttis:2003:Templates,
+ author = {David Vandevoorde and Nicolai M. Josuttis},
+ title = {{C++} {T}emplates: The Complete Guide},
+ publisher = {Addison-Wesley},
+ year = 2003,
+ address = {Boston}
+}
+
+ at inproceedings{Veldhuizen:1998:Blitz,
+ author = {Todd L. Veldhuizen},
+ title = {Arrays in {Blitz++}},
+ booktitle = {ISCOPE '98: Proceedings of the Second International
+ Symposium on Computing in Object-Oriented Parallel
+ Environments},
+ note = {{ISBN} 3-540-65387-2},
+ year = 1998,
+ pages = {223--230},
+ publisher = {Springer-Verlag},
+ address = {London},
+}
Copied: pkg/RcppEigen/inst/doc/RcppEigen-intro-jss.tex (from rev 3348, pkg/RcppEigen/vignettes/RcppEigen-intro-jss.tex)
===================================================================
--- pkg/RcppEigen/inst/doc/RcppEigen-intro-jss.tex (rev 0)
+++ pkg/RcppEigen/inst/doc/RcppEigen-intro-jss.tex 2011-11-14 19:32:28 UTC (rev 3349)
@@ -0,0 +1,1557 @@
+
+\documentclass[shortnames,article,nojss]{jss}
+%\VignetteIndexEntry{RcppEigen-intro}
+%\VignetteKeywords{linear algebra, template programming, C++, R, Rcpp}
+%\VignettePackage{RcppEigen}
+
+%\usepackage{booktabs,flafter,bm,amsmath}
+\usepackage{booktabs,bm,amsmath}
+
+\newcommand{\R}{\proglang{R}\ } % NB forces a space so not good before % fullstop etc.
+\newcommand{\Cpp}{\proglang{C++}\ }
+
+\author{Douglas Bates\\Univ.~of Wisconsin/Madison \And Dirk Eddelbuettel\\Debian Project} % \And Romain Fran\c{c}ois\\R Enthusiasts}
+\title{Fast and Elegant Numerical Linear Algebra\\ Using the \pkg{RcppEigen} Package}
+
+\Plainauthor{Douglas Bates, Dirk Eddelbuettel} %, Romain Fran\c{c}ois}
+\Plaintitle{Fast and Elegant Numerical Linear Algebra Using the RcppEigen Package}
+\Shorttitle{Fast and Elegant Numerical Linear Algebra with RcppEigen}
+
+\Abstract{
+ \noindent
+ The \pkg{RcppEigen} package provides access from \proglang{R}
+ \citep{R:Main} to the \pkg{Eigen} \citep*{Eigen:Web} \proglang{C++}
+ template library for numerical linear algebra. \pkg{Rcpp}
+ \citep{JSS:Rcpp,CRAN:Rcpp} classes and specializations of the
+ \proglang{C++} templated functions \code{as} and \code{wrap} from
+ \pkg{Rcpp} provide the ``glue'' for passing objects from
+ \proglang{R} to \proglang{C++} and back. Several introductory
+ examples are presented. This is followed by an in-depth discussion of various
+ available approaches for solving least-squares problems, including
+ rank-revealing methods, concluding with an empirical run-time
+ comparison. Last but not least, sparse matrix methods are discussed.
+}
+
+\Keywords{Linear algebra, template programming, \proglang{R}, \proglang{C++}, \pkg{Rcpp}} %% at least one keyword must be supplied
+\Plainkeywords{Linear algebra, template programmig, R, C++, Rcpp} %% without formatting
+
+\Address{
+ Douglas Bates \\
+ Department of Statistics \\
+ University of Wisconsin - Madison \\
+ Madison, WI, USA \\
+ E-mail: \email{bates at stat.wisc.edu} \\
+ URL: \url{http://www.stat.wisc.edu/~bates/}\\
+
+ Dirk Eddelbuettel \\
+ Debian Project \\
+ River Forest, IL, USA\\
+ E-mail: \email{edd at debian.org}\\
+ URL: \url{http://dirk.eddelbuettel.com}\\
+
+ % Romain Fran\c{c}ois\\
+ % Professional R Enthusiast\\
+ % 1 rue du Puits du Temple, 34 000 Montpellier\\
+ % FRANCE \\
+ % E-mail: \email{romain at r-enthusiasts.com}\\
+ % URL: \url{http://romainfrancois.blog.free.fr}
+}
+
+%% need no \usepackage{Sweave.sty}
+
+\newcommand{\rank}{\operatorname{rank}}
+
+%% highlights macros
+%% Style definition file generated by highlight 2.7, http://www.andre-simon.de/
+% Highlighting theme definition:
+\newcommand{\hlstd}[1]{\textcolor[rgb]{0,0,0}{#1}}
+\newcommand{\hlnum}[1]{\textcolor[rgb]{0,0,0}{#1}}
+\newcommand{\hlopt}[1]{\textcolor[rgb]{0,0,0}{#1}}
+\newcommand{\hlesc}[1]{\textcolor[rgb]{0.74,0.55,0.55}{#1}}
+%\newcommand{\hlstr}[1]{\textcolor[rgb]{0.74,0.55,0.55}{#1}}
+\newcommand{\hlstr}[1]{\textcolor[rgb]{0.90,0.15,0.15}{#1}}
+%green: \newcommand{\hlstr}[1]{\textcolor[rgb]{0.13,0.67,0.13}{#1}} % 0.74 -> % 0.90; 0.55 -> 0.25
+\newcommand{\hldstr}[1]{\textcolor[rgb]{0.74,0.55,0.55}{#1}}
+\newcommand{\hlslc}[1]{\textcolor[rgb]{0.67,0.13,0.13}{\it{#1}}}
+\newcommand{\hlcom}[1]{\textcolor[rgb]{0.67,0.13,0.13}{\it{#1}}}
+\newcommand{\hldir}[1]{\textcolor[rgb]{0,0,0}{#1}}
+\newcommand{\hlsym}[1]{\textcolor[rgb]{0,0,0}{#1}}
+\newcommand{\hlline}[1]{\textcolor[rgb]{0.33,0.33,0.33}{#1}}
+\newcommand{\hlkwa}[1]{\textcolor[rgb]{0.61,0.13,0.93}{\bf{#1}}}
+\newcommand{\hlkwb}[1]{\textcolor[rgb]{0.13,0.54,0.13}{#1}}
+\newcommand{\hlkwc}[1]{\textcolor[rgb]{0,0,1}{#1}}
+\newcommand{\hlkwd}[1]{\textcolor[rgb]{0,0,0}{#1}}
+\definecolor{bgcolor}{rgb}{1,1,1}
+
+
+% ------------------------------------------------------------------------
+
+\begin{document}
+
+%\SweaveOpts{engine=R,eps=FALSE}
+
+\section{Introduction}
+\label{sec:intro}
+
+Linear algebra is an essential building block of statistical
+computing. Operations such as matrix decompositions, linear program
+solvers, and eigenvalue / eigenvector computations are used in many
+estimation and analysis routines. As such, libraries supporting linear
+algebra have long been provided by statistical programmers for
+different programming languages and environments. Because it is
+object-oriented, \proglang{C++}, one of the central modern languages
+for numerical and statistical computing, is particularly effective at
+representing matrices, vectors and decompositions, and numerous class
+libraries providing linear algebra routines have been written over the
+years.
+% Could cite Eddelbuettel (1996) here, but a real survey would be better.
+
+As both the \proglang{C++} language and standards have evolved
+\citep{Meyers:2005:EffectiveC++,Meyers:1995:MoreEffectiveC++,cpp11},
+so have the compilers implementing the language. Relatively modern
+language constructs such as template meta-programming are particularly
+useful because they provide overloading of operations (allowing
+expressive code in the compiled language similar to what can be done
+in scripting languages) and can shift some of the computational burden
+from the run-time to the compile-time. (A more detailed discussion of
+template meta-programming is, however, beyond the scope of this
+paper). \cite{Veldhuizen:1998:Blitz} provided an early and influential
+implementation of numerical linear algebra classes that already
+demonstrated key features of this approach. Its usage was held back
+at the time by the limited availability of compilers implementing all the
+necessary features of the \proglang{C++} language.
+
+This situation has greatly improved over the last decade, and many more
+libraries have been made available. One such \proglang{C++} library is
+\pkg{Eigen} by \citet*{Eigen:Web} which started as a sub-project to
+KDE (a popular Linux desktop environment), initially focussing on fixed-size
+matrices to represent projections in a visualization application. \pkg{Eigen}
+grew from there and has over the course of about a decade produced three
+major releases with ``Eigen3'' being the current version.
+
+\pkg{Eigen} is of interest as the \proglang{R} system for statistical
+computation and graphics \citep{R:Main} is itself easily extensible. This is
+particular true via the \proglang{C} language that most of \proglang{R}'s
+compiled core parts are written in, but also for the \proglang{C++} language
+which can interface with \proglang{C}-based systems rather easily. The manual
+``Writing R Extensions'' \citep{R:Extensions} is the basic reference for
+extending \proglang{R} with either \proglang{C} or \proglang{C++}.
+
+The \pkg{Rcpp} package by \citet{JSS:Rcpp,CRAN:Rcpp} facilitates extending
+\proglang{R} with \proglang{C++} code by providing seamless object mapping
+between both languages.
+%
+As stated in the \pkg{Rcpp} \citep{CRAN:Rcpp} vignette, ``Extending \pkg{Rcpp}''
+\begin{quote}
+ \pkg{Rcpp} facilitates data interchange between \proglang{R} and
+ \proglang{C++} through the templated functions \texttt{Rcpp::as} (for
+ conversion of objects from \proglang{R} to \proglang{C++}) and
+ \texttt{Rcpp::wrap} (for conversion from \proglang{C++} to \proglang{R}).
+\end{quote}
+The \pkg{RcppEigen} package provides the header files composing the
+\pkg{Eigen} \proglang{C++} template library, along with implementations of
+\texttt{Rcpp::as} and \texttt{Rcpp::wrap} for the \proglang{C++}
+classes defined in \pkg{Eigen}.
+
+The \pkg{Eigen} classes themselves provide high-performance,
+versatile and comprehensive representations of dense and sparse
+matrices and vectors, as well as decompositions and other functions
+to be applied to these objects. The next section introduces some
+of these classes and shows how to interface to them from \proglang{R}.
+
+\section[Eigen classes]{\pkg{Eigen} classes}
+\label{sec:eclasses}
+
+\pkg{Eigen} is a \proglang{C++} template library providing classes for
+many forms of matrices, vectors, arrays and decompositions. These
+classes are flexible and comprehensive allowing for both high
+performance and well structured code representing high-level
+operations. \proglang{C++} code based on \pkg{Eigen} is often more like
+\proglang{R} code, working on the ``whole object'', than like compiled
+code in other languages where operations often must be coded in loops.
+
+As in many \proglang{C++} template libraries using template meta-programming
+\citep{Abrahams+Gurtovoy:2004:TemplateMetaprogramming}, the templates
+themselves can be very complicated. However, \pkg{Eigen} provides
+\code{typedef}s for common classes that correspond to \proglang{R} matrices and
+vectors, as shown in Table~\ref{tab:REigen}, and this paper will use these
+\code{typedef}s.
+\begin{table}[tb]
+ \centering
+ \begin{tabular}{l l}
+ \toprule
+ \multicolumn{1}{c}{\proglang{R} object type} & \multicolumn{1}{c}{\pkg{Eigen} class typedef}\\
+ \midrule
+ numeric matrix & \code{MatrixXd}\\
+ integer matrix & \code{MatrixXi}\\
+ complex matrix & \code{MatrixXcd}\\
+ numeric vector & \code{VectorXd}\\
+ integer vector & \code{VectorXi}\\
+ complex vector & \code{VectorXcd}\\
+ \code{Matrix::dgCMatrix} \phantom{XXX} & \code{SparseMatrix<double>}\\
+ \bottomrule
+ \end{tabular}
+ \caption{Correspondence between R matrix and vector types and classes in the \pkg{Eigen} namespace.}
+ \label{tab:REigen}
+\end{table}
+
+Here, \code{Vector} and \code{Matrix} describe the dimension of the
+object. The \code{X} signals that these are dynamically-sized objects (as opposed
+to fixed-size matrices such as $3 \times 3$ matrices also available in
+\pkg{Eigen}). Lastly, the trailing characters \code{i}, \code{d} and
+\code{cd} denote, respectively, storage types \code{integer}, \code{double} and
+\code{complex double}.
+
+The \proglang{C++} classes shown in Table~\ref{tab:REigen} are in the
+\pkg{Eigen} namespace, which means that they must be written as
+\code{Eigen::MatrixXd}. However, if one prefaces the use of these class
+names with a declaration like
+
+%% Alternatively, use 'highlight --enclose-pre --no-doc --latex --style=emacs --syntax=C++'
+%% as the command invoked from C-u M-|
+%% For version 3.5 of highlight this should be
+%% highlight --enclose-pre --no-doc --out-format=latex --syntax=C++
+%%
+%% keep one copy to redo later
+%%
+%% using Eigen::MatrixXd;
+%%
+\begin{quote}
+ \noindent
+ \ttfamily
+ \hlstd{}\hlkwa{using\ }\hlstd{Eigen}\hlopt{::}\hlstd{MatrixXd}\hlopt{;}\hlstd{}\hspace*{\fill}\\
+ \mbox{}
+ \normalfont
+ \normalsize
+\end{quote}
+then one can use these names without the namespace qualifier.
+
+\subsection[Mapped matrices in Eigen]{Mapped matrices in \pkg{Eigen}}
+\label{sec:mapped}
+
+Storage for the contents of matrices from the classes shown in
+Table~\ref{tab:REigen} is allocated and controlled by the class
+constructors and destructors. Creating an instance of such a class
+from an \proglang{R} object involves copying its contents. An
+alternative is to have the contents of the \proglang{R} matrix or
+vector mapped to the contents of the object from the \pkg{Eigen} class. For
+dense matrices one can use the \pkg{Eigen} templated class \code{Map}, and for
+sparse matrices one can deploy the \pkg{Eigen} templated class \code{MappedSparseMatrix}.
+
+One must, of course, be careful not to modify the contents of the
+\proglang{R} object in the \proglang{C++} code. A recommended
+practice is always to declare mapped objects as {\ttfamily\hlkwb{const}\normalfont}.
+
+\subsection[Arrays in Eigen]{Arrays in \pkg{Eigen}}
+\label{sec:arrays}
+
+For matrix and vector classes \pkg{Eigen} overloads the \texttt{`*'}
+operator as matrix multiplication. Occasionally component-wise
+operations instead of matrix operations are desired, for which the
+\code{Array} templated classes are used in \pkg{Eigen}. Switching
+back and forth between matrices or vectors and arrays is usually done
+via the \code{array()} method for matrix or vector objects and the
+\code{matrix()} method for arrays.
+
+\subsection[Structured matrices in Eigen]{Structured matrices in \pkg{Eigen}}
+\label{sec:structured}
+
+\pkg{Eigen} provides classes for matrices with special structure such
+as symmetric matrices, triangular matrices and banded matrices. For
+dense matrices, these special structures are described as ``views'',
+meaning that the full dense matrix is stored but only part of the
+matrix is used in operations. For a symmetric matrix one must
+specify whether the lower triangle or the upper triangle is to be used as
+the contents, with the other triangle defined by the implicit symmetry.
+
+\section{Some simple examples}
+\label{sec:simple}
+
+\proglang{C++} functions to perform simple operations on matrices or
+vectors can follow a pattern of:
+\begin{enumerate}
+\item Map the \proglang{R} objects passed as arguments into \pkg{Eigen} objects.
+\item Create the result.
+\item Return \code{Rcpp::wrap} applied to the result.
+\end{enumerate}
+
+An idiom for the first step is
+% using Eigen::Map;
+% using Eigen::MatrixXd;
+% using Rcpp::as;
+%
+% const Map<MatrixXd> A(as<Map<MatrixXd> >(AA));
+%\end{lstlisting}
+\begin{quote}
+ \noindent
+ \ttfamily
+ \hlstd{}\hlkwa{using\ }\hlstd{Eigen}\hlsym{::}\hlstd{Map}\hlsym{;}\hspace*{\fill}\\
+ \hlstd{}\hlkwa{using\ }\hlstd{Eigen}\hlsym{::}\hlstd{MatrixXd}\hlsym{;}\hspace*{\fill}\\
+ \hlstd{}\hlkwa{using\ }\hlstd{Rcpp}\hlsym{::}\hlstd{as}\hlsym{;}\hspace*{\fill}\\
+ \hlstd{}\hspace*{\fill}\\
+ \hlkwb{const\ }\hlstd{Map}\hlsym{$<$}\hlstd{MatrixXd}\hlsym{$>$}\hlstd{\ \ }\hlsym{}\hlstd{}\hlkwd{A}\hlstd{}\hlsym{(}\hlstd{as}\hlsym{$<$}\hlstd{Map}\hlsym{$<$}\hlstd{MatrixXd}\hlsym{$>$\ $>$(}\hlstd{AA}\hlsym{));}\hlstd{}\hspace*{\fill}\\
+ \mbox{}
+ \normalfont
+\end{quote}
+where \code{AA} is the name of the \proglang{R} object (of type \code{SEXP} in
+\proglang{C} and \proglang{C++}) passed to the \proglang{C++} function.
+
+An alternative to the \code{using} declarations is to declare a \code{typedef} as in
+% typedef Eigen::Map<Eigen::MatrixXd> MapMatd;
+% const MapMatd A(Rcpp::as<MapMatd>(AA));
+\begin{quote}
+ \noindent
+ \ttfamily
+ \hlstd{}\hlkwc{typedef\ }\hlstd{Eigen}\hlopt{::}\hlstd{Map}\hlopt{$<$}\hlstd{Eigen}\hlopt{::}\hlstd{MatrixXd}\hlopt{$>$}\hlstd{\ \ \ }\hlopt{}\hlstd{MapMatd}\hlopt{;}\hspace*{\fill}\\
+ \hlstd{}\hlkwb{const\ }\hlstd{MapMatd}\hlstd{\ \ \ \ \ \ \ \ \ \ }\hlstd{}\hlkwd{A}\hlstd{}\hlopt{(}\hlstd{Rcpp}\hlopt{::}\hlstd{as}\hlopt{$<$}\hlstd{MapMatd}\hlopt{$>$(}\hlstd{AA}\hlopt{));}\hlstd{}\hspace*{\fill}\\
+ \mbox{}
+ \normalfont
+ \normalsize
+\end{quote}
+
+The \code{cxxfunction} function from the \pkg{inline} package \citep*{CRAN:inline} for
+\proglang{R} and its \pkg{RcppEigen} plugin provide a convenient method of
+developing and debugging the \proglang{C++} code. For actual production code
+one generally incorporates the \proglang{C++} source code files in a package
+and includes the line \code{LinkingTo: Rcpp, RcppEigen} in the package's
+\code{DESCRIPTION} file. The \code{RcppEigen.package.skeleton} function
+provides a quick way of generating the skeleton of a package that will use
+\pkg{RcppEigen}.
+
+The \code{cxxfunction} with the \code{"Rcpp"} or \code{"RcppEigen"}
+plugins has the \code{as} and \code{wrap} functions already defined as
+\code{Rcpp::as} and \code{Rcpp::wrap}. In the examples below
+these declarations are omitted. It is important to remember that they are
+needed in actual \proglang{C++} source code for a package.
+
+The first few examples are simply for illustration as the operations
+shown could be more effectively performed directly in \proglang{R}.
+Finally, the results from \pkg{Eigen} are compared to those from the direct
+\proglang{R} results.
+
+\subsection{Transpose of an integer matrix}
+\label{sec:transpose}
+
+The next \proglang{R} code snippet creates a simple matrix of integers
+\begin{verbatim}
+> (A <- matrix(1:6, ncol=2))
+ [,1] [,2]
+[1,] 1 4
+[2,] 2 5
+[3,] 3 6
+> str(A)
+ int [1:3, 1:2] 1 2 3 4 5 6
+\end{verbatim}
+and, in Figure~\ref{trans}, the \code{transpose()} method for the
+\code{Eigen::MatrixXi} class is used to return the transpose of the supplied matrix. The \proglang{R}
+matrix in the \code{SEXP} \code{AA} is first mapped to an
+\code{Eigen::MatrixXi} object, and then the matrix \code{At} is constructed
+from its transpose and returned to \proglang{R}.
+
+\begin{figure}[htb]
+ %\begin{quote}
+ \noindent
+ \ttfamily
+ \hlstd{}\hlkwa{using\ }\hlstd{Eigen}\hlsym{::}\hlstd{Map}\hlsym{;}\hspace*{\fill}\\
+ \hlstd{}\hlkwa{using\ }\hlstd{Eigen}\hlsym{::}\hlstd{MatrixXi}\hlsym{;}\hspace*{\fill}\\
+ \hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{}\hlslc{//\ Map\ the\ integer\ matrix\ AA\ from\ R}\hspace*{\fill}\\
+ \hlstd{}\hlkwb{const\ }\hlstd{Map}\hlsym{$<$}\hlstd{MatrixXi}\hlsym{$>$}\hlstd{\ \ }\hlsym{}\hlstd{}\hlkwd{A}\hlstd{}\hlsym{(}\hlstd{as}\hlsym{$<$}\hlstd{Map}\hlsym{$<$}\hlstd{MatrixXi}\hlsym{$>$\ $>$(}\hlstd{AA}\hlsym{));}\hspace*{\fill}\\
+ \hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{}\hlslc{//\ evaluate\ and\ return\ the\ transpose\ of\ A}\hspace*{\fill}\\
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/rcpp -r 3349
More information about the Rcpp-commits
mailing list