Hi Gang:
I was recently explaining to someone that functions like Rcpp::rnorm only
take scalars. Since the R function takes vectors, the OP was asking me
why?
I didn?t have a good answer. This morning, I started thinking about it
and I realized this could easily be handled by over-loading (I know: that
is
why they call me Mr. Excitement ;o)
I don?t know if these overloads would have to be written by hand or could
be
auto-generated. If the latter, then I guess it is a feature request. If
not,
then probably a friendly suggestion. But, here is a short example that
shows
it is feasible if there is any doubt.
Happy Easter!
Rodney
The R transcript...
On 26 March 2016 at 21:34, Sparapani, Rodney wrote:
| Hi Gang:
|
| I was recently explaining to someone that functions like Rcpp::rnorm only
| take scalars. Since the R function takes vectors, the OP was asking me
| why?
| I didn?t have a good answer. This morning, I started thinking about it
| and I realized this could easily be handled by over-loading (I know: that
| is
| why they call me Mr. Excitement ;o)
|
| I don?t know if these overloads would have to be written by hand or could
| be
| auto-generated. If the latter, then I guess it is a feature request. If
| not,
| then probably a friendly suggestion. But, here is a short example that
| shows
| it is feasible if there is any doubt.
|
| Happy Easter!
Happy Easter to you too. I don't understand your point, I am afraid. If you
think you need an rnorm variant with vector arguments for mean and sd, why
don't you just write one, as you did here, and release it as a package? As I
understand you, this is to solve an apparent issue at the R level, correct?
I really do not see how that __fits into them mission of giving a simple and
useful mechanism__ for access the R RNGs accessible via the R C API. I am
probably missing something here.
In case you want a C(++) level to vector argument mean and sd, you can do
exactly the same but at a different layer. Nobody is stopping you, but as
nobody but you seem to think this is missing in Rcpp nobody but you is likely
to work on it either.
Happy Easter to you too.
Dirk
On 3/26/16, 5:38 PM, "Dirk Eddelbuettel" <edd at debian.org> wrote:
Happy Easter to you too. I don't understand your point, I am afraid. If
you
think you need an rnorm variant with vector arguments for mean and sd, why
don't you just write one, as you did here, and release it as a package?
As I
understand you, this is to solve an apparent issue at the R level,
correct?
I might do that. But, its not the R level since those features already
exist;
I?m just mimicking them at the C++ level. The R transcript was a proof of
concept to make sure this was actually doable.
I really do not see how that __fits into them mission of giving a simple
and
useful mechanism__ for access the R RNGs accessible via the R C API. I am
probably missing something here.
Well, it might be relevant to other functions, but as you have guessed it
is
mainly an issue with RNGs.
In case you want a C(++) level to vector argument mean and sd, you can do
exactly the same but at a different layer. Nobody is stopping you, but as
nobody but you seem to think this is missing in Rcpp nobody but you is
likely
to work on it either.
Well, like I said, someone else did ask me why it was missing. And
perhaps
others have wondered as well. Anyways, it is trivial to fix as I?ve shown.
I?m wondering if these can be generated via the pre-processor since they
are
rather simple. If I make any progress, maybe it would be worth a Gallery
post.
Thanks,
Rodney