[Rd] array indexes in C

From: Tamas K Papp <tpapp_at_princeton.edu>
Date: Sat 18 Nov 2006 - 17:54:39 GMT


I am passing (numeric) arrays to a C function, called with .C. To the best of my knowledge, I can do this in R by passing it as a vector (with as.vector) to the .C call.

However, it would be useful to access the array as an array inside C, ie not have to calculate how array indices (i,j,k) map to the vector elements. What is the right way to do this? Are there convenience functions to do the index calculations (knowing the dimensions) that I could call?

In the C99 standard, I have seen something about flexible arrays, I don't know if that would help here.

Thanks,

Tamas



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sun Nov 19 05:08:15 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 18 Nov 2006 - 21:30:48 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.