[Rcpp-devel] Matrix: column-major storage?
edd at debian.org
Wed Nov 7 20:43:52 CET 2012
On 7 November 2012 at 20:25, Ramon Diaz-Uriarte wrote:
| I understand it is not possible to store things in row-major order with
| Rcpp Matrix types?
In short: No.
In more detail, and allow me to quote from Section "5.11.2 Calculating
numerical derivatives" in "Writing R Extensions":
Now, we compute the `i''th column of the gradient matrix. Note how it
is accessed: R stores matrices by column (like FORTRAN).
(which was the first suitable hit I found in the manual).
A *lot* of the power and convenience in Rcpp comes from the fact that we do
provide so-called 'proxy objects' that are fairly thing wrappers (with added
C++ magic) on top of the original R types.
So whatever it is in R, it is in Rcpp (holds as a general rule, void where
prohibited and you have a money-back guarantee).
If you want different matrix representations, the excellent package
RcppArmadillo and RcppEigen are willing and able to help. Getting data to
and from them is easy too.
Hope this helps, Dirk
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel