Re: [Rcpp-devel] template functions with Rcpp

2015-05-01 Thread Kevin Ushey
Hi Daniel, Unfortunately, you cannot use // [[Rcpp::export]] to automagically export template functions. The general alternative approach is to define a template implementation, and then dynamically dispatch to that implementation, e.g. template void doStuffImpl() { ... } with dispatch a

[Rcpp-devel] template functions with Rcpp

2015-05-01 Thread daniel castro
Hello, I'm trying to build a function that calculates (for example) the log of all elements of a container. I want this container to be a vector, a Rcpp::numericVector , or perhaps a arama::colvec , so I'm trying with templates ,and it compiles without the // [[Rcpp::export]] part, but when I put

[Rcpp-devel] List of Lists to List of Vectors

2015-05-01 Thread Tim Keitt
If I have data like list(list('a', 1, T), list('b', 2, F), ...) (list of lists with same types) and I want to convert to list(c('a', 'b'), c(1, 2), c(T, F)) (list of vectors) where the types are not known in advance (its trivial if you know the sequence of types in advance). Anyone know how

Re: [Rcpp-devel] Linking Rcpp and libcmaes within a package

2015-05-01 Thread Marie-Pierre ETIENNE
The problem is solved, as you explained I had to update the ldconf cache. I guess that I didn't get any issues with the direct compilation of the example because I was building an executable file and not a shared library. Thanks a lot for taking the time to explain the key aspects. - Mail

Re: [Rcpp-devel] Linking Rcpp and libcmaes within a package

2015-05-01 Thread Dirk Eddelbuettel
On 1 May 2015 at 19:03, Marie-Pierre ETIENNE wrote: | So I tried to apply your suggestion and I still have the same error | | Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/home/metienne/R/x86_64-pc-linux-gnu-library/3.1/testCMaes/libs/testCMaes.so': libcmae

Re: [Rcpp-devel] Linking Rcpp and libcmaes within a package

2015-05-01 Thread Marie-Pierre ETIENNE
Oups I put my answer to your comments in the body of the mail and therefore it is almost invisible. So I tried to apply your suggestion and I still have the same error Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/home/metienne/R/x86_64-pc-linux-gnu-librar

Re: [Rcpp-devel] Linking Rcpp and libcmaes within a package

2015-05-01 Thread Marie-Pierre ETIENNE
Thanks Dirk for your advice - Mail original - De: "Dirk Eddelbuettel" À: "Marie-Pierre ETIENNE" Cc: [email protected] Envoyé: Vendredi 1 Mai 2015 17:33:11 Objet: Re: [Rcpp-devel] Linking Rcpp and libcmaes within a package On 1 May 2015 at 16:12, Marie-Pierre

Re: [Rcpp-devel] Linking Rcpp and libcmaes within a package

2015-05-01 Thread Dirk Eddelbuettel
On 1 May 2015 at 16:12, Marie-Pierre ETIENNE wrote: | CXX_STD = CXX11 | PKG_CPPFLAGS=-I/usr/local/include/libcmaes -I../inst/include -I/usr/local/include/eigen3/ If you add LinkingTo: RcppEigen then you don't need the explicit include for Eigen3, and are more portable. Of course, you would

[Rcpp-devel] Linking Rcpp and libcmaes within a package

2015-05-01 Thread Marie-Pierre ETIENNE
Dear Rcpp and R developpers, I have recently used Rcpp to build a package and found it very well documented and easy as I don't need to go very deep in Writing R extensions mechanisms. My code uses an optimisation algorithm named cmaes, and this use was first made through a cmaes R package. As