[Rcpp-commits] r2593 - in pkg/RcppGSL: inst/doc/RcppGSL inst/examples/RcppGSLExample/man src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Nov 29 15:48:16 CET 2010
Author: edd
Date: 2010-11-29 15:48:16 +0100 (Mon, 29 Nov 2010)
New Revision: 2593
Modified:
pkg/RcppGSL/inst/doc/RcppGSL/RcppGSL.Rnw
pkg/RcppGSL/inst/examples/RcppGSLExample/man/colNorm.Rd
pkg/RcppGSL/src/Makevars.in
Log:
slightly more R-like code in example for matrix creation
Modified: pkg/RcppGSL/inst/doc/RcppGSL/RcppGSL.Rnw
===================================================================
--- pkg/RcppGSL/inst/doc/RcppGSL/RcppGSL.Rnw 2010-11-29 13:40:08 UTC (rev 2592)
+++ pkg/RcppGSL/inst/doc/RcppGSL/RcppGSL.Rnw 2010-11-29 14:48:16 UTC (rev 2593)
@@ -426,6 +426,12 @@
\label{tab:mappingVectorViews}
\end{table}
+The \texttt{getVector()} member function returns the underlying vector stored
+in the vector view class. This enables use of vector views where \pkg{GSL}
+would expect a vector.
+
+
+
\section{Matrices}
The \pkg{GSL} also defines a set of matrix data types : \texttt{gsl\_matrix},
@@ -491,6 +497,12 @@
\end{itemize}
\end{quote}
+\subsection{Matrix views}
+
+Similar to the vector views discussed above, the \pkg{RcppGSL} also provides
+view variants of matrices. Here, the \texttt{getMatrix()} member function
+returns the underlying matrix stored in the matrix view class.
+
\section{Using \pkg{RcppGSL} in your package}
The \pkg{RcppGSL} package contains a complete example providing a single
@@ -641,8 +653,7 @@
foo <- cxxfunction(signature(sM="numeric"), body=bodytxt, inc=inctxt, plugin="RcppGSL")
-M <- matrix(sin(0:9), nrow=10, ncol=1) %*% matrix(1, ncol=10) +
- matrix(1, nrow=10) %*% matrix(cos(0:9), ncol=10)
+M <- outer(sin(0:9), rep(1,10), "*") + outer(rep(1, 10), cos(0:9), "*")
print(foo(M))
@
Modified: pkg/RcppGSL/inst/examples/RcppGSLExample/man/colNorm.Rd
===================================================================
--- pkg/RcppGSL/inst/examples/RcppGSLExample/man/colNorm.Rd 2010-11-29 13:40:08 UTC (rev 2592)
+++ pkg/RcppGSL/inst/examples/RcppGSLExample/man/colNorm.Rd 2010-11-29 14:48:16 UTC (rev 2593)
@@ -30,7 +30,7 @@
}
\examples{
## see Section 8.4.13 of the GSL manual
- M <- matrix(sin(0:9), nrow=10, ncol=1) %*% matrix(1, ncol=10) + matrix(1, nrow=10) %*% matrix(cos(0:9), ncol=10)
+ M <- outer(sin(0:9), rep(1,10), "*") + outer(rep(1, 10), cos(0:9), "*")
print(colNorm(M))
}
Modified: pkg/RcppGSL/src/Makevars.in
===================================================================
--- pkg/RcppGSL/src/Makevars.in 2010-11-29 13:40:08 UTC (rev 2592)
+++ pkg/RcppGSL/src/Makevars.in 2010-11-29 14:48:16 UTC (rev 2593)
@@ -4,7 +4,7 @@
GSL_LIBS = @GSL_LIBS@
RCPP_LDFLAGS = @RCPP_LDFLAGS@
-# combine to standard arguments for R
+# combine with standard arguments for R
PKG_CPPFLAGS = -W $(GSL_CFLAGS) -I../inst/include
PKG_LIBS = $(GSL_LIBS) $(RCPP_LDFLAGS)
More information about the Rcpp-commits
mailing list