[Rcpp-devel] Returning an arma vec
Serguei Sokol
serguei.sokol at gmail.com
Fri Dec 5 11:54:50 CET 2014
Le 04/12/2014 17:57, Romain François a écrit :
> Something like this:
>
> template <typename T>
> inline wrap( const arma::subview_col<double>& x ){
> return wrap( arma::Mat<T>( x ) ) ;
> }
Interesting. If I do
inline SEXP wrap( const arma::vec& x ) {
return wrap(Rcpp::NumericVector( x.begin(), x.end()));
}
then wrap(v) returns a vector to R, not a matrix n x 1
(v is a vec here) but wrap(v+1) still returns a matrix.
Is there a more universal way to say that any expression
resulting in vec should return a vector?
Serguei.
More information about the Rcpp-devel
mailing list