celestialgod

Rcpp11

Oct 28th, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.29 KB | None | 0 0
  1. library(Rcpp)
  2. sourceCpp(code = '
  3. // [[Rcpp::plugins(cpp11)]]
  4. #include <RcppArmadillo.h>
  5. // [[Rcpp::depends(RcppArmadillo)]]
  6. using namespace Rcpp;
  7. // [[Rcpp::export]]
  8. arma::vec foo(arma::vec a){
  9.    a.transform( [](double val) { return (val + 123.0); } );
  10.    return a;
  11. }
  12. ')
  13. foo(1:3)
Advertisement
Add Comment
Please, Sign In to add comment