Skip to content
Prev 2673 / 10988 Next

[Rcpp-devel] Passing an exposed function to another C++ function as a parameter

Great! I'm eager to see the example. Thank you very much indeed!

I'm sorry about the formatting of the table, I'm used to write on a very
wide setting so it looked ok on my computer. I'll be more careful the next
time.

Though I did not mention it in the first message, the problem posed has
paramount importance for the new version of the AMORE package and may be
for many others to come.

The thing is that, in the case of AMORE ---a neural network simulator---,
the user of the package is provided the capability to write their own
neuron activation functions and training cost functions. In the stable
version on CRAN this is done by letting the user write those functions in
R language at the cost of a lower performance. Those users that are ok
with the functions provided in the package enjoy the benefits of compiled
code; those writing their own functions have to cope with a lower speed
unless they want to sink into the code of the package, but those are the
less I guess.

Now, thanks to Rcpp, a see a new possibility which is to let the user
write their own functions in C++ and use them along the provided ones in
the package following the scheme I was trying to get to work, and all that
without having to compromise performance.

The point is that the Tanh_f0 function, shown as an example, or many
others will be written by the user if need be, while the rest of the code
involved in training the network will be provided by the package.

There's beauty indeed in being able to merge those two worlds.

Similarly, the same thing might be done with classes. A package could then
provide a framework and the users could extend the existing classes
customizing the behavior of the package with the ease of using inline. Now
I'm thinking about training algorithms in the case of AMORE.

But that's another story. For now, I'm dreaming on the example that Romain
is cooking.

PS: Did I mention you guys did a great job with Rcpp! I love it. It's a
revolutionary package in the R arena, IMHO.



El 03/08/11 15:29, "Dirk Eddelbuettel" <edd at debian.org> escribi?: