Displaying 2 results from an estimated 2 matches for "integeervector".
Did you mean:
integervector
2015 Mar 02
1
R-devel does not update the C++ returned variables
...hen testing that, I've went a step further:
As you may know, int can be 'casted up' to double which is what happens
here. So in what follows you _always_ create a copy from an int vector to a
numeric vector.
For pure int, use eg
Rcpp::cppFunction("IntegerVector doubleThis(IntegeerVector x) { return(2*x); }")
and rename the function names as needed to have two defined concurrently.
Dirk
|
| ##---- now "test":
| require(microbenchmark)
| i <- 1:10
| (mb <- microbenchmark(doubleThis(i), i*2, 2*i, i*2L, 2L*i, i+i, times=2^12))
| ## Lynne (i7; FC 20), R Under d...
2015 Mar 02
3
R-devel does not update the C++ returned variables
On 2 March 2015 at 09:09, Duncan Murdoch wrote:
| I generally recommend that people use Rcpp, which hides a lot of the
| details. It will generate your .Call calls for you, and generate the
| C++ code that receives them; you just need to think about the real
| problem, not the interface. It has its own learning curve, but I think
| it is easier than using the low-level code that you need to