An even more efficient version of the basic convolution example from Section 5.10.1 of 'Writing R Extensions', now rewritten for Rcpp and using Rcpp::NumericVector as well as direct pointer operations for better performance.
int nab = n_xa + n_xb - 1;
double* pa = xa.
begin() ;
double* pb = xb.
begin() ;
double* pab = xab.
begin() ;
int i,j=0;
for (i = 0; i < n_xa; i++)
for (j = 0; j < n_xb; j++)
pab[i + j] += pa[i] * pb[j];
return xab ;
}
RcppExport SEXP convolve4cpp(SEXP a, SEXP b)
#define LOOPMACRO_CPP(name)