search for: compute_values_cpp

Displaying 6 results from an estimated 6 matches for "compute_values_cpp".

2017 Dec 03
5
Rcpp, dyn.load and C++ problems
...written a small C++ function and compile it. However in R I can't see the function I have defined in C++. I have read some web-pages about Rcpp and C++ but it is a bit confusion for me. Anyway, This is the C++-code: #include <Rcpp.h> using namespace Rcpp; // [[Rcpp::export]] List compute_values_cpp(int totalPoints = 1e5, double angle_increment = 0.01, int radius = 400, double grow = 3.64) { double xn = 0.5; double angle = 0.1; double xn_plus_one, yn_plus_one; NumericVector x(totalPoints); NumericVector y(totalPoints); for (int i=0; i<totalPoints; i++) { xn_plus_one = xn*co...
2017 Dec 03
0
Rcpp, dyn.load and C++ problems
.Call("compute_values_cpp") Also, if you were passing arguments to the C++ function you would need to declare the function differently. Do a search on "Rcpp calling C++ functions from R" HTH, Eric On Sun, Dec 3, 2017 at 3:06 AM, Martin M?ller Skarbiniks Pedersen < traxplayer at gmail.com> wrote: &gt...
2017 Dec 03
0
Rcpp, dyn.load and C++ problems
...with the package? In essence you _complitely_ missed what Rcpp Attributes does and shows, as does the (newer) Rcpp Introduction vignette. More crazy, your file was actually 100% correct. I just added three lines to _also_ execute R code (and I indented just for clarity) /*** R res <- compute_values_cpp() str(res) */ Then in R: R> library(Rcpp) R> sourceCpp("/tmp/mmsp.cpp") R> res <- compute_values_cpp() R> str(res) List of 2 $ x: num [1:100000] 199 362 118 302 262 ... $ y: num [1:100000] 20 40 14.3 39.5 36.9 ... R...
2017 Dec 03
0
Rcpp, dyn.load and C++ problems
I would go to the source, in this case Dirk Eddelbuettel's (I hope I spelled it correctly) documentation for Rcpp: http://dirk.eddelbuettel.com/code/rcpp/Rcpp-attributes.pdf Note that you need to do sourceCpp("logistic_map.cpp") in R instead of building and dyn.load()-ing the object. HTH, Peter On Sun, Dec 3, 2017 at 11:04 AM, Martin M?ller Skarbiniks Pedersen <traxplayer
2017 Dec 03
1
Rcpp, dyn.load and C++ problems
...would have missed this were it not for luck. "R has its own list, rcpp-devel" is what I meant to write. For completeness, we can also test on the command-line as Martin and what I do a lot myself: edd at bud:~$ r -lRcpp -e'sourceCpp("/tmp/mmsp.cpp")' R> res <- compute_values_cpp() R> str(res) Attaching package: ?utils? The following objects are masked from ?package:Rcpp?: .DollarNames, prompt List of 2 $ x: num [1:100000] 199 362 118 302 262 ... $ y: num [1:100000] 20 40 14.3 39.5 36.9 ... You have mail in /var/mail/edd edd at bud:~$ That uses littler which...
2017 Dec 03
2
Rcpp, dyn.load and C++ problems
On 3 December 2017 at 05:23, Eric Berger <ericjberger at gmail.com> wrote: > > Do a search on "Rcpp calling C++ functions from R" > Thanks. However search for "Rcpp calling C++ functions from R" gives a lot of result but I think some of them are outdated and others don't agree with each other. Can you point to a specific good on-line guide for me? Regards