Created
September 24, 2017 22:31
-
-
Save DavisVaughan/6597eac027303443bd69809b74646372 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [[Rcpp::depends(xtensor)]] | |
#include <numeric> | |
#include "xtensor/xmath.hpp" | |
#include "xtensor-r/rarray.hpp" | |
#include <Rcpp.h> | |
using namespace Rcpp; | |
// [[Rcpp::plugins(cpp14)]] | |
// [[Rcpp::export]] | |
double sum_of_sines(xt::rarray<double>& m) | |
{ | |
auto sines = xt::sin(m); | |
return std::accumulate(sines.cbegin(), sines.cend(), 0.0); | |
} | |
// You can include R code blocks in C++ files processed with sourceCpp | |
// (useful for testing and development). The R code will be automatically | |
// run after the compilation. | |
// | |
/*** R | |
sum_of_sines(42) | |
*/ |
I think this is heavily related to your closed issue here. I am absolutely no expert but maybe they need to use PKG_CPPFLAGS
instead of PKG_CXXFLAGS
in this file. I only say that because that seems to be what Rcpp does here?
It just looks like it's either not finding your C++14 or it was called incorrectly or something.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running sourceCpp (or clicking Source in RStudio) gives: