[Rcpp-devel] Constructor for templated Rcpp::Matrix class from Rcpp::Dimension fails

2011-06-01 Thread Douglas Bates
I am developing classes for sparse matrices with an Rcpp interface that includes Rcpp::Dimension dim() const {return Rcpp::Dimension(nr(), nc());} Rcpp::NumericMatrix asmatrix() const; The implementation of the asmatrix method begins with Rcpp::NumericMatrix ans(dim(

Re: [Rcpp-devel] R.e. Fwd: problem with rmultinom function

2011-06-01 Thread s niani
On Wed, Jun 1, 2011 at 3:51 AM, Christian Gunning wrote: > On Tue, May 31, 2011 at 10:55 AM, > wrote: > > > I didn't see anything. If you're not subscribed to the list, > submissions silently fail. Plus, you must send from the subscribing > address. I've made this mistake a few times... > Ye

Re: [Rcpp-devel] Wrapping uBlas vectors into Rcpp Vectors.

2011-06-01 Thread Cedric Ginestet
Romain, Thanks a lot. The templated uBlas2Rcpp function works very nicely! Cheers, Ced On 01/06/11 14:14, Romain Francois wrote: Le 01/06/11 14:28, Cedric Ginestet a écrit : Dear Romain, Thank you very much for your help. I tried what you suggested by including the following templated function

Re: [Rcpp-devel] Wrapping uBlas vectors into Rcpp Vectors.

2011-06-01 Thread Romain Francois
Le 01/06/11 14:28, Cedric Ginestet a écrit : Dear Romain, Thank you very much for your help. I tried what you suggested by including the following templated function in templatedFunction.h, as follows: template Rcpp::Vector< Rcpp::traits::r_sexptype_traits::rtype > ublas2rcpp( const vector& x )

Re: [Rcpp-devel] Wrapping uBlas vectors into Rcpp Vectors.

2011-06-01 Thread Cedric Ginestet
Dear Romain, Thank you very much for your help. I tried what you suggested by including the following templated function in templatedFunction.h, as follows: template Rcpp::Vector< Rcpp::traits::r_sexptype_traits::rtype > ublas2rcpp( const vector& x ){ return Rcpp::Vector< r_sexptype_traits::r

Re: [Rcpp-devel] Wrapping uBlas vectors into Rcpp Vectors.

2011-06-01 Thread Romain Francois
Hi, I've not used uBlas, but what you are trying to do is quite similar to what we do in RcppArmadillo. You can probably manage to guess the output type from the input type, so you only have to parameterise your template on the input type. something like (untested) : template Rcpp::Vector

[Rcpp-devel] Wrapping uBlas vectors into Rcpp Vectors.

2011-06-01 Thread Cedric Ginestet
Dear Rcpp experts, I have started to use the uBlas library, and I am trying to ensure that I can pass from uBlas vectors to Rcpp vectors relatively easily. So far, I have tried the following templated function: /// using name