Skip to content
Prev 4918 / 10988 Next

[Rcpp-devel] RcppArmadillo: passing matrix columns by reference

the .col method gives you a subview_col :

   arma_inline       subview_col<eT> col(const uword col_num);
   arma_inline const subview_col<eT> col(const uword col_num) const;

not an umat.

The name of the class implies that it is a "view" class, so a way to 
look a data from another class. hence, no data of its own, so cheap copy.

double f3(arma::subview_col<unsigned int> Z) {
   Z(1, 0) = 223;
   return 99.9;
}

Also, including RcppArmadillo.h after Rcpp.h is wrong. You should only 
include RcppArmadillo.h.

I should do something so that the compiler tells you this.

Romain


Le 10/12/12 16:49, Ramon Diaz-Uriarte a ?crit :