Created
August 5, 2017 03:17
-
-
Save Dulani/3da26afead3317fb9bd4e423fdedd3f9 to your computer and use it in GitHub Desktop.
A VERY simple example using C++ in R with the cppFunction() function.
This file contains hidden or 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
#' Copied from Dirk Eddelbuettel's 2017 Rcpp Tutorial | |
#' http://dirk.eddelbuettel.com/papers/useR2017_rcpp_tutorial.pdf | |
#A very impressive little adaptation: | |
cppFunction(” | |
double m(int n, double x) { | |
for (int i=0; i<n; i++) | |
x = 1 / (1+x); | |
return x; | |
}” | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment