Displaying 1 result from an estimated 1 matches for "testarma".
Did you mean:
testarma2
2011 Nov 02
1
can one modify array in R memory from C++ without copying it?
..., int *nr, int *nc){
for(int i=0; i< (*nr)*(*nc); i++)
mem[i]=2*mem[i];
}
}
----------------------------------------------
I compile it into a shared library using
R CMD SHLIB passptr.cpp
load and run from R as follows
--------------------------------
>dyn.load("/home/az05625/testarma/passptr.so")
>m<-matrix(1:10,nr=2)
>.C("modify", as.double(m), as.integer(2), as.integer(5), DUP=FALSE)
>From reading docs i thought that DUP=FALSE would ensure that R matrix is
not copied and is multiplied by 2 in place. However, it's not the case,
matrix m is the...