dear members, I came to know from stackoverflow that the following references a row in a matrix in C++:
M[2] references 2nd row of the Matrix. I am using Rcpp to write C++ code in R. However, I ended up with the following inconsistency: > M x y z [1,] 1 1 1 [2,] 2 2 2 [3,] 3 3 3 [4,] 4 4 4 [5,] 5 5 5 [6,] 6 6 6 > cppFunction('IntegerVector tccp3(IntegerMatrix M) { IntegerVector x = M[2]; > return x;}') > tccp3(M) [1] 0 0 0 > cppFunction('IntegerVector tccp4(IntegerMatrix M) { IntegerVector x = M[1]; > return x;}') > tccp4(M) [1] 0 0 tccp3 should return (3,3,3) and tccp4 should return (2,2,2). Can you please shed light on what is going on? very many thanks for your time and effort.... Yours sincerely, AKSHAY M KULKARNI
_______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel