MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / convolve

Function convolve

inst/examples/ConvolveBenchmarks/convolve13_cpp.cpp:8–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6
7template <typename T>
8T convolve( const T& a, const T& b ){
9 int na = a.size() ; int nb = b.size() ;
10 T out(na + nb - 1);
11 typename T::iterator iter_a(a.begin()), iter_b(b.begin()), iter_ab( out.begin() ) ;
12
13 for (int i = 0; i < na; i++)
14 for (int j = 0; j < nb; j++)
15 iter_ab[i + j] += iter_a[i] * iter_b[j];
16
17 return out ;
18}
19
20
21RcppExport SEXP convolve13cpp(SEXP a, SEXP b){

Callers 1

convolve13cppFunction · 0.70

Calls 2

sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected