Envoyé de mon iPhone > Le 3 déc. 2014 à 17:59, Gabor Grothendieck <ggrothendi...@gmail.com> a écrit : > > 1. This returns a matrix rather than a vector: > > -- start of file teste.cpp --- > #include <RcppArmadillo.h> > // [[Rcpp::depends(RcppArmadillo)]] > > using namespace arma; > using namespace Rcpp; > > // [[Rcpp::export]] > NumericVector teste(const vec& x) { > vec v = x.subvec(1, 2); // x > return wrap(v); // x > } > /*** R > teste(1:4) > */ > --- end of file teste.cpp --- > > Now run in R: > >> sourceCpp("teste.cpp", rebuild = TRUE) > >> teste(1:4) > [,1] > [1,] 2 > [2,] 3 > > > 2. If we replace the lines marked // x with > > return wrap(x.subvec(1, 2)); > > then it fails with a compiler error. > > error: cannot convert 'const arma::subview_col<double>' to 'SEXP' in > initialization
This should be easy/trivial to fix for someone with the right skills. Romain > > -- > Statistics & Software Consulting > GKX Group, GKX Associates Inc. > tel: 1-877-GKX-GROUP > email: ggrothendieck at gmail.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 _______________________________________________ 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