I'm trying to define a macro to convert 2D array syntax to 1D vector. i.e., for a 12x12 array, matrix[i,j] should evaluate to matrix[12*i + j]. So far I have tried
#define matrix[i,j] matrix[12*i+j]
#define (matrix[i,j]) matrix[12*i+j]
#define matrix[(i,j)] matrix[12*i+j]
#define matrix([i,j]) matrix[12*i+j]`
The reason I am using matrix[i,j] syntax is because it will be an extension to be called from R code, and I would like the other authors of the project to understand exactly what is being done. Is there a way to do this with a macro?