Skip to content

Commit 2601b15

Browse files
committed
bring PlusReducer up one level
1 parent dfe01d8 commit 2601b15

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

inst/examples/examples-map-reduce-dot-product.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ double simdDotProduct(NumericVector x, NumericVector y)
6161
// this, we only need to express our map computation, as the
6262
// PlusReducer will provide the requisite 'combine', 'reduce'
6363
// and 'init' methods.
64-
class DotProductMapReducerV2 : public reduce::PlusReducer
64+
class DotProductMapReducerV2 : public PlusReducer
6565
{
6666
public:
6767
template <typename T>
@@ -80,8 +80,8 @@ double simdDotProductV2(NumericVector x, NumericVector y)
8080
/*** R
8181
# Generate some data
8282
set.seed(123)
83-
x <- rnorm(1E6)
84-
y <- rnorm(1E6)
83+
x <- runif(1E6)
84+
y <- runif(1E6)
8585
8686
# Ensure we produce the correct result
8787
stopifnot(all.equal(sum(x * y), simdDotProduct(x, y)))

inst/include/RcppNT2/reduce/reduce.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ class PlusReducer
2929
};
3030

3131
} // namespace reduce
32+
33+
using PlusReducer = reduce::PlusReducer;
34+
3235
} // namespace RcppNT2
3336

3437
#endif /* RCPP_NT2_REDUCE_REDUCE_h */

0 commit comments

Comments
 (0)