[Rcpp-devel] Is there an Rcpp class for arrays with > 2 dimensions?
Romain Francois
romain at r-enthusiasts.com
Tue Jun 15 21:57:42 CEST 2010
(cc'ing the list since apparently you did not)
Le 15/06/10 21:50, Dominick Samperi a écrit :
> On Tue, Jun 15, 2010 at 3:11 PM, Romain Francois
> <romain at r-enthusiasts.com <mailto:romain at r-enthusiasts.com>> wrote:
>
> which looks about right. although not much useful without some more
> support such as extract or set the values.
>
> But there seems to be a problem due to non-public fields.
>
> What do you mean ?
>
>
> I looked at my code again and what I actually tried to do was:
>
> #include <Rcpp.h>
> RcppExport SEXP multidim() {
> BEGIN_RCPP
> Rcpp::NumericMatrix nv(Rcpp::Dimension(2,3,4));
> return nv;
> END_RCPP
> }
>
> So I incorrectly used NumericMatrix instead of NumericVector, and this
> will not compile. Switching to NumericVector works.
>
> So I guess what you are saying is that the multi-dimensional "matrix"
> support present but not yet complete.
>
> Thanks,
> Dominick
That makes sense, in R a matrix is of dimension 2, not 1, not 3, just 2.
What Doug was looking for is an Rcpp class representing an R __array__,
which have any number of dimensions.
There is currently no Rcpp::Array class, this is not complicated code to
write, we just need to find someone with enough motivation.
Tomorrow is another day, so maybe tomorrow me will do it.
Romain
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://bit.ly/98Uf7u : Rcpp 0.8.1
|- http://bit.ly/c6YnCi : graph gallery collage
`- http://bit.ly/bZ7ltC : inline 0.3.5
More information about the Rcpp-devel
mailing list