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

2013-02-01 Thread Dirk Eddelbuettel
On 1 February 2013 at 10:26, M A wrote: | The fundamental problem is, as you said, that RcppEigen doesn't know | how to form an Eigen::Map with the as function. Templates are initiated by the compiler based on what is available. This fails as nobody wrote one with this 'const' signature. Now, i

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

2013-02-01 Thread M A
Yes, I can understand why it's not clear what the Cm_class is for (I did take out all the linear algebra and other parts of the class). That is, after all, a consequence of creating a minimal example. And, I am also happy to declare functions as you do. The point is, though, that the typedef used i

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