[Rcpp-devel] R.e. Rcpp compile question

Christian Gunning xian at unm.edu
Mon Mar 21 09:22:15 CET 2011


"Here's the command:"

Works for me.  Try sourcing the attached file (which includes your
command, +verbose=T), and post back the *full* results, including the
source('tmp.R.txt') command and the next prompt line.

-christian
--
A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
-------------- next part --------------
require(inline)
src <- '
Rcpp::NumericVector xa(a);
Rcpp::NumericVector xb(b);
int n_xa = xa.size(), n_xb = xb.size();

Rcpp::NumericVector xab(n_xa + n_xb - 1);
for (int i = 0; i < n_xa; i++)
for (int j = 0; j < n_xb; j++)
xab[i + j] += xa[i] * xb[j];
return xab;
' 
fun <- cxxfunction( signature(a="numeric", b="numeric"), src, plugin="Rcpp", verbose=TRUE)


More information about the Rcpp-devel mailing list