summaryrefslogtreecommitdiff
path: root/samples/inline.Rcpp
blob: b8d841e2156a892ddf376923bb0eba7305c43beb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
## inline functions are not working as yet, use cppFunction instead

require(inline)
require(RcppEigen)

runifXd <- cxxfunction(signature(arg1="integer"), plugin='RcppEigen',
                       includes='
RNGScope scope;
using namespace Eigen;

inline VectorXd runifXd(int size, double a=0., double b=1.) {
  return as<VectorXd>(runif(size, a, b));
}',
                       body='return wrap(runifXd(as<int>(arg1)));')