[R] Using fortran code which call LAPACK subroutines

Matthieu Stigler matthieu.stigler at gmail.com
Thu Jan 15 17:51:58 CET 2009


Prof Brian Ripley a écrit :
> On Tue, 13 Jan 2009, Charles C. Berry wrote:
>
>> 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.
>
> Not in Fortran code, though: see below
>
> I think Matthieu had not read quite a lot of the documentation: given 
> how carefully it was written, that was disrespectful (as was the lack 
> of a proper signature: see the posting guide: Charles aka Chuck has 
> been exemplary).
>
Sorry if this could be seen as disrespectful, I nevertheless don't think 
that having difficulties to read a good but complex (and difficult for a 
newbie) documentation is a sign of disrespect.
> To put it simply: if you are ashamed of who you are, so are the most 
> prolific helpers here.  Some people resent being milked for free 
> consultancy for commercial firms, and many of us will go many miles 
> out of our way for third-world NGOs/academia.
>
Oh, I forgot to write my name... I'm sorry, well even if you could see 
it from my address I should have written. I understand your worry about 
commercial firms, personnaly, I'm trying to contribute myself to R 
through extensions of package tsDyn 
http://code.google.com/p/tsdyn/wiki/ThresholdCointegration
>> 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.
>
This did the job (just had to copy/paste the xerbla in a proper .f file 
in src)!
Thank you so much!
> Agreed.
>
>
>> 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!!
>>>
>>
>> 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
>>
>> ______________________________________________
>> 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.
>>
>




More information about the R-help mailing list