You are absolutely right Gabe! I removed the line 'dim(A) <- dim(A)[1] * dim(A)[2]' and my code still executes properly. As you said, matrices are internally stored as one-dimensional arrays (column-major by default), it's just that R exposes them differently by assigning different attributes to them, but as far as C/C++ code is concerned there is no distinction.
Many thanks, Alireza -- View this message in context: http://r.789695.n4.nabble.com/Performance-of-C-and-Call-functions-vs-native-R-code-tp3665017p3668047.html Sent from the R devel mailing list archive at Nabble.com. ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel