Interesting. I don't think it has anything to do with inline or not (see below). If in doubt, do use wrap() as the 'it dropped the dim' reveals a fallback to vector defaults.
When I use your last solution (the function) in inline, it gets the same result: edd@max:~$ r /tmp/soren.r Loading required package: methods $X [,1] [,2] [1,] 1 3 [2,] 2 4 $Xinv [,1] [,2] [1,] -2 1.5 [2,] 1 -0.5 $X [,1] [,2] [1,] 1 3 [2,] 2 4 $Xinv [,1] [,2] [1,] -2 1.5 [2,] 1 -0.5 edd@max:~$ So I doubt we can blame inline. Code below. Dirk library(inline) code <- ' arma::mat X = as<arma::mat>(X_); arma::mat Xinv = inv( X ); return Rcpp::List::create(Rcpp::Named("X", X),Rcpp::Named("Xinv", Xinv));' sol <- cxxfunction(signature(X_ = "matrix"), code, plugin = "RcppArmadillo", verbose=F) M <- matrix(c(1,2,3,4),nr=2) print(sol(M)) inc <- ' RcppExport SEXP sol2 ( SEXP X_ ){ arma::mat X = as<arma::mat>(X_); arma::mat Xinv = inv( X ); return Rcpp::List::create(Rcpp::Named("X", wrap(X)),Rcpp::Named("Xinv", wrap(Xinv))); } ' sol3 <- cxxfunction(signature(X_ = "matrix"), plugin = "RcppArmadillo", inc=inc, body='return sol2(X_);') print(sol3(M)) -- Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel