Re: [Rcpp-devel] Translating between Rcpp Vectors and Matrices?

2013-01-31 Thread Kevin Ushey
This works great Dirk. Thanks! -Kevin On Thu, Jan 31, 2013 at 6:19 PM, Dirk Eddelbuettel wrote: > > On 31 January 2013 at 17:41, Kevin Ushey wrote: > | I was wondering - is there a way to translate between Vectors and > Matrices? Eg, > | reinterpreting a 100 length NumericVector as a 10x10 Nume

Re: [Rcpp-devel] Translating between Rcpp Vectors and Matrices?

2013-01-31 Thread Dirk Eddelbuettel
On 31 January 2013 at 17:41, Kevin Ushey wrote: | I was wondering - is there a way to translate between Vectors and Matrices? Eg, | reinterpreting a 100 length NumericVector as a 10x10 NumericMatrix by setting | the dimensions explicitly, or something of that form; preferably with a minimal | am

[Rcpp-devel] Translating between Rcpp Vectors and Matrices?

2013-01-31 Thread Kevin Ushey
Hi guys, I was wondering - is there a way to translate between Vectors and Matrices? Eg, reinterpreting a 100 length NumericVector as a 10x10 NumericMatrix by setting the dimensions explicitly, or something of that form; preferably with a minimal amount of copying. Alternatively, is there a prefe

Re: [Rcpp-devel] problem compiling with const in RcppEigen

2013-01-31 Thread Douglas Bates
Sorry but I am still struggling (even after reformatting the source code) to understand what the problem is. For one thing it is not clear to me what the Cm_class is for. The fundamental rule for me is that I always declare functions like //[[Rcpp::Export]] Eigen::VectorXd testfunc(const MapVecd

Re: [Rcpp-devel] problem compiling with const in RcppEigen

2013-01-31 Thread M A
Right. The problem comes up because of the constructor with one of my classes. Here is a slightly extended minimal example: // [[Rcpp::depends(RcppEigen)]] #include #include typedef Eigen::Map MapVecd; typedef Eigen::Map MapMatd; // (A). This one works with (1) below //typedef Eigen::Map MapMa

Re: [Rcpp-devel] problem compiling with const in RcppEigen

2013-01-31 Thread Douglas Bates
I should check the syntax before sending the message. On Thu, Jan 31, 2013 at 11:30 AM, Douglas Bates wrote: > The as function in RcppEigen can form an > > Eigen::Map > > but doesn't know how to form an > > Eigen::Map > > Generally I find that I confuse myself less when the const is outside the

Re: [Rcpp-devel] problem compiling with const in RcppEigen

2013-01-31 Thread Douglas Bates
The as function in RcppEigen can form an Eigen::Map but doesn't know how to form an Eigen::Map Generally I find that I confuse myself less when the const is outside the Eigen::Map. In other words, I use something like typedef Eigen::Map mMat; const mMat M(mat_from_R); This tells me that M i

[Rcpp-devel] problem compiling with const in RcppEigen

2013-01-31 Thread M A
I am compiling some source code using sourceCpp and getting a compiling failure when the source has the line with the const keyword but no failure when it does not, in the below source. // file: minimaltest.cpp // [[Rcpp::depends(RcppEigen)]] #include #include typedef Eigen::Map MapVecd; //typ

Re: [Rcpp-devel] Performance question about DataFrame

2013-01-31 Thread John Merrill
I agree that this is not a complete implementation; it isn't meant to be, although it might still be a worth incorporating this into Rcpp with the appropriate fixes in place. For instance, the vector recycling issue is far from the greatest limitation of this code: it handles character vectors wro

Re: [Rcpp-devel] Performance question about DataFrame

2013-01-31 Thread Hadley Wickham
> The reason we used a callback to data.frame is close to lazyness on our > part. With the R function, for example we know that columns of different > sizes will be handled properly, with recylcling, etc ... And S3 methods (as.data.frame) will be dispatched upon correctly etc. Hadley -- Chief

Re: [Rcpp-devel] Performance question about DataFrame

2013-01-31 Thread Hadley Wickham
On Fri, Jan 18, 2013 at 6:25 PM, John Merrill wrote: > Sure. I'll write something up for the gallery, but here's the crude > outline. > > Here's the C++ code: Is C++ really necessary here? I have the following R function in plyr: quickdf <- function(list) { rows <- unique(unlist(lapply(list,

Re: [Rcpp-devel] package with module not compiling on Mac

2013-01-31 Thread Romain Francois
Le 31/01/13 12:15, Robin Girard a écrit : Merci Romain ! I am doing this to make possible a direct use of the result such as in A=Sum(f1.Swap(0),f2.Etoile()) I see. I figured you were using some sort of chaining. I'm not a big fan of methods that return a reference to the object they are wor

Re: [Rcpp-devel] Performance question about DataFrame

2013-01-31 Thread Romain Francois
Le 15/01/13 16:20, John Merrill a écrit : It appears that DataFrame::create is a thin layer on top of the R data.frame call. The guarantee correctness, but also means the performance of an Rcpp routine which returns a large data frame is limited by the performance of data.frame -- which is utter

Re: [Rcpp-devel] package with module not compiling on Mac

2013-01-31 Thread Robin Girard
Merci Romain ! I am doing this to make possible a direct use of the result such as in A=Sum(f1.Swap(0),f2.Etoile()) This is not really necessary but sometime convenient. That's old prog souvenirs for me so please correct me if this is stupid. Can it be that my clone is wrong ? (indeed I am no

Re: [Rcpp-devel] package with module not compiling on Mac

2013-01-31 Thread Romain Francois
Hello, I can reproduce the compiler error on my mac. If I comment the methods Swap and Etoile, then I can compile the package. Now looking at the signatures: cplfunction & Swap(double y) ; cplfunction & Etoile() ; I think the problem is that they return a reference. Looking at their code, i