Hi All,

I am confused by a type conversion happening against my intent.

In an R script I allocate a matrix X, and I pass it to a C function
by using

tmp -< .C(..., as.double(X),...).

I use as.double() because I read that it makes sure that the
parameter passing is correct.

I return the matrix from the R script using:

return (list(..., X = tmp$X, ...))

The returned value is not a matrix but a flat vector.

I must not understand something fundamental that is happening
here.

Should I remove the as.double() from the .C() call?

Here is what I am trying to do: allocate a matrix (with doubles)
that is modified by the .C() call and return it from the script.

I am also not sure how to make sure that the allocated matrix
is made up of double values.  If I use diag(n) to initialize
it will that do the trick?

Thanks!
-Matyas

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to