[Rd] coerce SEXP type to C++ matrix class and back
kklot
||eeuv@@n @end|ng |rom gm@||@com
Wed May 22 00:57:12 CEST 2019
perhaps you don't need this anymore but now after extract the dimension m, n,
we can simply generate arma matrix as
mat an_arma_mat(REAL(RA), m, n);
similarly you can convert RB to an arma matrix pointer, operate on it then
return directly RB to R.
I am testing a simple C++ function that takes a double matrix as
argument and which uses routines provided by the C++ Armadillo
package. I am aware of the nice capabilities of Rcpp and RcppArmadillo
which helps simplifying a lot and that I have already successfully
tested. However, I had a hard time trying to figure out how the
coercion from a REALSPX matrix to an arma::mat = arma::Mat<double>
matrix (double matrix in Armadillo) is done. In this particular case,
because of the simplicity of my function, I would like to use base R
only.
--
Sent from: http://r.789695.n4.nabble.com/R-devel-f909078.html
More information about the R-devel
mailing list