Re: [Rcpp-devel] Rcpp equivalent of sapply(L, length)

2021-07-01 Thread Dr Gregory Jefferis
rs[1:3], letters[2:3], letters[1:6]) c_listlengths(l) [1] 3 2 6 c_listlengths(l2) [1] 3 2 6 l3=list(letters[1:6], letters[2:3], letters[1:3]) c_listlengths(l3) [1] 6 2 3 On Thu, Jul 1, 2021 at 5:14 PM Dr Gregory Jefferis < jeffe...@mrc-lmb.cam.ac.uk> wrote: Dear RcppUsers, I feel like

[Rcpp-devel] Rcpp equivalent of sapply(L, length)

2021-07-01 Thread Dr Gregory Jefferis
Dear RcppUsers, I feel like there must be a simple way to do the equivalent of sapply(L, length) in Rcpp but I can't seem to get past the problem of converting the elements of L into a type for which .size() or .length() are valid. I see that I could do this using some long switch(TYPEOF(x))

[Rcpp-devel] good style for std::vector of C++ struct -> named list of named lists

2015-06-24 Thread Dr Gregory Jefferis
Hello all, I am wrapping a very simple C++ library in a package (to read wavefront 3D obj files). The results come back as a std::vector of a struct which contains various fields using datatypes such as float, float[], std::string. I am going to return this as a list of lists. Each of the sub

Re: [Rcpp-devel] RcppModules with templated class

2014-09-01 Thread Dr Gregory Jefferis
Dear Dirk, On 1 Sep 2014, at 21:19, Dirk Eddelbuettel wrote: These very useful RCPP_EXPOSED_CLASS* macros are a tad underdocumented. Greg, would you be interested in writing up a simple Rcpp Gallery post on that? I would be happy to help if you'd prefer that. Many thanks for the invitatio

Re: [Rcpp-devel] RcppModules with templated class

2014-09-01 Thread Dr Gregory Jefferis
Dear Romain, On 1 Sep 2014, at 17:32, Romain Francois wrote: This looks related to what RCPP_EXPOSED_CLASS does, perhaps because your class comes from a template, you could try RCPP_EXPOSED_CLASS_NODECL instead. The only difference is that it does not add the class forward declaration, so you

Re: [Rcpp-devel] RcppModules with templated class

2014-09-01 Thread Dr Gregory Jefferis
On 1 Sep 2014, at 14:09, Dirk Eddelbuettel wrote: And I think I was trying to explain to you that - becase _R_ only knows double and - does dispatch by _name_ only there is no clean way in which _Rcpp_ can maintain these as two distinct versions under the same name. In short, just because you

Re: [Rcpp-devel] only LinkingTo: RcppEigen gives compileAttributes warning

2014-09-01 Thread Dr Gregory Jefferis
Dear Dirk, On 1 Sep 2014, at 13:22, Dirk Eddelbuettel wrote: You need both LinkingTo: statements as they give us the -I flags needed for compilation. These days you need only one Import: statement to instantiate Rcpp. Just to be clear, the relevant part of my DESCRIPTION looks like this: I

Re: [Rcpp-devel] RcppModules with templated class

2014-09-01 Thread Dr Gregory Jefferis
Dear Dirk, Many thanks for your quick (as ever) response. On 1 Sep 2014, at 13:27, Dirk Eddelbuettel wrote: But in this case consider that a) R itself only knows double so at some point both variants need to be promoted up Yes, the code presently includes a static cast to the template scal

[Rcpp-devel] RcppModules with templated class

2014-09-01 Thread Dr Gregory Jefferis
Hello, I have a more or less complete Rcpp(Eigen) dependent package that exposes a pair of C++ classes to R using RcppModules;the C++ classes (which implement k nearest neighbour search trees) differ only in their scalar storage type (float vs double) and are called WKNND and WKNNF. For futur

[Rcpp-devel] only LinkingTo: RcppEigen gives compileAttributes warning

2014-09-01 Thread Dr Gregory Jefferis
Hello, I have package that depends on Rcpp(Eigen). Originally I imported and linked to Rcpp and RcppEigen. However sending the package to the winbuilder server, r-devel complains that I only need to link to RcppEigen: * checking package dependencies ... NOTE Package in Depends/Imports which

Re: [Rcpp-devel] documenting classes exposed with setRcppClass / modules

2014-08-29 Thread Dr Gregory Jefferis
ce somewhere in the Rcpp modules documentation for this. Best, Greg. On 29 Aug 2014, at 16:21, Dr Gregory Jefferis wrote: Hello, I just wondered if someone could give me some pointers for how to document classes exposed by Rcpp Modules / setRcppClass. I am a little hazy on what setRcppC

[Rcpp-devel] documenting classes exposed with setRcppClass / modules

2014-08-29 Thread Dr Gregory Jefferis
Hello, I just wondered if someone could give me some pointers for how to document classes exposed by Rcpp Modules / setRcppClass. I am a little hazy on what setRcppClass is doing and how I should be documenting it and reading http://cran.r-project.org/web/packages/Rcpp/vignettes/Rcpp