Convert RcppArmadillo vector to Rcpp vector

后端 未结 3 1398
迷失自我
迷失自我 2020-12-28 20:25

I am trying to convert RcppArmadillo vector (e.g. arma::colvec) to a Rcpp vector (NumericVector). I know I can first convert arma::colvec

3条回答
  •  庸人自扰
    2020-12-28 21:05

    I had the same question. I used wrap to do the conversion at the core of several layers of for loops and it was very slow. I think the wrap function is to blame for dragging the speed down so I wish to know if there is an elegant way to do this.

    As for Raymond's question, you might want to try including the namespace like: Rcpp::as(wrap(A)) instead or include a line using namespace Rcpp; at the beginning of your code.

提交回复
热议问题