Re: [Rcpp-devel] Issue with Matrices and Iterators

2013-10-14 Thread Alessandro Mammana
You are right, now the code compiles! But why? I understand that data is stored in column major. However I hoped that using an iterator I would abstract away from how the data is stored and that the function that increases the iterator takes care of increasing the pointer of nrow positions... Than

Re: [Rcpp-devel] Issue with Matrices and Iterators

2013-10-14 Thread Romain Francois
Le 14/10/13 21:21, Alessandro Mammana a écrit : Hi all, I have very little experience with Rcpp and also with c++, so I am sorry if my question might be too stupid. I am trying to use iterators in my code, because I understand them better than vectors, because they should be efficient, and becaus

Re: [Rcpp-devel] Issue with Matrices and Iterators

2013-10-14 Thread Matteo Fasiolo
Hi Ale, maybe I'm wrong but mat(0,_) is not a NumericVector, but a Rcpp::MatrixRow. So your function sum() is being called with arguments of the wront type (the error message is saying that). If instead you select a column mat( _, 0) you have a conversion to a NumericVector. I've encountered the