Skip to content
Prev 5531 / 10988 Next

[Rcpp-devel] fill a NumericMatrix row by row

There's an even simpler way when using Armadillo, so that no loop is required:
http://arma.sourceforge.net/docs.html#each_colrow

For example:

mat X(4,5);
rowvec r(5);

X.each_row() = r;


(btw, in general it's more efficient to access matrices as columns
rather than rows).


On Wed, Mar 27, 2013 at 6:23 PM, Michael Love
<michaelisaiahlove at gmail.com> wrote: