[Rcpp-commits] r2636 - pkg/RcppGSL/inst/doc/RcppGSL

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Dec 1 03:57:40 CET 2010


Author: edd
Date: 2010-12-01 03:57:37 +0100 (Wed, 01 Dec 2010)
New Revision: 2636

Modified:
   pkg/RcppGSL/inst/doc/RcppGSL/RcppGSL.Rnw
Log:
- set all Sweave size to small -- there seems to be no connection between the 
  document pointsize (here 10pt) and the sweave snippet
- fixed indentation in one instance
- added missing word


Modified: pkg/RcppGSL/inst/doc/RcppGSL/RcppGSL.Rnw
===================================================================
--- pkg/RcppGSL/inst/doc/RcppGSL/RcppGSL.Rnw	2010-12-01 02:08:30 UTC (rev 2635)
+++ pkg/RcppGSL/inst/doc/RcppGSL/RcppGSL.Rnw	2010-12-01 02:57:37 UTC (rev 2636)
@@ -218,7 +218,7 @@
 data, similar to \proglang{R} arrays. For example the \verb|gsl_vector| and \verb|gsl_vector_int|
 structs are defined as:
 
-<<lang=cpp>>=
+<<lang=cpp,size=small>>=
 typedef struct{
   size_t size;
   size_t stride;
@@ -239,7 +239,7 @@
 
 A typical use of the \verb|gsl_vector| struct is given below:
 
-<<lang=cpp>>=
+<<lang=cpp,size=small>>=
 int i;
 gsl_vector * v = gsl_vector_alloc (3);  // allocate a gsl_vector of size 3
 
@@ -261,7 +261,7 @@
 \verb|gsl_vector| pointers taking advantage of C++ templates. Using this
 template type, the previous example now becomes:
 
-<<lang=cpp>>=
+<<lang=cpp,size=small>>=
 int i;
 RcppGSL::vector<double> v(3);           // allocate a gsl_vector of size 3
 
@@ -288,7 +288,7 @@
 \verb|sum_gsl_vector_int| that operates on a \verb|gsl_vector_int| through
 the \texttt{RcppGSL::vector<int>} template specialization:
 
-<<lang=cpp>>=
+<<lang=cpp,size=small>>=
 RCPP_FUNCTION_1( int, sum_gsl_vector_int, RcppGSL::vector<int> vec){
   int res = std::accumulate( vec.begin(), vec.end(), 0 ) ;
   vec.free() ;  // we need to free vec after use
@@ -306,7 +306,7 @@
   return wrap( res ) ;
 ', plugin = "RcppGSL" )
 @
-<<eval=FALSE>>=
+<<eval=FALSE,size=small>>=
 .Call( "sum_gsl_vector_int", 1:10 )
 @
 <<echo=FALSE>>=
@@ -317,7 +317,7 @@
 R list as \verb|gsl_vector| objects using implicit conversion mechanisms
 of \pkg{Rcpp}
 
-<<lang=cpp>>=
+<<lang=cpp,size=small>>=
 RCPP_FUNCTION_1( double, gsl_vector_sum_2, Rcpp::List data ){
   // grab "x" as a gsl_vector through the RcppGSL::vector<double> class
   RcppGSL::vector<double> x = data["x"] ;
@@ -340,7 +340,7 @@
 
 called from \proglang{R} :
 
-<<>>=
+<<size=small>>=
 data <- list( x = seq(0,1,length=10), y = 1:10 )
 @
 <<eval=FALSE>>=
@@ -411,7 +411,7 @@
 type. \pkg{RcppGSL} defines the template class \texttt{RcppGSL::vector\_view}
 to handle vector views using \proglang{C++} syntax.
 
-<<lang=cpp>>=
+<<lang=cpp,size=small>>=
 extern "C" SEXP test_gsl_vector_view(){
   int n = 10 ;
   RcppGSL::vector<double> v(n) ;
@@ -481,7 +481,7 @@
 
 The \texttt{RcppGSL::matrix} template exposes three constructors.
 
-<<lang=cpp>>=
+<<lang=cpp,size=small>>=
 // convert an R matrix to a GSL matrix
 matrix( SEXP x) throw(::Rcpp::not_compatible)
 
@@ -499,11 +499,11 @@
 the class \texttt{RcppGSL::matrix} look and feel like a pointer to a GSL
 matrix type.
 
-<<lang=cpp>>=
-  gsltype* data ;
-  operator gsltype*(){ return data ; }
-  gsltype* operator->() const { return data; }
-  gsltype& operator*() const { return *data; }
+<<lang=cpp,size=small>>=
+gsltype* data ;
+operator gsltype*(){ return data ; }
+gsltype* operator->() const { return data; }
+gsltype& operator*() const { return *data; }
 @
 
 \subsection{Indexing}
@@ -515,11 +515,11 @@
 \pkg{RcppGSL} takes advantage of both operator overloading and templates
 to make indexing a \pkg{GSL} matrix much more convenient.
 
-<<lang=cpp>>=
+<<lang=cpp,size=small>>=
 RcppGSL::matrix<int> mat(10,10);        // create a matrix of size 10x10
 
 for( int i=0; i<10: i++) {              // fill the diagonal
-        mat(i,i) = i ;
+    mat(i,i) = i ;
 }
 @
 
@@ -605,7 +605,7 @@
 \pkg{RcppGSL} provides R functions that allows one to retrieve the same
 information. Therefore the configure script can also be written as:
 
-<<lang=bash>>=
+<<lang=bash,size=small>>=
 #!/bin/sh
 
 GSL_CFLAGS=`${R_HOME}/bin/Rscript -e "RcppGSL:::CFlags()"`
@@ -620,7 +620,7 @@
 
 Similarly, the configure.win for windows can be written as:
 
-<<lang=bash>>=
+<<lang=bash,size=small>>=
 GSL_CFLAGS=`${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe -e "RcppGSL:::CFlags()"`
 GSL_LIBS=`${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe -e "RcppGSL:::LdFlags()"`
 RCPP_LDFLAGS=`${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe -e "Rcpp:::LdFlags()"`
@@ -698,7 +698,7 @@
 
 \section{Using \pkg{RcppGSL} with \pkg{inline}}
 
-The \pkg{inline} \citep{CRAN:inline} is very helpful for prototyping code in
+The \pkg{inline} package \citep{CRAN:inline} is very helpful for prototyping code in
 \proglang{C}, \proglang{C++} or \proglang{Fortran} as it takes care of code
 compilation, linking and dynamic loading directly from \proglang{R}. It is
 being used extensively by \pkg{Rcpp}, for example in the numerous unit tests.



More information about the Rcpp-commits mailing list