Rcpp Version 1.0.9
convolve11_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 version uses nona to indicate that xb does not contain any missing
4
// value. This is the assumption that all other versions do.
5
6
#include <
Rcpp.h
>
7
using namespace
Rcpp
;
8
9
10
RcppExport
SEXP
convolve11cpp
(SEXP a, SEXP b) {
11
NumericVector
xa(a);
int
n_xa = xa.
size
() ;
12
NumericVector
xb(b);
int
n_xb = xb.
size
() ;
13
NumericVector
xab(n_xa + n_xb - 1,0.0);
14
15
Range
r( 0, n_xb-1 );
16
for
(
int
i=0; i<n_xa; i++, r++){
17
xab[ r ] +=
noNA
(xa[i]) *
noNA
(xb) ;
18
}
19
return
xab ;
20
}
21
22
#include "
loopmacro.h
"
23
LOOPMACRO_CPP
(
convolve11cpp
)
24
RcppExport
#define RcppExport
Definition:
RcppCommon.h:140
Rcpp.h
Rcpp::Range
Definition:
Range.h:27
Rcpp::Vector
Definition:
Vector.h:36
Rcpp::Vector::size
R_xlen_t size() const
Definition:
Vector.h:276
convolve11cpp
RcppExport SEXP convolve11cpp(SEXP a, SEXP b)
Definition:
convolve11_cpp.cpp:10
loopmacro.h
LOOPMACRO_CPP
#define LOOPMACRO_CPP(name)
Definition:
loopmacro.h:12
Rcpp
Rcpp API.
Definition:
algo.h:28
Rcpp::noNA
sugar::Nona< RTYPE, NA, VECTOR > noNA(const Rcpp::VectorBase< RTYPE, NA, VECTOR > &vec)
Definition:
nona.h:74
inst
examples
ConvolveBenchmarks
convolve11_cpp.cpp
Generated on Sat Jul 9 2022 09:14:51 for Rcpp Version 1.0.9 by
1.9.1