Re: [Rcpp-devel] Code review for xtensor R bindings

2017-06-07 Thread Wolf Vollprecht
The idea with IntegerVector for shape is great. I had to fix some minor stuff in xtensor but it appears to be working. Ok, good to know about the shape copy! Yeah, this is literally a weekend project for now (and I haven't used R before) so this was just a quick-n-dirty test script. Cheers, Wol

Re: [Rcpp-devel] Code review for xtensor R bindings

2017-06-07 Thread Dirk Eddelbuettel
On 7 June 2017 at 09:29, Romain Francois wrote: | Hi, | | Instead of doing that: | | const int vtype = traits::r_sexptype_traits::rtype; | SEXP shape_sxp = Rf_allocVector(vtype, shape.size()); | | Perhaps your rxarray object could hold an IntegerVector. Also not quite sure | why you use the f

Re: [Rcpp-devel] Code review for xtensor R bindings

2017-06-07 Thread Romain Francois
Hi, Instead of doing that: const int vtype = traits::r_sexptype_traits::rtype; SEXP shape_sxp = Rf_allocVector(vtype, shape.size()); Perhaps your rxarray object could hold an IntegerVector. Also not quite sure why you use the first line at all, which does not depend on T, so vtype is always

Re: [Rcpp-devel] Code review for xtensor R bindings

2017-06-06 Thread Dirk Eddelbuettel
On 6 June 2017 at 18:01, Wolf Vollprecht wrote: | Ok, I think I got the idea.  | | In the R->xtensor bindings, we always work directly on memory allocated through | R (either passed in from R or allocated from C++ code). | | The review-relevant lines are really only ~10 lines: https://github.co

Re: [Rcpp-devel] Code review for xtensor R bindings

2017-06-06 Thread Wolf Vollprecht
Ok, I think I got the idea. In the R->xtensor bindings, we always work directly on memory allocated through R (either passed in from R or allocated from C++ code). The review-relevant lines are really only ~10 lines: https://github.com/ QuantStack/xtensor-r/blob/master/inst/include/xtensor-r/rxar

Re: [Rcpp-devel] Code review for xtensor R bindings

2017-06-06 Thread Dirk Eddelbuettel
On 6 June 2017 at 17:06, Dirk Eddelbuettel wrote: | The general idea when working with R objects is that | | -- on the way in from R to the C++ functions we construct object such that | the existing memory (from R) is used; one example is how RcppArmadillo | uses the 'advanced' constr

Re: [Rcpp-devel] Code review for xtensor R bindings

2017-06-06 Thread Dirk Eddelbuettel
Howdy, On 6 June 2017 at 14:15, Wolf Vollprecht wrote: | I put together a small proof of concept for the xtensor R bindings over the | weekend.  | It lives here: https://github.com/QuantStack/xtensor-r Nice! Not sure I have spare cycles right now for this but that is very welcome. | xtensor i

[Rcpp-devel] Code review for xtensor R bindings

2017-06-06 Thread Wolf Vollprecht
Dear RCpp developer community, I put together a small proof of concept for the xtensor R bindings over the weekend. It lives here: https://github.com/QuantStack/xtensor-r xtensor is an exciting C++ library which provides a unified C++ tensor interface for Python/NumPy, Julia and soon R. My bigge