[Rd] R-devel does not update the C++ returned variables
sarah manderni
sarahmanderni at gmail.com
Mon Mar 2 09:50:00 CET 2015
Hi,
Within my R code, I am using a C++ function as below:
overlaps <- matrix(0, nrow=B, ncol=length(N))
overlaps.P <- matrix(0, nrow=B, ncol=length(N))
.C("speedUp", D, S, pD, pS, nrow(D), as.integer(N), length(N),
ssq[i], i, as.integer(B), overlaps, overlaps.P, DUP=FALSE)
the function "speedUp", is supposed to update matrices overlaps and
overlaps.P and it works with official R versions.
However, using the same code in R-devel, it does not update matrices and
they remain all zero without returning any errors.
But, if I store the return values from C function in a variable lets say
"test" as follows:
test <- .C("speedUp", D, S, pD, pS, nrow(D), as.integer(N),
length(N),
ssq[i], i, as.integer(B), overlaps, overlaps.P, DUP=FALSE)
then the corresponding element of test to matrix "overlaps"
(test[["overlaps"]]) again has the updated values (correct non-zero values)
though the overlaps matrix itself is still empty.
I mean in official R, the "overlaps" matrix is updated after calling the
function but not in R-devel. Also it works in both environment and return
correct values to variable "test" in R-devel as well.
Did you face any similar problem so that R-devel does not update the
variable returned by C++?
Thanks for the help.
[[alternative HTML version deleted]]
More information about the R-devel
mailing list