Rcpp Version 1.0.14
Toggle main menu visibility
Main Page
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Variables
_
b
c
d
f
g
k
m
n
r
t
y
Typedefs
c
d
e
f
g
i
l
n
p
r
s
t
v
w
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Typedefs
_
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
y
Enumerator
r
v
Related Symbols
o
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
x
y
Functions
a
c
d
e
f
g
i
l
m
o
p
r
s
Variables
Typedefs
Macros
_
a
b
c
d
e
g
h
i
j
l
m
n
o
r
s
t
u
v
y
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerator
Friends
Macros
Loading...
Searching...
No Matches
convolve12_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
7
RcppExport
SEXP
convolve12cpp
(SEXP a, SEXP b){
8
Rcpp::NumericVector
xa(a), xb(b);
9
int
n_xa = xa.size(), n_xb = xb.
size
();
10
Rcpp::NumericVector
xab(n_xa + n_xb - 1);
11
12
typedef
Rcpp::NumericVector::iterator
vec_iterator ;
13
vec_iterator ia = xa.begin(), ib = xb.
begin
();
14
vec_iterator iab = xab.
begin
();
15
for
(
int
i = 0; i < n_xa; i++)
16
for
(
int
j = 0; j < n_xb; j++)
17
iab[i + j] += ia[i] * ib[j];
18
19
return
xab;
20
}
7
RcppExport
SEXP
convolve12cpp
(SEXP a, SEXP b) {
…
}
21
22
#include "
loopmacro.h
"
23
LOOPMACRO_CPP
(
convolve12cpp
)
24
RcppExport
#define RcppExport
Definition
RcppCommon.h:141
Rcpp.h
Rcpp::Vector
Definition
Vector.h:35
Rcpp::Vector::size
R_xlen_t size() const
Definition
Vector.h:275
Rcpp::Vector::begin
iterator begin()
Definition
Vector.h:333
Rcpp::Vector::iterator
traits::r_vector_iterator< RTYPE, StoragePolicy >::type iterator
Definition
Vector.h:45
convolve12cpp
RcppExport SEXP convolve12cpp(SEXP a, SEXP b)
Definition
convolve12_cpp.cpp:7
loopmacro.h
LOOPMACRO_CPP
#define LOOPMACRO_CPP(name)
Definition
loopmacro.h:12
inst
examples
ConvolveBenchmarks
convolve12_cpp.cpp
Generated on Sun Jan 12 2025 11:21:42 for Rcpp Version 1.0.14 by
1.9.8