I am using a R/C wrapper to call a set of subroutines in a Fortran module. I want to get the outputs as arrays of 2D and 3D in R. However, I am having troubles defining the 3D output in the wrapper. So far I did not manage to define the output for a 3D array, since allocMatrix takes only three arguments (for 2D arrays/matrices):
SEXP output = PROTECT( allocMatrix(REALSXP, nt, 5) );
// 2nd argument to allocMatrix is number of rows, 3rd is number of columns
Does anyone know if it is possible or how to define the output as a 3D array in the wrapper?
I'm working on a Mac running Fortran 90, GNU Fortran, and the C compiler that comes with Xcode.
Any help/suggestion would be much appreciated.