[Rcpp-commits] r4358 - in pkg/RcppGSL: . inst vignettes/RcppGSL

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 20 04:24:34 CEST 2013


Author: edd
Date: 2013-06-20 04:24:33 +0200 (Thu, 20 Jun 2013)
New Revision: 4358

Modified:
   pkg/RcppGSL/ChangeLog
   pkg/RcppGSL/cleanup
   pkg/RcppGSL/inst/NEWS.Rd
   pkg/RcppGSL/vignettes/RcppGSL/RcppGSL-intro.Rnw
Log:
reverting vignette back to highlighting on demand


Modified: pkg/RcppGSL/ChangeLog
===================================================================
--- pkg/RcppGSL/ChangeLog	2013-06-20 01:19:29 UTC (rev 4357)
+++ pkg/RcppGSL/ChangeLog	2013-06-20 02:24:33 UTC (rev 4358)
@@ -1,3 +1,12 @@
+2013-06-19  Dirk Eddelbuettel  <edd at debian.org>
+
+	* vignettes/RcppGSL/RcppGSL-intro.Rnw: Some fixes
+
+2013-06-19  Romain Francois  <romain at r-enthusiasts.com>
+
+	* vignettes/RcppGSL/RcppGSL-intro.Rnw: Converted back to use with
+	package highlight (>= 0.4.2)
+
 2012-11-11  Dirk Eddelbuettel  <edd at debian.org>
 
 	* inst/examples/bSpline/bSpline.cpp: New example for B-spline fit

