Coder Social home page Coder Social logo

Comments (10)

jonclayden avatar jonclayden commented on May 27, 2024 2

RcppArray v0.3.0, with the tuple support added, is now on CRAN.

from rcpp.

eddelbuettel avatar eddelbuettel commented on May 27, 2024 1

Howdy and thanks for suggesting that. We will take a look. It may otherwise be easiest to do this in a small add-on package as e.g. was done in RcppArray (also supporting std::span if C++20 is used).

from rcpp.

jonclayden avatar jonclayden commented on May 27, 2024 1

Very happy to look into merging this into RcppArray, as it does seem like a natural extension and saves creating another small extension package for a similar purpose.

from rcpp.

eddelbuettel avatar eddelbuettel commented on May 27, 2024 1

Sounds good to me, @andrjohns is closer to the metal for a concrete use case. I am sure we can cook up a unit test or two, I always liked how you set up tester packages in RcppArray (and Rcpp has long done similar stuff for parts of its tests).

from rcpp.

eddelbuettel avatar eddelbuettel commented on May 27, 2024

Gee I just realized in horror that I think I never experimented / reached out to @jonclayden here! John, any 'feels' about extending RcppArray with this (pro: it seems to fit; con: it may clutter the package) or whether this should be something on its own (pro: self-contained is good ?; con: clutters package system?).

from rcpp.

jonclayden avatar jonclayden commented on May 27, 2024

The commit referenced above provides a version of the implementation that avoids using helpers from C++14 (index_sequence) and C++17 (apply()), to try and maximise compatibility. Instead it uses a nested helper struct holding references to the tuple and the R list, each "level" of which is responsible for an element of the tuple. I have tests for the as() direction (though not yet for wrap()) and it seems to work. I don't imagine this will be noticeably less efficient, and it compiles with CXX_STD=CXX11, but testing/feedback is very welcome.

from rcpp.

jonclayden avatar jonclayden commented on May 27, 2024

I've added a tuple client stub package now, and unfortunately wrap() chokes on this assertion, whether my implementation or the version above using apply() is used. The specialisation is declared before including the full Rcpp.h but somehow dispatch isn't working out correctly. I'll need to have another look with a clearer head...

from rcpp.

jonclayden avatar jonclayden commented on May 27, 2024

The problem seems to have been including the wrap() implementation within the Rcpp::traits namespace, when it should just be in Rcpp. The Rcpp-extending vignette threw me here, I think, because it seems to indicate that partial specialisations should live in Rcpp::traits (section 2.3), although that does seem surprising – am I misreading it? Anyway, that seems to have been the mistake relative to the version above, now corrected.

@andrjohns I'll add you as a contributor to the RcppArray package, assuming you're happy with that. If the current implementation works for you then I'll put together a release for CRAN.

from rcpp.

eddelbuettel avatar eddelbuettel commented on May 27, 2024

Yes, that documentation / implementation could do with a rewrite. It also throws me for loops at times. So twice the thanks for working through it !!

from rcpp.

eddelbuettel avatar eddelbuettel commented on May 27, 2024

We can close this as RcppArray took care of it. Three cheers for that!

from rcpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.