Rcpp Version 0.9.10
convolve11_cpp.cpp
Go to the documentation of this file.
00001 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
00002 
00003 // This version uses nona to indicate that xb does not contain any missing
00004 // value. This is the assumption that all other versions do.
00005 
00006 #include <Rcpp.h>
00007 using namespace Rcpp ;
00008 
00009 
00010 RcppExport SEXP convolve11cpp(SEXP a, SEXP b) {
00011     NumericVector xa(a); int n_xa = xa.size() ;
00012     NumericVector xb(b); int n_xb = xb.size() ;
00013     NumericVector xab(n_xa + n_xb - 1,0.0);
00014     
00015     Range r( 0, n_xb-1 );
00016     for(int i=0; i<n_xa; i++, r++){
00017         xab[ r ] += noNA(xa[i]) * noNA(xb) ;
00018     }
00019     return xab ;
00020 }
00021 
00022 #include "loopmacro.h"
00023 LOOPMACRO_CPP(convolve11cpp)
00024 
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Defines