Displaying 1 result from an estimated 1 matches for "oldcarray".
2007 May 14
1
Best Practise
...have the following situation:
(1) Legacy object with a double* array in, all over code so don't want to
change any more than I have to.
(2) Do something like:
SEXP arrayToPassToR;
PROTECT( arrayToPassToR = allocVector( REALSXP, n ) );
for(i=0; i < n; i++) {
REAL(arrayToPassToR)[i] = oldCarray[i]; <---- very slow way to copy
data, can I use memcpy/pointer assignment here to remove the loop without
running into garbage collector?
}
UNPROTECT( arrayToPassToR );
SEXP returnValueFromR;
(3) Have made it to call back to an R function which returns a new /
different SEXP double a...