[R] Using fortran code which call LAPACK subroutines

Charles C. Berry
Tue, 13 Jan 2009 18:59:38 -0000

On Tue, 13 Jan 2009, Matthieu Stigler wrote:

> Hello
>
> I'm trying to run a fortran code which use LAPACK subroutines. I think
I
> should use some points shown in the manual 5.5 Creating shared objects but
it
> is too technical for me :-(...



Be sure to look over section 6, esp. 6.17

The headers for DGEQRF, DLASR, DROT, DROTG are all in Blas.h or Lapack.h
(although you will see them in lower case).

XERBLA in libRBlas.so but is not in the R API, so if your code needs to
use it you'll have to add a header like the one in main.c or add your own
version.

I think you can probably do what you want with just


 	PKG_LIBS=${LAPACK_LIBS} $(BLAS_LIBS) ${FLIBS}

in Makevars

and
 	R CMD INSTALL <your-package>

with just the default settings.

HTH,

Chuck

Could anyone help me for the procedure to do:
>
> -which part of the manual is relevant for this type of question? actually
I'm
> speaking from writing R extensions, should I read R admin?
>
> -point 1.2 says: /Recent versions of Autoconf in fact allow an already set
> |FLIBS| to override the test for the FORTRAN linker flags. Also, recent
> versions of R can detect external BLAS and LAPACK libraries./
> but nevertheless I have to include something more? or modify the script?
>
> -should I compile from SHLIB with other options or include it directly into
a
> package and cretae a makevars or PACKAGE_LIBS...? I'm lost...
>
>
> The subroutine I try to use is delcols.f
> (http://www.maths.manchester.ac.uk/~clucas/updating/addcols.f) which calls
>
> *     .. External Subroutines ..
>      EXTERNAL           DGEQRF, DLASR, DROT, DROTG, XERBLA
>
>
> Thank you very much!!
>
> ______________________________________________
> R-help at 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.
>

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901