Why is there a dot in ".*"? Are you perhaps thinking of Matlab?
On Fri, Jan 6, 2017 at 8:53 PM, Shaami <[email protected]> wrote:
> I have deleted two for loops from my code and trying to use vectors in place
> of them.
For reference, there's very little benefit to removing loops in a
compiled language. What Martyn said is exactly correct - it's your
responsibility to understand the difference between an interpreted
language like R and a compiled language like C++.
Some rules of thumb:
* In both R and C++, avoid unnecessary memory allocations.
* In R, minimize the number of distinct function calls.
- A single function call: val = sum(1:10)
- 10 function calls: val = 0; for (ii in 1:10) { val = val + ii}
--
A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel