[R] modifying matrix allocation functions for use with R
Faheem Mitha
faheem at email.unc.edu
Fri Oct 5 23:57:07 CEST 2001
Dear R people,
I'm using compiled C code as a shared library as a backend to C code,
using the .C interface. I need to do some matrix manipulation in the C
code. I decided to use the new GSL (Gnu Scientific Library) currently
(0.9.3) in beta status.
This has appropriate matrix structures defined, and quite a comprehensive
collection of matrix routines. However, there is a problem with the space
allocation routines for the matrix structures, in that they use the
standard malloc. In "Writing R Extensions" two ways are listed for doing
memory allocation in this context, "transient memory allocation" (5.1.1)
and "user-controlled memory" (5.1.2). However, neither of these is the
standard malloc, and my current understanding is because the standard
malloc does not work with compiled libs for R.
My current thinking is to rewrite these routines in R. I am open to other
suggestions. If there is anyone who has needed to use and define matrix
routines in this context, I would be interested to hear what you did.
Another option would be to define the matrices in R and pass them
down, but this would mean having to use the .Call interface or something
instead of the .C one, and that is a little too rich for my blood.
A second more general question. Is there any gain in efficiency in using
"native" C code in place of R entry points for C code, like for random
number generation etc?
Please ccc me if you reply, I'm not subscribed to the list. Thanks.
Sincerely, Faheem Mitha.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list