[Rcpp-devel] ublas and Rcpp
bates at stat.wisc.edu
Tue Jun 7 23:49:12 CEST 2011
In an earlier post to this group I mentioned difficulties with the
coordinate_matrix class from the boost ublas library on Ubuntu 11.04.
It turns out the difficulties are also present with the
coordinate_vector class and they seem to be related to the version of
the g++ compiler (works okay with versions up to 4.4.6, starts failing
at 4.5.0). I imagine it is not so much the version of g++ as the
corresponding version of libstdc++6 that is causing the problem.
It appears that the ublas vector and matrix templates can be used with
Rcpp but care is required because R uses column major ordering (the
Fortran convention) but the default for ublas is row major ordering.
I would use a typedef of the form
typedef boost::numeric::ublas::matrix<double, column_major> Rmatrix;
although more general expressions are possible.
More information about the Rcpp-devel