Re: [Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-02 Thread Dirk Eddelbuettel
On 2 May 2013 at 17:24, Dirk Eddelbuettel wrote: | Sorry. It was just a quick guess. | | On second thought, I think your earlier approach was actually pretty good: | Take your arma object, use wrap to turn it into a SEXP (or maybe an RObject) | and you should then be able to set attributes. An

Re: [Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-02 Thread Dirk Eddelbuettel
On 2 May 2013 at 16:37, Sameer D'Costa wrote: | > From a quick look at the header file Matrix.h it seems that | > | > template | > Matrix( const int& nrows_, const int& ncols, Iterator start ) ; | > | > should be what you are after. (The various types are just typedefs to the | > templat

Re: [Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-02 Thread Sameer D'Costa
On Thu, May 2, 2013 at 3:06 PM, Dirk Eddelbuettel wrote: > > On 2 May 2013 at 14:33, Sameer D'Costa wrote: > | Thanks for the reply Dirk. > | > | On Thu, May 2, 2013 at 12:53 PM, Dirk Eddelbuettel wrote: > | > > | > Hi Sameer, > | > > | > On 2 May 2013 at 10:16, Sameer D'Costa wrote: > | > | Hi,

Re: [Rcpp-devel] Additional parameters for an objective function, e.g. in RcppDE

2013-05-02 Thread Dirk Eddelbuettel
Hi Christoph, On 30 April 2013 at 10:20, Christoph Bergmeir wrote: | Hi Dirk (and the rest of the list), | | I think I have it working; attached is a patch that adds this | functionality to RcppDE. I also came along something which is probably a | bug: The passed environment is never used. In

Re: [Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-02 Thread Dirk Eddelbuettel
On 2 May 2013 at 14:33, Sameer D'Costa wrote: | Thanks for the reply Dirk. | | On Thu, May 2, 2013 at 12:53 PM, Dirk Eddelbuettel wrote: | > | > Hi Sameer, | > | > On 2 May 2013 at 10:16, Sameer D'Costa wrote: | > | Hi, | > | | > | I am trying to return several Armadillo matrices back to R and t

Re: [Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-02 Thread Sameer D'Costa
Thanks for the reply Dirk. On Thu, May 2, 2013 at 12:53 PM, Dirk Eddelbuettel wrote: > > Hi Sameer, > > On 2 May 2013 at 10:16, Sameer D'Costa wrote: > | Hi, > | > | I am trying to return several Armadillo matrices back to R and to set > | the names for the rows and the columns of each matrix. I

Re: [Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-02 Thread Dirk Eddelbuettel
Hi Sameer, On 2 May 2013 at 10:16, Sameer D'Costa wrote: | Hi, | | I am trying to return several Armadillo matrices back to R and to set | the names for the rows and the columns of each matrix. I have tried | converting each Armadillo matrix to a NumericMatrix and then setting | the dimnames on

[Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-02 Thread Sameer D'Costa
Hi, I am trying to return several Armadillo matrices back to R and to set the names for the rows and the columns of each matrix. I have tried converting each Armadillo matrix to a NumericMatrix and then setting the dimnames on that before returning a list to R. This seems to work (see snippet belo

Re: [Rcpp-devel] Fwd: How can I avoid calls to coerceToReal

2013-05-02 Thread Romain Francois
What is the type of df[i] ? i.e. what does it says: SEXP tmp = df[i] ; Rprintf( "TYPEOF(tmp)=%d", TYPEOF(tmp) ) ; If this is anything but REALSXP (i.e. 14), then you have to coerce the data to bne able to use it as a NumericVector. Romain Le 30/04/13 17:19, Pratibha Rana a écrit : Hi, MY