[Rcpp-commits] r1629 - in pkg/Rcpp/inst/doc: . Rcpp-sugar
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Jun 19 16:17:31 CEST 2010
Author: edd
Date: 2010-06-19 16:17:30 +0200 (Sat, 19 Jun 2010)
New Revision: 1629
Modified:
pkg/Rcpp/inst/doc/Rcpp-sugar/Rcpp-sugar.Rnw
pkg/Rcpp/inst/doc/Rcpp.bib
Log:
some edits in sugar vignette
updates to bibliography
Modified: pkg/Rcpp/inst/doc/Rcpp-sugar/Rcpp-sugar.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp-sugar/Rcpp-sugar.Rnw 2010-06-19 12:19:12 UTC (rev 1628)
+++ pkg/Rcpp/inst/doc/Rcpp-sugar/Rcpp-sugar.Rnw 2010-06-19 14:17:30 UTC (rev 1629)
@@ -48,12 +48,17 @@
\abstract{
\noindent
- This note describes \sugar{} which has been introduced in
- the version 0.8.3 of \pkg{Rcpp}\citep{CRAN:Rcpp}. \sugar{}
- brings a high level syntax to \proglang{C++} code written using classes
- of the \pkg{Rcpp} API.
-
- \sugar{} is based on the technique of expression templates.
+ This note describes \sugar~which has been introduced in
+ version 0.8.3 of \pkg{Rcpp} \citep{CRAN:Rcpp}. \sugar~
+ offers to bring a higher-level of abstraction to \proglang{C++} code
+ written using the \pkg{Rcpp} API.
+
+ \sugar~is based on expression templates
+ \citep{Abrahams+Gurtovoy:2004,Vandevoorde+Josuttis:2003} and provides
+ some 'syntactic sugar' facilities directly in \pkg{Rcpp} which is similar
+ to the classes \pkg{RcppArmadillo} \citep{CRAN:RcppArmadillo} offered for
+ linear algebra \proglang{C++} classes based on \pkg{Armadillo}
+ \citep{Armadillo}.
% TODO: reference to armadillo, blitz, etc ...
}
@@ -63,8 +68,8 @@
package by abstracting low-level details of the \proglang{R} API \citep{R:exts}
into a consistent set of \proglang{C++} classes.
-Code written using \pkg{Rcpp} classes is easier to read, write and maintain,
-without losing performance. Consider the following code:
+Code written using \pkg{Rcpp} classes is easier to read, write and maintain,
+without loosing performance. Consider the following code:
<<lang=cpp>>=
RcppExport SEXP foo( SEXP x, SEXP y){
@@ -87,8 +92,8 @@
}
@
-The aim of the \texttt{foo} code is simple. Given two \texttt{numeric} vectors,
-we create a third one. This is typical low level \proglang{C++} code that
+The aim of the \texttt{foo} code is simple. Given two \texttt{numeric} vectors,
+we create a third one. This is typical low-level \proglang{C++} code that
that would be written much more consicely in \proglang{R} thanks to vectorisation.
<<eval=FALSE>>=
@@ -97,9 +102,9 @@
}
@
-The motivation of \sugar{} is to bring a subset of the high level \proglang{R}
-syntax in \proglang{C++}. With \sugar{}, the \proglang{C++} version of
-\texttt{foo} becomes:
+The motivation of \sugar~is to bring a subset of the high-level \proglang{R}
+syntax in \proglang{C++}. With \sugar, the \proglang{C++} version of
+\texttt{foo} becomes:
<<lang=cpp>>=
RcppExport SEXP foo( SEXP x, SEXP y){
@@ -110,20 +115,20 @@
}
@
-\sugar{} is written using expression templates and lazy evaluation techniques,
-which not only allows a much nicer high level syntax, but also makes it
-very efficient.
+\sugar~is written using expression templates and lazy evaluation techniques,
+which not only allows a much nicer high-level syntax, but also makes it
+very efficient (as we detail in section~\ref{sec:performance} below).
-\section{Operators}
+\section{Operators}
-\sugar{} takes advantage of \proglang{C++} operator overloading.
+\sugar~takes advantage of \proglang{C++} operator overloading.
\subsection{binary arithmetic operators}
\subsubsection{operator+}
-The \texttt{operator+} is used to add two \sugar{} expressions of the same
-size or one \sugar{} expression with a single value of the appropriate type.
+The \texttt{operator+} is used to add two \sugar~expressions of the same
+size or one \sugar~expression with a single value of the appropriate type.
<<lang=cpp>>=
// two numeric vectors of the same size
@@ -143,8 +148,8 @@
\subsubsection{operator-}
-The \texttt{operator-} is used to substract two \sugar{} expressions of the same
-size or one \sugar{} expression with a single value of the appropriate type.
+The \texttt{operator-} is used to substract two \sugar~expressions of the same
+size or one \sugar~expression with a single value of the appropriate type.
<<lang=cpp>>=
// two numeric vectors of the same size
@@ -164,8 +169,8 @@
\subsubsection{operator*}
-The \texttt{operator*} is used to multiply two \sugar{} expressions of the same
-size or one \sugar{} expression with a single value of the appropriate type.
+The \texttt{operator*} is used to multiply two \sugar~expressions of the same
+size or one \sugar~expression with a single value of the appropriate type.
<<lang=cpp>>=
// two numeric vectors of the same size
@@ -185,8 +190,8 @@
\subsubsection{operator/}
-The \texttt{operator*} is used to divide two \sugar{} expressions of the same
-size or one \sugar{} expression with a single value of the appropriate type.
+The \texttt{operator*} is used to divide two \sugar~expressions of the same
+size or one \sugar~expression with a single value of the appropriate type.
<<lang=cpp>>=
// two numeric vectors of the same size
@@ -217,7 +222,7 @@
\subsubsection{operator-}
\subsubsection{operator!}
-
+
\section{Functions}
\subsection{all}
@@ -232,6 +237,7 @@
\subsection{lapply}
\section{Performance}
+\label{sec:performance}
\section{Implementation}
Modified: pkg/Rcpp/inst/doc/Rcpp.bib
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp.bib 2010-06-19 12:19:12 UTC (rev 1628)
+++ pkg/Rcpp/inst/doc/Rcpp.bib 2010-06-19 14:17:30 UTC (rev 1629)
@@ -20,10 +20,10 @@
}
@Manual{CRAN:RcppArmadillo,
- title = {{Rcpp/Armadillo} bridge},
+ title = {Rcpp integration for Armadillo templated linear algebra library},
author = {Romain Fran\c{c}ois and Dirk Eddelbuettel and Doug Bates},
year = 2010,
- note = {R package version 0.2.1},
+ note = {R package version 0.2.2},
url = {http://CRAN.R-Project.org/package=RcppArmadillo},
}
@@ -102,6 +102,16 @@
Concepts, Tools and Techniques from {B}oost and
Beyond},
publisher = {Addison-Wesley},
- year = 2004
+ year = 2004,
+ address = {Boston}
}
+
+ at Book{Vandevoorde+Josuttis:2003,
+ author = {David Vandevoorde and Nicolai M. Josuttis},
+ title = {\proglang{C++} {T}emplates: The Complete Guide},
+ publisher = {Addison-Wesley},
+ year = 2003,
+ address = {Boston}
+}
+
More information about the Rcpp-commits
mailing list