Rcpp Version 1.0.7
convolve5_cpp.cpp
Go to the documentation of this file.
1 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
2 
3 // This is a rewrite of the 'Writing R Extensions' section 5.10.1 example
4 
5 #include <Rcpp.h>
6 using namespace Rcpp ;
7 
8 
9 RcppExport SEXP convolve5cpp(SEXP a, SEXP b) {
10  NumericVector xa(a); int n_xa = xa.size() ;
11  NumericVector xb(b); int n_xb = xb.size() ;
12  NumericVector xab(n_xa + n_xb - 1,0.0);
13 
14  Range r( 0, n_xb-1 );
15  for(int i=0; i<n_xa; i++, r++){
16  xab[ r ] += xa[i] * xb ;
17  }
18  return xab ;
19 }
20 
21 #include "loopmacro.h"
23 
LOOPMACRO_CPP
#define LOOPMACRO_CPP(name)
Definition: loopmacro.h:12
loopmacro.h
RcppExport
#define RcppExport
Definition: RcppCommon.h:139
Rcpp::Vector::size
R_xlen_t size() const
Definition: Vector.h:276
Rcpp
Rcpp API.
Definition: algo.h:28
Rcpp::Vector
Definition: 00_forward_Vector.h:26
convolve5cpp
RcppExport SEXP convolve5cpp(SEXP a, SEXP b)
Definition: convolve5_cpp.cpp:9
Rcpp.h
Rcpp::Range
Definition: Range.h:27