Displaying 1 result from an estimated 1 matches for "passdatafromctor".
2009 Nov 12
1
how to pass matrices from C to R effectively
Hi,
I have C code to produce a lot of matrices to be analyzed. As these
matrices are large (> 1000*10000) and are a lot (> 1000), I am thinking
about how to pass them from C to R effectively.
Would you think about the following solution? In R, I create a wrapper
function
passDataFromCToR = function(row, col) {
mat = matrix(0, row, col)
.C("passDataFromCToR",mat)[[1]]
}
It wraps the following C function
void passDataFromCToR (double *m, int *row, int* col){
mymat = f() // my c function to produce a matrix
// then I copy mymat to m element by element via a...