This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
modifying matrix allocation functions for use with R
- To: <gsl-discuss at sources dot redhat dot com>
- Subject: modifying matrix allocation functions for use with R
- From: Faheem Mitha <faheem at email dot unc dot edu>
- Date: Fri, 5 Oct 2001 15:48:28 -0400 (EDT)
Dear People,
Here is a relatively esoteric question. Some of you may be familiar with
R (sometimes called GNU S) which does statistical stuff. It is possible to
use C code compiled into a shared library as a backend for R. Now, I was
wanting to use some GSL routines in this code.
In particular, I need to use allocation functions like gsl_matrix_alloc.
Unfortunately, I'm not sure whether standard calloc/malloc that are used
work with R. I'm going to check this, but I think the answer is most
likely no. R uses a routine called R_alloc which takes storage from the R
heap and manages the cleanup itself (so you don't need to use free).
One option I was considering was rewriting gsl_matrix_alloc (leaving out
the error checking) in terms of R_alloc. However, I can't find the code
for FUNCTION(gsl_block, alloc) (I assume this means gsl_block_alloc)
used in the code for gsl_matrix_alloc. gsl_matrix_alloc itself seems to be
in matrix/init_source.c. Can someone point me to the code for
gsl_block_alloc, or suggest any other options?
I'm not subscribed to the list, so I would be obliged if you would cc me.
Sincerely, Faheem Mitha.