4 suppressMessages(library(Rcpp))
5 suppressMessages(library(inline))
10 double *xa, *xb, *xab;
13 PROTECT(a = AS_NUMERIC(a));
14 PROTECT(b = AS_NUMERIC(b));
15 na = LENGTH(a); nb = LENGTH(b); nab = na + nb - 1;
16 PROTECT(ab = NEW_NUMERIC(nab));
17 xa = NUMERIC_POINTER(a); xb = NUMERIC_POINTER(b);
18 xab = NUMERIC_POINTER(ab);
19 for(i = 0; i < nab; i++) xab[i] = 0.0;
20 for(i = 0; i < na; i++)
21 for(j = 0; j < nb; j++) xab[i + j] += xa[i] * xb[j];
26 funx <- cfunction(signature(a="numeric",b="numeric"), foo, Rcpp=FALSE, verbose=FALSE)