[Rcpp-devel] Filling NumericMatrix with NumericVectors with apply by row/column?

Christian Gunning xian at unm.edu
Wed Oct 6 11:13:39 CEST 2010


On Tue, Sep 21, 2010 at 4:20 AM, Christian Gunning <xian at unm.edu> wrote:
>
> As a side-note, I just spent some time with arma, and was sad to find
> that arma_mat.insert_rows(atrow, rowvec) extends arma_mat, with no
> apparent way to do row/col-level in-place replacement.

I just realized that the following works just fine for in-place replacement:

NumericVector tmpcube(Dimension(nrow, ncol, nslice));
tmpcube = NumericVector(AparArr);
realcube = arma::cube(tmpcube.begin(), nrow, npars, nslice);

realcube.slice(1) = realcube.slice(0);

best,
Christian
-- 
A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!


More information about the Rcpp-devel mailing list