[Rcpp-commits] r1626 - pkg/Rcpp/inst/doc/Rcpp-sugar

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jun 19 14:09:11 CEST 2010


Author: romain
Date: 2010-06-19 14:09:10 +0200 (Sat, 19 Jun 2010)
New Revision: 1626

Modified:
   pkg/Rcpp/inst/doc/Rcpp-sugar/Rcpp-sugar.Rnw
Log:
some more

Modified: pkg/Rcpp/inst/doc/Rcpp-sugar/Rcpp-sugar.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp-sugar/Rcpp-sugar.Rnw	2010-06-19 11:52:05 UTC (rev 1625)
+++ pkg/Rcpp/inst/doc/Rcpp-sugar/Rcpp-sugar.Rnw	2010-06-19 12:09:10 UTC (rev 1626)
@@ -113,6 +113,58 @@
 which not only allows a much nicer high level syntax, but also makes it 
 very efficient. 
 
+\section{Operators}  
+
+\sugar{} takes advantage of \proglang{C++} operator overloading. 
+
+\subsection{binary 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.
+
+<<lang=cpp>>=
+// two numeric vectors of the same size
+NumericVector x ;
+NumericVector y ;
+
+// adding them
+NumericVector res = x + y ;
+
+// adding a single value
+NumericVector res = x + 2.0 ;
+NumericVector res = 2.0 + x;
+
+// adding expressions
+NumericVector res = x * y + y / 2.0 ;
+@
+
+\subsubsection{operator-}
+\subsubsection{operator*}
+\subsubsection{operator/}
+
+\subsection{Unary operators}
+
+\subsubsection{operator-}
+\subsubsection{operator!}
+   
+\section{Functions}
+
+\subsection{all}
+\subsection{any}
+\subsection{is na}
+\subsection{ifelse}
+\subsection{seq along}
+\subsection{seq len}
+\subsection{pmin}
+\subsection{pmax}
+\subsection{sapply}
+\subsection{lapply}
+
+
+\section{Implementation}
+
 \bibliographystyle{abbrvnat}
 \bibliography{Rcpp}
 



More information about the Rcpp-commits mailing list