renozao / RcppOctave

Seamless Interface to Octave -- and Matlab code
17 stars 9 forks source link

Call Octave functions from Rcpp #13

Closed bhattaa closed 7 years ago

bhattaa commented 8 years ago

Is there a way to call Octave functions directly from Rcpp rather than calling an R function which calls on to RcppOctave?

For the latter, see http://stackoverflow.com/questions/21225662/calling-a-user-defined-r-function-from-c-using-rcpp

renozao commented 8 years ago

Example using inline:

feval <- RcppOctave:::rcppoctave(signature(), '
Rcpp::List args = Rcpp::List::create(10);
SEXP result = CallOctave("rand", args);
return(result);
')

set.seed(1)
res1 <- .O$rand(10)
set.seed(1)
res2 <- feval()
identical(res1, res2)
renozao commented 8 years ago

Can you please tell me if this is working for you?

bhattaa commented 8 years ago

Sorry I have been away. I will check today or tomorrow and let you know.

Thanks,

Arnab

On 27 May 2016 at 10:28, Renaud Gaujoux notifications@github.com wrote:

Can you please tell me if this is working for you?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/renozao/RcppOctave/issues/13#issuecomment-222102082, or mute the thread https://github.com/notifications/unsubscribe/ASgiVxHc54GoAFobybrIAO8jw4N6s9Dfks5qFrk9gaJpZM4IgLeg .

renozao commented 7 years ago

This should be working. Closing the issue.