سؤال

I want to use RcppGSL and RcppArmadillo at the same time, is that possible to use multiple plugins in cxxfunction (of the inline CRAN package) ? I found a way to do:

plug.ArmaGSL <- Rcpp:::Rcpp.plugin.maker(include.before='#include <RcppArmadillo.h>
                                                     #include <RcppGSL.h>
                                                     #include <gsl/gsl_rng.h>',
                                     Depends=c("RcppGSL", "RcppArmadillo", "Rcpp"),
                                     LinkingTo=c("RcppGSL", "RcppArmadillo", "Rcpp"),
                                     libs="-lgsl -larmadillo")

registerPlugin("RcppArmaGSL", plug.ArmaGSL)

foo <- cxxfunction(signature(sM="numeric"), body=bodytxt, inc=inctxt, plugin="RcppArmaGSL")

but it seems not that intuitive.

هل كانت مفيدة؟

المحلول

Nice question. (And would have been even better on rcpp-devel.)

I think you need to write your own combined plugin, see Question 3.6 'How do I write a plugin for the inline package' of the Rcpp-FAQ vignette for details.

نصائح أخرى

A simple way is to start from an existing plugin, say:

require(inline)
require(RcppArmadillo)
foo <- getPlugin("RcppArmadillo" )

and then mess with foo, and use it as the settings argument in the cxxfunction call. More on that in ?cxxfunction.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top