Skip to content

calling fortran functions CHOL and DPOTRF form Fortran

2 messages · Gilles GUILLOT, Douglas Bates

#
Hi all,

I'm working out some Fortran code for which 
I want to compute the Choleski decomposition of a covariance matrix
in Fortran.

I tried to do it by two methods :

1) Calling the lapack function DPOTRF.
I can see the source code and check that my call is correct,
but it does not compile with:
system("R CMD SHLIB ~/main.f")
dyn.load("~/main.so")

I get:
Error in dyn.load(x, as.logical(local), as.logical(now)) :
        unable to load shared library 
[...]
 undefined symbol: dpotrf_

Could anyone point out how to compile with such a call to lapack?

2) Calling the Fortran function CHOL
The previous combination of R CMD SHLIB  and dyn.load 
compiles fine but  I would like to see the source code of this function 
to check if my call is correct. I've not been able to find it in  the R source 
distribution.
Could anyone point the place of that file? 

Thanks in advance,

Gilles
#
On 7/5/05, Gilles GUILLOT <gilles.guillot at inapg.inra.fr> wrote:
Make a small package from your source code then follow the instructions in

http://tolstoy.newcastle.edu.au/R/devel/05/06/1382.html
${RSRC}/src/appl/chol.f