Modified: pkg/RcppGSL/cleanup
===================================================================
--- pkg/RcppGSL/cleanup	2013-06-20 01:19:29 UTC (rev 4357)
+++ pkg/RcppGSL/cleanup	2013-06-20 02:24:33 UTC (rev 4358)
@@ -14,5 +14,5 @@
 
 (cd vignettes && \
     make clean && \
-    rm -rf auto unitTests-results/ )
+    rm -rf auto unitTests-results/* )
 

Modified: pkg/RcppGSL/inst/NEWS.Rd
===================================================================
--- pkg/RcppGSL/inst/NEWS.Rd	2013-06-20 01:19:29 UTC (rev 4357)
+++ pkg/RcppGSL/inst/NEWS.Rd	2013-06-20 02:24:33 UTC (rev 4358)
@@ -6,9 +6,9 @@
   \itemize{
     \item Added new example based on B-splines example in GSL manual
     illustrating simple GSL use via Rcpp attributes
-    \item vignette production has been simplified, relying on version 0.4.2
-    of highlight which acts now as a vignette engine for this package 
-    vignette. 
+    \item Vignette compilation has been reverted to using \pkg{highlight} 
+    since version 0.4.2 or greater can be used as a vignette engine
+    (with R 3.0.* or later). 
   }
 }
 

Modified: pkg/RcppGSL/vignettes/RcppGSL/RcppGSL-intro.Rnw
===================================================================
--- pkg/RcppGSL/vignettes/RcppGSL/RcppGSL-intro.Rnw	2013-06-20 01:19:29 UTC (rev 4357)
+++ pkg/RcppGSL/vignettes/RcppGSL/RcppGSL-intro.Rnw	2013-06-20 02:24:33 UTC (rev 4358)
@@ -2,6 +2,7 @@
 %\VignetteIndexEntry{RcppGSL}
 %\VignetteKeywords{R,GSL,Rcpp,data transfer}
 %\VignettePackage{RcppGSL}
+%\VignetteEngine{highlight::highlight}
 
 \usepackage{url,color}
 \usepackage[authoryear,round,longnamesfirst]{natbib}
@@ -137,111 +138,56 @@
 the \pkg{GSL} for the least-squares fitting functions and therefore provides a nice
 example for \pkg{GSL} integration with \proglang{R}.
 
-% < < fastLm,lang=cpp,size=small > > =
-% #include <RcppGSL.h>
-% #include <gsl/gsl_multifit.h>
-% #include <cmath>
+<<fastLm,lang=cpp,size=small>>=
+#include <RcppGSL.h>
+#include <gsl/gsl_multifit.h>
+#include <cmath>
 
-% extern "C" SEXP fastLm(SEXP ys, SEXP Xs) {
+extern "C" SEXP fastLm(SEXP ys, SEXP Xs) {
 
-%   try {
-%         RcppGSL::vector<double> y = ys;     // create gsl data structures from SEXP
-%         RcppGSL::matrix<double> X = Xs;
+  try {
+        RcppGSL::vector<double> y = ys;     // create gsl data structures from SEXP
+        RcppGSL::matrix<double> X = Xs;
 
-%         int n = X.nrow(), k = X.ncol();
-%         double chisq;
+        int n = X.nrow(), k = X.ncol();
+        double chisq;
 
-%         RcppGSL::vector<double> coef(k);    // to hold the coefficient vector
-%         RcppGSL::matrix<double> cov(k,k);   // and the covariance matrix
+        RcppGSL::vector<double> coef(k);    // to hold the coefficient vector
+        RcppGSL::matrix<double> cov(k,k);   // and the covariance matrix
 
-%         // the actual fit requires working memory we allocate and free
-%         gsl_multifit_linear_workspace *work = gsl_multifit_linear_alloc (n, k);
-%         gsl_multifit_linear (X, y, coef, cov, &chisq, work);
-%         gsl_multifit_linear_free (work);
+        // the actual fit requires working memory we allocate and free
+        gsl_multifit_linear_workspace *work = gsl_multifit_linear_alloc (n, k);
+        gsl_multifit_linear (X, y, coef, cov, &chisq, work);
+        gsl_multifit_linear_free (work);
 
-%         // extract the diagonal as a vector view
-%         gsl_vector_view diag = gsl_matrix_diagonal(cov) ;
+        // extract the diagonal as a vector view
+        gsl_vector_view diag = gsl_matrix_diagonal(cov) ;
 
-%         // currently there is not a more direct interface in Rcpp::NumericVector
-%         // that takes advantage of wrap, so we have to do it in two steps
-%         Rcpp::NumericVector std_err ; std_err = diag;
-%         std::transform( std_err.begin(), std_err.end(), std_err.begin(), sqrt);
+        // currently there is not a more direct interface in Rcpp::NumericVector
+        // that takes advantage of wrap, so we have to do it in two steps
+        Rcpp::NumericVector std_err ; std_err = diag;
+        std::transform( std_err.begin(), std_err.end(), std_err.begin(), sqrt);
 
-%         Rcpp::List res = Rcpp::List::create(Rcpp::Named("coefficients") = coef,
-%                                             Rcpp::Named("stderr") = std_err,
-%                                             Rcpp::Named("df") = n - k);
+        Rcpp::List res = Rcpp::List::create(Rcpp::Named("coefficients") = coef,
+                                            Rcpp::Named("stderr") = std_err,
+                                            Rcpp::Named("df") = n - k);
 
-%         // free all the GSL vectors and matrices -- as these are really C data structures
-%         // we cannot take advantage of automatic memory management
-%         coef.free(); cov.free(); y.free(); X.free();
+        // free all the GSL vectors and matrices -- as these are really C data structures
+        // we cannot take advantage of automatic memory management
+        coef.free(); cov.free(); y.free(); X.free();
 
-%         return res;  		// return the result list to R
+        return res;  		// return the result list to R
 
-%   } catch( std::exception &ex ) {
-%         forward_exception_to_r( ex );
-%   } catch(...) {
-%         ::Rf_error( "c++ exception (unknown reason)" );
-%   }
-%   return R_NilValue; // -Wall
-% }
-% @
+  } catch( std::exception &ex ) {
+        forward_exception_to_r( ex );
+  } catch(...) {
+        ::Rf_error( "c++ exception (unknown reason)" );
+  }
+  return R_NilValue; // -Wall
+}
+@
 
-\begin{small}
-\begin{Hchunk}
-\noindent
-\ttfamily
-\hlstd{}\hldir{\#include\ \usebox{\hlsmallboxlessthan}RcppGSL.h\usebox{\hlsmallboxgreaterthan}}\hspace*{\fill}\\
-\hlstd{}\hldir{\#include\ \usebox{\hlsmallboxlessthan}gsl/gsl\textunderscore multifit.h\usebox{\hlsmallboxgreaterthan}}\hspace*{\fill}\\
-\hlstd{}\hldir{\#include\ \usebox{\hlsmallboxlessthan}cmath\usebox{\hlsmallboxgreaterthan}}\hspace*{\fill}\\
-\hlstd{}\hspace*{\fill}\\
-\hlkwc{extern\ }\hlstd{}\hlstr{"C"}\hlstd{\ SEXP\ }\hlkwd{fastLm}\hlstd{}\hlsym{(}\hlstd{SEXP\ ys}\hlsym{,\ }\hlstd{SEXP\ Xs}\hlsym{)\ \usebox{\hlsmallboxopenbrace}}\hspace*{\fill}\\
-\hlstd{\hspace*{\fill}\\
-}\hlstd{\ \ }\hlstd{}\hlkwa{try\ }\hlstd{}\hlsym{\usebox{\hlsmallboxopenbrace}}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{RcppGSL}\hlsym{::}\hlstd{vector}\hlsym{\usebox{\hlsmallboxlessthan}}\hlstd{}\hlkwb{double}\hlstd{}\hlsym{\usebox{\hlsmallboxgreaterthan}\ }\hlstd{y\ }\hlsym{=\ }\hlstd{ys}\hlsym{;}\hlstd{\ \ \ \ \ }\hlsym{}\hlstd{}\hlslc{//\ create\ gsl\ data\ structures\ from\ SEXP}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{RcppGSL}\hlsym{::}\hlstd{matrix}\hlsym{\usebox{\hlsmallboxlessthan}}\hlstd{}\hlkwb{double}\hlstd{}\hlsym{\usebox{\hlsmallboxgreaterthan}\ }\hlstd{X\ }\hlsym{=\ }\hlstd{Xs}\hlsym{;}\hspace*{\fill}\\
-\hlstd{\hspace*{\fill}\\
-}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{}\hlkwb{int\ }\hlstd{n\ }\hlsym{=\ }\hlstd{X}\hlsym{.}\hlstd{}\hlkwd{nrow}\hlstd{}\hlsym{(),\ }\hlstd{k\ }\hlsym{=\ }\hlstd{X}\hlsym{.}\hlstd{}\hlkwd{ncol}\hlstd{}\hlsym{();}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{}\hlkwb{double\ }\hlstd{chisq}\hlsym{;}\hspace*{\fill}\\
-\hlstd{\hspace*{\fill}\\
-}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{RcppGSL}\hlsym{::}\hlstd{vector}\hlsym{\usebox{\hlsmallboxlessthan}}\hlstd{}\hlkwb{double}\hlstd{}\hlsym{\usebox{\hlsmallboxgreaterthan}\ }\hlstd{}\hlkwd{coef}\hlstd{}\hlsym{(}\hlstd{k}\hlsym{);}\hlstd{\ \ \ \ }\hlsym{}\hlstd{}\hlslc{//\ to\ hold\ the\ coefficient\ vector}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{RcppGSL}\hlsym{::}\hlstd{matrix}\hlsym{\usebox{\hlsmallboxlessthan}}\hlstd{}\hlkwb{double}\hlstd{}\hlsym{\usebox{\hlsmallboxgreaterthan}\ }\hlstd{}\hlkwd{cov}\hlstd{}\hlsym{(}\hlstd{k}\hlsym{,}\hlstd{k}\hlsym{);}\hlstd{\ \ \ }\hlsym{}\hlstd{}\hlslc{//\ and\ the\ covariance\ matrix}\hspace*{\fill}\\
-\hlstd{\hspace*{\fill}\\
-}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{}\hlslc{//\ the\ actual\ fit\ requires\ working\ memory\ we\ allocate\ and\ free}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{gsl\textunderscore multifit\textunderscore linear\textunderscore workspace\ }\hlsym{{*}}\hlstd{work\ }\hlsym{=\ }\hlstd{}\hlkwd{gsl\textunderscore multifit\textunderscore linear\textunderscore alloc\ }\hlstd{}\hlsym{(}\hlstd{n}\hlsym{,\ }\hlstd{k}\hlsym{);}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{}\hlkwd{gsl\textunderscore multifit\textunderscore linear\ }\hlstd{}\hlsym{(}\hlstd{X}\hlsym{,\ }\hlstd{y}\hlsym{,\ }\hlstd{coef}\hlsym{,\ }\hlstd{cov}\hlsym{,\ \&}\hlstd{chisq}\hlsym{,\ }\hlstd{work}\hlsym{);}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{}\hlkwd{gsl\textunderscore multifit\textunderscore linear\textunderscore free\ }\hlstd{}\hlsym{(}\hlstd{work}\hlsym{);}\hspace*{\fill}\\
-\hlstd{\hspace*{\fill}\\
-}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{}\hlslc{//\ extract\ the\ diagonal\ as\ a\ vector\ view}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{gsl\textunderscore vector\textunderscore view\ diag\ }\hlsym{=\ }\hlstd{}\hlkwd{gsl\textunderscore matrix\textunderscore diagonal}\hlstd{}\hlsym{(}\hlstd{cov}\hlsym{)\ ;}\hspace*{\fill}\\
-\hlstd{\hspace*{\fill}\\
-}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{}\hlslc{//\ currently\ there\ is\ not\ a\ more\ direct\ interface\ in\ Rcpp::NumericVector}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{}\hlslc{//\ that\ takes\ advantage\ of\ wrap,\ so\ we\ have\ to\ do\ it\ in\ two\ steps}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{Rcpp}\hlsym{::}\hlstd{NumericVector\ std\textunderscore err\ }\hlsym{;\ }\hlstd{std\textunderscore err\ }\hlsym{=\ }\hlstd{diag}\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{std}\hlsym{::}\hlstd{}\hlkwd{transform}\hlstd{}\hlsym{(\ }\hlstd{std\textunderscore err}\hlsym{.}\hlstd{}\hlkwd{begin}\hlstd{}\hlsym{(),\ }\hlstd{std\textunderscore err}\hlsym{.}\hlstd{}\hlkwd{end}\hlstd{}\hlsym{(),\ }\hlstd{std\textunderscore err}\hlsym{.}\hlstd{}\hlkwd{begin}\hlstd{}\hlsym{(),\ }\hlstd{sqrt}\hlsym{);}\hspace*{\fill}\\
-\hlstd{\hspace*{\fill}\\
-}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{Rcpp}\hlsym{::}\hlstd{List\ res\ }\hlsym{=\ }\hlstd{Rcpp}\hlsym{::}\hlstd{List}\hlsym{::}\hlstd{}\hlkwd{create}\hlstd{}\hlsym{(}\hlstd{Rcpp}\hlsym{::}\hlstd{}\hlkwd{Named}\hlstd{}\hlsym{(}\hlstd{}\hlstr{"coefficients"}\hlstd{}\hlsym{)\ =\ }\hlstd{coef}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{Rcpp}\hlsym{::}\hlstd{}\hlkwd{Named}\hlstd{}\hlsym{(}\hlstd{}\hlstr{"stderr"}\hlstd{}\hlsym{)\ =\ }\hlstd{std\textunderscore err}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{Rcpp}\hlsym{::}\hlstd{}\hlkwd{Named}\hlstd{}\hlsym{(}\hlstd{}\hlstr{"df"}\hlstd{}\hlsym{)\ =\ }\hlstd{n\ }\hlsym{{-}\ }\hlstd{k}\hlsym{);}\hspace*{\fill}\\
-\hlstd{\hspace*{\fill}\\
-}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{}\hlslc{//\ free\ all\ the\ GSL\ vectors\ and\ matrices\ {-}{-}\ as\ these\ are\ really\ C\ data\ structures}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{}\hlslc{//\ we\ cannot\ take\ advantage\ of\ automatic\ memory\ management}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{coef}\hlsym{.}\hlstd{}\hlkwd{free}\hlstd{}\hlsym{();\ }\hlstd{cov}\hlsym{.}\hlstd{}\hlkwd{free}\hlstd{}\hlsym{();\ }\hlstd{y}\hlsym{.}\hlstd{}\hlkwd{free}\hlstd{}\hlsym{();\ }\hlstd{X}\hlsym{.}\hlstd{}\hlkwd{free}\hlstd{}\hlsym{();}\hspace*{\fill}\\
-\hlstd{\hspace*{\fill}\\
-}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{}\hlkwa{return\ }\hlstd{res}\hlsym{;}\hlstd{\ \ \ \ }\hlsym{}\hlstd{}\hlslc{//\ return\ the\ result\ list\ to\ R}\hspace*{\fill}\\
-\hlstd{\hspace*{\fill}\\
-}\hlstd{\ \ }\hlstd{}\hlsym{\usebox{\hlsmallboxclosebrace}\ }\hlstd{}\hlkwa{catch}\hlstd{}\hlsym{(\ }\hlstd{std}\hlsym{::}\hlstd{exception\ }\hlsym{\&}\hlstd{ex\ }\hlsym{)\ \usebox{\hlsmallboxopenbrace}}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{}\hlkwd{forward\textunderscore exception\textunderscore to\textunderscore r}\hlstd{}\hlsym{(\ }\hlstd{ex\ }\hlsym{);}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlsym{\usebox{\hlsmallboxclosebrace}\ }\hlstd{}\hlkwa{catch}\hlstd{}\hlsym{(...)\ \usebox{\hlsmallboxopenbrace}}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ }\hlstd{}\hlsym{::}\hlstd{}\hlkwd{Rf\textunderscore error}\hlstd{}\hlsym{(\ }\hlstd{}\hlstr{"c++\ exception\ (unknown\ reason)"}\hlstd{\ }\hlsym{);}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlsym{\usebox{\hlsmallboxclosebrace}}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwa{return\ }\hlstd{R\textunderscore NilValue}\hlsym{;\ }\hlstd{}\hlslc{//\ {-}Wall}\hspace*{\fill}\\
-\hlstd{}\hlsym{\usebox{\hlsmallboxclosebrace}}\hlstd{}\hspace*{\fill}\\
-\mbox{}
-\normalfont
-\end{Hchunk}\vspace{1em}
-\end{small}
 
-
 We first initialize a \textsl{RcppGSL} vector and matrix, each templated to
 the standard numeric type \texttt{double} (and the GSL supports other types
 ranging from lower precision floating point to signed and unsigned integers
@@ -278,134 +224,66 @@
 data, similar to \proglang{R} arrays. For example the \verb|gsl_vector| and \verb|gsl_vector_int|
 structs are defined as:
 
-% < < vector_int,lang=cpp,size=small > > =
-% typedef struct{
-%   size_t size;
-%   size_t stride;
-%   double * data;
-%   gsl_block * block;
-%   int owner;
-% } gsl_vector;
+<<vector_int,lang=cpp,size=small>>=
+typedef struct{
+  size_t size;
+  size_t stride;
+  double * data;
+  gsl_block * block;
+  int owner;
+} gsl_vector;
 
-% typedef struct {
-%   size_t size;
-%   size_t stride;
-%   int * data;
-%   gsl_block_int * block;
-%   int owner;
-% }
-% gsl_vector_int;
-% @
+typedef struct {
+  size_t size;
+  size_t stride;
+  int * data;
+  gsl_block_int * block;
+  int owner;
+}
+gsl_vector_int;
+@
 
-\begin{small}
-\begin{Hchunk}
-\noindent
-\ttfamily
-\hlstd{}\hlkwc{typedef\ }\hlstd{}\hlkwb{struct}\hlstd{}\hlsym{\usebox{\hlsmallboxopenbrace}}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwb{size\textunderscore t\ }\hlstd{size}\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwb{size\textunderscore t\ }\hlstd{stride}\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwb{double\ }\hlstd{}\hlsym{{*}\ }\hlstd{data}\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{gsl\textunderscore block\ }\hlsym{{*}\ }\hlstd{block}\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwb{int\ }\hlstd{owner}\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlsym{\usebox{\hlsmallboxclosebrace}\ }\hlstd{gsl\textunderscore vector}\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hspace*{\fill}\\
-\hlkwc{typedef\ }\hlstd{}\hlkwb{struct\ }\hlstd{}\hlsym{\usebox{\hlsmallboxopenbrace}}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwb{size\textunderscore t\ }\hlstd{size}\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwb{size\textunderscore t\ }\hlstd{stride}\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwb{int\ }\hlstd{}\hlsym{{*}\ }\hlstd{data}\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{gsl\textunderscore block\textunderscore int\ }\hlsym{{*}\ }\hlstd{block}\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwb{int\ }\hlstd{owner}\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlsym{\usebox{\hlsmallboxclosebrace}}\hspace*{\fill}\\
-\hlstd{gsl\textunderscore vector\textunderscore int}\hlsym{;}\hlstd{}\hspace*{\fill}\\
-\mbox{}
-\normalfont
-\end{Hchunk}\vspace{1em}
-\end{small}
 
-
 A typical use of the \verb|gsl_vector| struct is given below:
 
-% < <vector_free,lang=cpp,size=small> > =
-% int i;
-% gsl_vector * v = gsl_vector_alloc (3);  // allocate a gsl_vector of size 3
+<<vector_free,lang=cpp,size=small>>=
+int i;
+gsl_vector * v = gsl_vector_alloc (3);  // allocate a gsl_vector of size 3
 
-% for (i = 0; i < 3; i++) {               // fill the vector
-%   gsl_vector_set (v, i, 1.23 + i);
-% }
+for (i = 0; i < 3; i++) {               // fill the vector
+  gsl_vector_set (v, i, 1.23 + i);
+}
 
-% double sum = 0.0 ;                      // access elements
-% for (i = 0; i < 3; i++) {
-%   sum += gsl_vector_set( v, i ) ;
-% }
+double sum = 0.0 ;                      // access elements
+for (i = 0; i < 3; i++) {
+  sum += gsl_vector_set( v, i ) ;
+}
 
-% gsl_vector_free (v);                    // free the memory
-% @
+gsl_vector_free (v);                    // free the memory
+@
 
-\begin{small}
-\begin{Hchunk}
-\noindent
-\ttfamily
-\hlstd{}\hlkwb{int\ }\hlstd{i}\hlsym{;}\hspace*{\fill}\\
-\hlstd{gsl\textunderscore vector\ }\hlsym{{*}\ }\hlstd{v\ }\hlsym{=\ }\hlstd{}\hlkwd{gsl\textunderscore vector\textunderscore alloc\ }\hlstd{}\hlsym{(}\hlstd{}\hlnum{3}\hlstd{}\hlsym{);}\hlstd{\ \ }\hlsym{}\hlstd{}\hlslc{//\ allocate\ a\ gsl\textunderscore vector\ of\ size\ 3}\hspace*{\fill}\\
-\hlstd{}\hspace*{\fill}\\
-\hlkwa{for\ }\hlstd{}\hlsym{(}\hlstd{i\ }\hlsym{=\ }\hlstd{}\hlnum{0}\hlstd{}\hlsym{;\ }\hlstd{i\ }\hlsym{\usebox{\hlsmallboxlessthan}\ }\hlstd{}\hlnum{3}\hlstd{}\hlsym{;\ }\hlstd{i}\hlsym{++)\ \usebox{\hlsmallboxopenbrace}}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlsym{}\hlstd{}\hlslc{//\ fill\ the\ vector}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwd{gsl\textunderscore vector\textunderscore set\ }\hlstd{}\hlsym{(}\hlstd{v}\hlsym{,\ }\hlstd{i}\hlsym{,\ }\hlstd{}\hlnum{1.23\ }\hlstd{}\hlsym{+\ }\hlstd{i}\hlsym{);}\hspace*{\fill}\\
-\hlstd{}\hlsym{\usebox{\hlsmallboxclosebrace}}\hspace*{\fill}\\
-\hlstd{}\hspace*{\fill}\\
-\hlkwb{double\ }\hlstd{sum\ }\hlsym{=\ }\hlstd{}\hlnum{0.0\ }\hlstd{}\hlsym{;}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlsym{}\hlstd{}\hlslc{//\ access\ elements}\hspace*{\fill}\\
-\hlstd{}\hlkwa{for\ }\hlstd{}\hlsym{(}\hlstd{i\ }\hlsym{=\ }\hlstd{}\hlnum{0}\hlstd{}\hlsym{;\ }\hlstd{i\ }\hlsym{\usebox{\hlsmallboxlessthan}\ }\hlstd{}\hlnum{3}\hlstd{}\hlsym{;\ }\hlstd{i}\hlsym{++)\ \usebox{\hlsmallboxopenbrace}}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{sum\ }\hlsym{+=\ }\hlstd{}\hlkwd{gsl\textunderscore vector\textunderscore set}\hlstd{}\hlsym{(\ }\hlstd{v}\hlsym{,\ }\hlstd{i\ }\hlsym{)\ ;}\hspace*{\fill}\\
-\hlstd{}\hlsym{\usebox{\hlsmallboxclosebrace}}\hspace*{\fill}\\
-\hlstd{}\hspace*{\fill}\\
-\hlkwd{gsl\textunderscore vector\textunderscore free\ }\hlstd{}\hlsym{(}\hlstd{v}\hlsym{);}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlsym{}\hlstd{}\hlslc{//\ free\ the\ memory}\hlstd{}\hspace*{\fill}\\
-\mbox{}
-\normalfont
-\end{Hchunk}\vspace{1em}
-\end{small}
-
 \subsection{RcppGSL::vector}
 
 \pkg{RcppGSL} defines the template \texttt{RcppGSL::vector<T>} to manipulate
 \verb|gsl_vector| pointers taking advantage of C++ templates. Using this
 template type, the previous example now becomes:
 
-% < < vector_sum,lang=cpp,size=small > > =
-% int i;
-% RcppGSL::vector<double> v(3);           // allocate a gsl_vector of size 3
+<<vector_sum,lang=cpp,size=small>>=
+int i;
+RcppGSL::vector<double> v(3);           // allocate a gsl_vector of size 3
 
-% for (i = 0; i < 3; i++) {               // fill the vector
-%   v[i] = 1.23 + i ;
-% }
+for (i = 0; i < 3; i++) {               // fill the vector
+  v[i] = 1.23 + i ;
+}
 
-% double sum = 0.0 ;                      // access elements
-% for (i = 0; i < 3; i++) {
-%   sum += v[i] ;
-% }
+double sum = 0.0 ;                      // access elements
+for (i = 0; i < 3; i++) {
+  sum += v[i] ;
+}
 
-% v.free() ;                              // free the memory
-% @
+v.free() ;                              // free the memory
+@
 
-\begin{small}
-\begin{Hchunk}
-\noindent
-\ttfamily
-\hlstd{}\hlkwb{int\ }\hlstd{i}\hlsym{;}\hspace*{\fill}\\
-\hlstd{RcppGSL}\hlsym{::}\hlstd{vector}\hlsym{\usebox{\hlsmallboxlessthan}}\hlstd{}\hlkwb{double}\hlstd{}\hlsym{\usebox{\hlsmallboxgreaterthan}\ }\hlstd{}\hlkwd{v}\hlstd{}\hlsym{(}\hlstd{}\hlnum{3}\hlstd{}\hlsym{);}\hlstd{\ \ \ \ \ \ \ \ \ \ \ }\hlsym{}\hlstd{}\hlslc{//\ allocate\ a\ gsl\textunderscore vector\ of\ size\ 3}\hspace*{\fill}\\
-\hlstd{}\hspace*{\fill}\\
-\hlkwa{for\ }\hlstd{}\hlsym{(}\hlstd{i\ }\hlsym{=\ }\hlstd{}\hlnum{0}\hlstd{}\hlsym{;\ }\hlstd{i\ }\hlsym{\usebox{\hlsmallboxlessthan}\ }\hlstd{}\hlnum{3}\hlstd{}\hlsym{;\ }\hlstd{i}\hlsym{++)\ \usebox{\hlsmallboxopenbrace}}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlsym{}\hlstd{}\hlslc{//\ fill\ the\ vector}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{v}\hlsym{{[}}\hlstd{i}\hlsym{{]}\ =\ }\hlstd{}\hlnum{1.23\ }\hlstd{}\hlsym{+\ }\hlstd{i\ }\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlsym{\usebox{\hlsmallboxclosebrace}}\hspace*{\fill}\\
-\hlstd{}\hspace*{\fill}\\
-\hlkwb{double\ }\hlstd{sum\ }\hlsym{=\ }\hlstd{}\hlnum{0.0\ }\hlstd{}\hlsym{;}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlsym{}\hlstd{}\hlslc{//\ access\ elements}\hspace*{\fill}\\
-\hlstd{}\hlkwa{for\ }\hlstd{}\hlsym{(}\hlstd{i\ }\hlsym{=\ }\hlstd{}\hlnum{0}\hlstd{}\hlsym{;\ }\hlstd{i\ }\hlsym{\usebox{\hlsmallboxlessthan}\ }\hlstd{}\hlnum{3}\hlstd{}\hlsym{;\ }\hlstd{i}\hlsym{++)\ \usebox{\hlsmallboxopenbrace}}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{sum\ }\hlsym{+=\ }\hlstd{v}\hlsym{{[}}\hlstd{i}\hlsym{{]}\ ;}\hspace*{\fill}\\
-\hlstd{}\hlsym{\usebox{\hlsmallboxclosebrace}}\hspace*{\fill}\\
-\hlstd{\hspace*{\fill}\\
-v}\hlsym{.}\hlstd{}\hlkwd{free}\hlstd{}\hlsym{()\ ;}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlsym{}\hlstd{}\hlslc{//\ free\ the\ memory}\hlstd{}\hspace*{\fill}\\
-\mbox{}
-\normalfont
-\end{Hchunk}\vspace{1em}
-\end{small}
 
 The class \texttt{RcppGSL::vector<double>} is a smart pointer, that can be used
 anywhere where a raw pointer \verb|gsl_vector| can be used, such as the
@@ -418,27 +296,14 @@
 \verb|sum_gsl_vector_int| that operates on a \verb|gsl_vector_int| through
 the \texttt{RcppGSL::vector<int>} template specialization:
 
-% < <macro,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
-%   return res ;
-% }
-% @
+<<macro,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
+  return res ;
+}
+@
 
-\begin{small}
-\begin{Hchunk}
-\noindent
-\ttfamily
-\hlstd{}\hlkwd{RCPP\textunderscore FUNCTION\textunderscore 1}\hlstd{}\hlsym{(\ }\hlstd{}\hlkwb{int}\hlstd{}\hlsym{,\ }\hlstd{sum\textunderscore gsl\textunderscore vector\textunderscore int}\hlsym{,\ }\hlstd{RcppGSL}\hlsym{::}\hlstd{vector}\hlsym{\usebox{\hlsmallboxlessthan}}\hlstd{}\hlkwb{int}\hlstd{}\hlsym{\usebox{\hlsmallboxgreaterthan}\ }\hlstd{vec}\hlsym{)\usebox{\hlsmallboxopenbrace}}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwb{int\ }\hlstd{res\ }\hlsym{=\ }\hlstd{std}\hlsym{::}\hlstd{}\hlkwd{accumulate}\hlstd{}\hlsym{(\ }\hlstd{vec}\hlsym{.}\hlstd{}\hlkwd{begin}\hlstd{}\hlsym{(),\ }\hlstd{vec}\hlsym{.}\hlstd{}\hlkwd{end}\hlstd{}\hlsym{(),\ }\hlstd{}\hlnum{0\ }\hlstd{}\hlsym{)\ ;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{vec}\hlsym{.}\hlstd{}\hlkwd{free}\hlstd{}\hlsym{()\ ;}\hlstd{\ \ }\hlsym{}\hlstd{}\hlslc{//\ we\ need\ to\ free\ vec\ after\ use}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwa{return\ }\hlstd{res\ }\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlsym{\usebox{\hlsmallboxclosebrace}}\hlstd{}\hspace*{\fill}\\
-\mbox{}
-\normalfont
-\end{Hchunk}\vspace{1em}
-\end{small}
 
 
 The function can then simply be called from \proglang{R} :
@@ -460,53 +325,27 @@
 R list as \verb|gsl_vector| objects using implicit conversion mechanisms
 of \pkg{Rcpp}
 
-%< < example2,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"] ;
+<<example2,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"] ;
 
-%   // grab "y" as a gsl_vector through the RcppGSL::vector<int> class
-%   RcppGSL::vector<int> y = data["y"] ;
-%   double res = 0.0 ;
-%   for( size_t i=0; i< x->size; i++){
-%     res += x[i] * y[i] ;
-%   }
+  // grab "y" as a gsl_vector through the RcppGSL::vector<int> class
+  RcppGSL::vector<int> y = data["y"] ;
+  double res = 0.0 ;
+  for( size_t i=0; i< x->size; i++){
+    res += x[i] * y[i] ;
+  }
 
-%   // as usual with GSL, we need to explicitely free the memory
-%   x.free() ;
-%   y.free() ;
+  // as usual with GSL, we need to explicitely free the memory
+  x.free() ;
+  y.free() ;
 
-%   // return the result
-%   return res ;
-% }
-% @
+  // return the result
+  return res ;
+}
+@
 
-\begin{small}
-\begin{Hchunk}
-\noindent
-\ttfamily
-\hlstd{}\hlkwd{RCPP\textunderscore FUNCTION\textunderscore 1}\hlstd{}\hlsym{(\ }\hlstd{}\hlkwb{double}\hlstd{}\hlsym{,\ }\hlstd{gsl\textunderscore vector\textunderscore sum\textunderscore 2}\hlsym{,\ }\hlstd{Rcpp}\hlsym{::}\hlstd{List\ data\ }\hlsym{)\usebox{\hlsmallboxopenbrace}}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlslc{//\ grab\ "x"\ as\ a\ gsl\textunderscore vector\ through\ the\ RcppGSL::vector\usebox{\hlsmallboxlessthan}double\usebox{\hlsmallboxgreaterthan}\ class}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{RcppGSL}\hlsym{::}\hlstd{vector}\hlsym{\usebox{\hlsmallboxlessthan}}\hlstd{}\hlkwb{double}\hlstd{}\hlsym{\usebox{\hlsmallboxgreaterthan}\ }\hlstd{x\ }\hlsym{=\ }\hlstd{data}\hlsym{{[}}\hlstd{}\hlstr{"x"}\hlstd{}\hlsym{{]}\ ;}\hspace*{\fill}\\
-\hlstd{\hspace*{\fill}\\
-}\hlstd{\ \ }\hlstd{}\hlslc{//\ grab\ "y"\ as\ a\ gsl\textunderscore vector\ through\ the\ RcppGSL::vector\usebox{\hlsmallboxlessthan}int\usebox{\hlsmallboxgreaterthan}\ class}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{RcppGSL}\hlsym{::}\hlstd{vector}\hlsym{\usebox{\hlsmallboxlessthan}}\hlstd{}\hlkwb{int}\hlstd{}\hlsym{\usebox{\hlsmallboxgreaterthan}\ }\hlstd{y\ }\hlsym{=\ }\hlstd{data}\hlsym{{[}}\hlstd{}\hlstr{"y"}\hlstd{}\hlsym{{]}\ ;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwb{double\ }\hlstd{res\ }\hlsym{=\ }\hlstd{}\hlnum{0.0\ }\hlstd{}\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwa{for}\hlstd{}\hlsym{(\ }\hlstd{}\hlkwb{size\textunderscore t\ }\hlstd{i}\hlsym{=}\hlstd{}\hlnum{0}\hlstd{}\hlsym{;\ }\hlstd{i}\hlsym{\usebox{\hlsmallboxlessthan}\ }\hlstd{x}\hlsym{{-}\usebox{\hlsmallboxgreaterthan}}\hlstd{size}\hlsym{;\ }\hlstd{i}\hlsym{++)\usebox{\hlsmallboxopenbrace}}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ }\hlstd{res\ }\hlsym{+=\ }\hlstd{x}\hlsym{{[}}\hlstd{i}\hlsym{{]}\ {*}\ }\hlstd{y}\hlsym{{[}}\hlstd{i}\hlsym{{]}\ ;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlsym{\usebox{\hlsmallboxclosebrace}}\hspace*{\fill}\\
-\hlstd{\hspace*{\fill}\\
-}\hlstd{\ \ }\hlstd{}\hlslc{//\ as\ usual\ with\ GSL,\ we\ need\ to\ explicitely\ free\ the\ memory}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{x}\hlsym{.}\hlstd{}\hlkwd{free}\hlstd{}\hlsym{()\ ;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{y}\hlsym{.}\hlstd{}\hlkwd{free}\hlstd{}\hlsym{()\ ;}\hspace*{\fill}\\
-\hlstd{\hspace*{\fill}\\
-}\hlstd{\ \ }\hlstd{}\hlslc{//\ return\ the\ result}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwa{return\ }\hlstd{res\ }\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlsym{\usebox{\hlsmallboxclosebrace}}\hlstd{}\hspace*{\fill}\\
-\mbox{}
-\normalfont
-\end{Hchunk}\vspace{1em}
-\end{small}
 
 called from \proglang{R} :
 
@@ -577,50 +416,25 @@
 type. \pkg{RcppGSL} defines the template class \texttt{RcppGSL::vector\_view}
 to handle vector views using \proglang{C++} syntax.
 
-% < < lang=cpp,size=small > > =
-% extern "C" SEXP test_gsl_vector_view(){
-%   int n = 10 ;
-%   RcppGSL::vector<double> v(n) ;
-%   for( int i=0 ; i<n; i++){
-%     v[i] = i ;
-%   }
-%   RcppGSL::vector_view<double> v_even = gsl_vector_subvector_with_stride(v,0,2,n/2);
-%   RcppGSL::vector_view<double> v_odd  = gsl_vector_subvector_with_stride(v,1,2,n/2);
+<<lang=cpp,size=small>>=
+extern "C" SEXP test_gsl_vector_view(){
+  int n = 10 ;
+  RcppGSL::vector<double> v(n) ;
+  for( int i=0 ; i<n; i++){
+    v[i] = i ;
+  }
+  RcppGSL::vector_view<double> v_even = gsl_vector_subvector_with_stride(v,0,2,n/2);
+  RcppGSL::vector_view<double> v_odd  = gsl_vector_subvector_with_stride(v,1,2,n/2);
 
-%   List res = List::create(
-%     _["even"] = v_even,
-%     _["odd" ] = v_odd
-%     ) ;
-%   v.free() ;  	// we only need to free v, the views do not own data
-%   return res ;
-% }
-% @
+  List res = List::create(
+    _["even"] = v_even,
+    _["odd" ] = v_odd
+    ) ;
+  v.free() ;  	// we only need to free v, the views do not own data
+  return res ;
+}
+@
 
-\begin{small}
-\begin{Hchunk}
-\noindent
-\ttfamily
-\hlstd{}\hlkwc{extern\ }\hlstd{}\hlstr{"C"}\hlstd{\ SEXP\ }\hlkwd{test\textunderscore gsl\textunderscore vector\textunderscore view}\hlstd{}\hlsym{()\usebox{\hlsmallboxopenbrace}}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwb{int\ }\hlstd{n\ }\hlsym{=\ }\hlstd{}\hlnum{10\ }\hlstd{}\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{RcppGSL}\hlsym{::}\hlstd{vector}\hlsym{\usebox{\hlsmallboxlessthan}}\hlstd{}\hlkwb{double}\hlstd{}\hlsym{\usebox{\hlsmallboxgreaterthan}\ }\hlstd{}\hlkwd{v}\hlstd{}\hlsym{(}\hlstd{n}\hlsym{)\ ;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwa{for}\hlstd{}\hlsym{(\ }\hlstd{}\hlkwb{int\ }\hlstd{i}\hlsym{=}\hlstd{}\hlnum{0\ }\hlstd{}\hlsym{;\ }\hlstd{i}\hlsym{\usebox{\hlsmallboxlessthan}}\hlstd{n}\hlsym{;\ }\hlstd{i}\hlsym{++)\usebox{\hlsmallboxopenbrace}}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ }\hlstd{v}\hlsym{{[}}\hlstd{i}\hlsym{{]}\ =\ }\hlstd{i\ }\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlsym{\usebox{\hlsmallboxclosebrace}}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{RcppGSL}\hlsym{::}\hlstd{vector\textunderscore view}\hlsym{\usebox{\hlsmallboxlessthan}}\hlstd{}\hlkwb{double}\hlstd{}\hlsym{\usebox{\hlsmallboxgreaterthan}\ }\hlstd{v\textunderscore even\ }\hlsym{=\ }\hlstd{}\hlkwd{gsl\textunderscore vector\textunderscore subvector\textunderscore with\textunderscore stride}\hlstd{}\hlsym{(}\hlstd{v}\hlsym{,}\hlstd{}\hlnum{0}\hlstd{}\hlsym{,}\hlstd{}\hlnum{2}\hlstd{}\hlsym{,}\hlstd{n}\hlsym{/}\hlstd{}\hlnum{2}\hlstd{}\hlsym{);}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{RcppGSL}\hlsym{::}\hlstd{vector\textunderscore view}\hlsym{\usebox{\hlsmallboxlessthan}}\hlstd{}\hlkwb{double}\hlstd{}\hlsym{\usebox{\hlsmallboxgreaterthan}\ }\hlstd{v\textunderscore odd}\hlstd{\ \ }\hlstd{}\hlsym{=\ }\hlstd{}\hlkwd{gsl\textunderscore vector\textunderscore subvector\textunderscore with\textunderscore stride}\hlstd{}\hlsym{(}\hlstd{v}\hlsym{,}\hlstd{}\hlnum{1}\hlstd{}\hlsym{,}\hlstd{}\hlnum{2}\hlstd{}\hlsym{,}\hlstd{n}\hlsym{/}\hlstd{}\hlnum{2}\hlstd{}\hlsym{);}\hspace*{\fill}\\
-\hlstd{\hspace*{\fill}\\
-}\hlstd{\ \ }\hlstd{List\ res\ }\hlsym{=\ }\hlstd{List}\hlsym{::}\hlstd{}\hlkwd{create}\hlstd{}\hlsym{(}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ }\hlstd{\textunderscore }\hlsym{{[}}\hlstd{}\hlstr{"even"}\hlstd{}\hlsym{{]}\ =\ }\hlstd{v\textunderscore even}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ }\hlstd{\textunderscore }\hlsym{{[}}\hlstd{}\hlstr{"odd"}\hlstd{\ }\hlsym{{]}\ =\ }\hlstd{v\textunderscore odd\hspace*{\fill}\\
-}\hlstd{\ \ \ \ }\hlstd{}\hlsym{)\ ;}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{v}\hlsym{.}\hlstd{}\hlkwd{free}\hlstd{}\hlsym{()\ ;}\hlstd{\ \ \ }\hlsym{}\hlstd{}\hlslc{//\ we\ only\ need\ to\ free\ v,\ the\ views\ do\ not\ own\ data}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwa{return\ }\hlstd{res\ }\hlsym{;}\hspace*{\fill}\\
-\hlstd{}\hlsym{\usebox{\hlsmallboxclosebrace}}\hlstd{}\hspace*{\fill}\\
-\mbox{}
-\normalfont
-\end{Hchunk}\vspace{1em}
-\end{small}
-
 As with vectors, \proglang{C++} objects of type
 \texttt{RcppGSL::vector\_view} can be converted implicitly to their
 associated \pkg{GSL} view type. Table~\ref{tab:mappingVectorViews} displays
@@ -672,33 +486,17 @@
 
 The \texttt{RcppGSL::matrix} template exposes three constructors.
 
-% < < lang=cpp,size=small > > =
-% // convert an R matrix to a GSL matrix
-% matrix( SEXP x) throw(::Rcpp::not_compatible)
+<<lang=cpp,size=small>>=
+// convert an R matrix to a GSL matrix
+matrix( SEXP x) throw(::Rcpp::not_compatible)
 
-% // encapsulate a GSL matrix pointer
-% matrix( gsl_matrix* x)
+// encapsulate a GSL matrix pointer
+matrix( gsl_matrix* x)
 
-% // create a new matrix with the given number of rows and columns
-% matrix( int nrow, int ncol)
-% @
+// create a new matrix with the given number of rows and columns
+matrix( int nrow, int ncol)
+@
 
-\begin{small}
-\begin{Hchunk}
-\noindent
-\ttfamily
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/rcpp -r 4358


More information about the Rcpp-commits mailing list