Skip to content

Commit 6ede6a3

Browse files
committed
don't have the vignette depend on RcppArmadillo which Travis does not load
1 parent 86288f7 commit 6ede6a3

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

vignettes/Rcpp-FAQ.Rnw

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -743,14 +743,28 @@ The \pkg{RcppEigen} package provides an alternative using the
743743

744744
Rcpp Attributes, once again, makes this even easier:
745745

746-
<<>>=
747-
cppFunction('arma::mat mult(arma::mat A, arma::mat B) { return A*B; }',
748-
depends="RcppArmadillo") # needed to use RcppArmadillo
746+
<<lang=cpp>>=
747+
748+
#include <RcppArmadillo.h>
749+
750+
// [[Rcpp::depends(RcppArmadillo)]]
751+
752+
// [[Rcpp::export]]
753+
arma::mat mult(arma::mat A, arma::mat B) {
754+
return A*B;
755+
}
756+
757+
/*** R
749758
A <- matrix(1:9, 3, 3)
750759
B <- matrix(9:1, 3, 3)
751760
mult(A,B)
761+
*/
752762
@
753763

764+
which can be built, and run, from R via a simple \rdoc{Rcpp}{sourceCpp}
765+
call---and will also run the small R example at the end.
766+
767+
754768
\subsection{How do I write a plugin for \pkg{inline} and/or Rcpp Attributes?}
755769

756770
\begin{quote}

0 commit comments

Comments
 (0)