[Rcpp-devel] fill a NumericMatrix row by row

2013-03-27 Thread Michael Love
Not a question here, but a note. Earlier there was an email about filling a NumericMatrix row by row. http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2013-March/005390.html I noticed that for Rcpp 0.10.2 it was possible to fill a NumericMatrix with NumericVectors, but since Rcpp 0.10.3

Re: [Rcpp-devel] fill a NumericMatrix row by row

2013-03-27 Thread Conrad S
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

Re: [Rcpp-devel] fill a NumericMatrix row by row

2013-03-27 Thread Romain Francois
I removed it in the revision 4294. Sorry for the inconvenience. Romain Le 27/03/13 09:23, Michael Love a écrit : Not a question here, but a note. Earlier there was an email about filling a NumericMatrix row by row.

Re: [Rcpp-devel] fill a NumericMatrix row by row

2013-03-27 Thread Michael Love
Thanks for the reply and great libraries Conrad and Romain. Conrad, my example is a bit too simple maybe, I am really doing: for i from 1 to m: do computation store a row of results into a tall m x n matrix ...where i am pretty sure that the time required for computation is more than

Re: [Rcpp-devel] fill a NumericMatrix row by row

2013-03-27 Thread Dirk Eddelbuettel
On 27 March 2013 at 12:06, Michael Love wrote: | Thanks for the reply and great libraries Conrad and Romain. | | Conrad, my example is a bit too simple maybe, I am really doing: | | for i from 1 to m: |    do computation |    store a row of results into a tall m x n matrix | | ...where i am