[Rd] [R] besselK

Ben Bolker bolker at ufl.edu
Mon Nov 24 22:55:17 CET 2008


  [cc'ing to R-devel]

  It's moderately obscure to me too, but ...

  There are two sets of bessel code in the package, one
in C++ from Chris Bond and the other in FORTRAN from Netlib
(I think).  The FORTRAN code is the one that's giving trouble,
you might try just removing the FORTRAN code from the src
directory and trying again.

http://www.tek-tips.com/viewthread.cfm?qid=1296207&page=11

  Eventually it would be nice to get both sets of code
running on multiple platforms, for comparison's sake --
the code that's failing (machcon.f) is the code to define
machine-dependent constants -- this is a fairly standard set of
routines from NETLIB, but they're very grungy in that you're
just supposed to uncomment the constants that are relevant
to your system.  There must be a better way to do this
with configure/looking in system libraries etc. (I don't
really know how this is done in FORTRAN).

  Does anyone out there have experience in porting
code from Netlib and ending up with clean, platform-configured
code?  (I will go look at the deSolve package next, but
since this is a bit of a side project ...)

  Ben Bolker


baptiste auguie wrote:
> Dear Ben,
> 
> Many thanks for the effort you put into this. Out of curiosity I located
> an earlier package (sparma) on your webpage yesterday, but ran into some
> problem when installing it, related to 'machcon.f ' . A similar problem
> comes up when I try to install complexbessel. It must be a fairly
> trivial glitch, but the compilation fails on both machines I've tried
> with the following error log:
> 
>> gfortran -fno-range-check -c machcon.f -o machcon.o
>> machcon.f: In function ‘r1mach’:
>> machcon.f:696: fatal error: gfc_todo: Not Implemented: Initialization
>> of overlapping variables
>> compilation terminated.
> 
> The cause of this error is quite obscure to me, perhaps you've seen this
> message before?
> 
> Many thanks again,
> 
> baptiste
> 
> 
> On MacOS10.5, R2.8,
> 
>> baptiste:Desktop baptiste$ R CMD INSTALL complexbessel_0.0.1.tar.gz
>> * Installing to library
>> '/Library/Frameworks/R.framework/Resources/library'
>> * Installing *source* package 'complexbessel' ...
>> ** libs
>> ** arch - i386
>> gfortran -arch i386   -fPIC  -g -O2 -c Rzbesk.f -o Rzbesk.o
>> g++ -arch i386 -I/Library/Frameworks/R.framework/Resources/include
>> -I/Library/Frameworks/R.framework/Resources/include/i386 
>> -I/usr/local/include    -fPIC  -g -O2 -c cbessik-wrap.cc -o
>> cbessik-wrap.o
>> g++ -arch i386 -I/Library/Frameworks/R.framework/Resources/include
>> -I/Library/Frameworks/R.framework/Resources/include/i386 
>> -I/usr/local/include    -fPIC  -g -O2 -c cbessik.cc -o cbessik.o
>> gfortran -fno-range-check -c machcon.f -o machcon.o
>> machcon.f: In function ‘r1mach’:
>> machcon.f:696: fatal error: gfc_todo: Not Implemented: Initialization
>> of overlapping variables
>> compilation terminated.
>> make: *** [machcon.o] Error 1
>> chmod:
>> /Library/Frameworks/R.framework/Resources/library/complexbessel/libs/i386/*:
>> No such file or directory
>> ** arch - ppc
>> gfortran -arch ppc   -fPIC  -g -O2 -c Rzbesk.f -o Rzbesk.o
>> g++ -arch ppc -I/Library/Frameworks/R.framework/Resources/include
>> -I/Library/Frameworks/R.framework/Resources/include/ppc 
>> -I/usr/local/include    -fPIC  -g -O2 -c cbessik-wrap.cc -o
>> cbessik-wrap.o
>> g++ -arch ppc -I/Library/Frameworks/R.framework/Resources/include
>> -I/Library/Frameworks/R.framework/Resources/include/ppc 
>> -I/usr/local/include    -fPIC  -g -O2 -c cbessik.cc -o cbessik.o
>> gfortran -fno-range-check -c machcon.f -o machcon.o
>> machcon.f: In function ‘r1mach’:
>> machcon.f:696: fatal error: gfc_todo: Not Implemented: Initialization
>> of overlapping variables
>> compilation terminated.
>> make: *** [machcon.o] Error 1
>> chmod:
>> /Library/Frameworks/R.framework/Resources/library/complexbessel/libs/ppc/*:
>> No such file or directory
>> ERROR: compilation failed for package 'complexbessel'
>> ** Removing
>> '/Library/Frameworks/R.framework/Resources/library/complexbessel'
> 
> sessionInfo()
> R version 2.8.0 (2008-10-20)
> i386-apple-darwin8.11.1
> 
> locale:
> en_GB.UTF-8/en_US.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     methods   base
> 
> other attached packages:
> [1] constants_1.0      spectra_1.0        reshape_0.8.2     
> plyr_0.1.3         scatteringR_1.0    latticeExtra_0.5-4
> lattice_0.17-15    baptMisc_1.0
> [9] RColorBrewer_1.0-2
> 
> loaded via a namespace (and not attached):
> [1] grid_2.8.0  tools_2.8.0
> 
> 
> Similarly, on ubuntu Gutsy, R2.7:
> 
>> R CMD INSTALL complexbessel/
>> * Installing to library '/home/baptiste/R/i486-pc-linux-gnu-library/2.7'
>> * Installing *source* package 'complexbessel' ...
>> ** libs
>> g++ -I/usr/share/R/include      -fpic  -g -O2 -c cbessik.cc -o cbessik.o
>> g++ -I/usr/share/R/include      -fpic  -g -O2 -c cbessik-wrap.cc -o
>> cbessik-wrap.o
>> gfortran -fno-range-check -c machcon.f -o machcon.o
>> machcon.f: In function ‘r1mach’:
>> machcon.f:696: fatal error: gfc_todo: Not Implemented: Initialization
>> of overlapping variables
>> compilation terminated.
>> make: *** [machcon.o] Error 1
>> ERROR: compilation failed for package 'complexbessel'
>> ** Removing
>> '/home/baptiste/R/i486-pc-linux-gnu-library/2.7/complexbessel'
> 
> 
> 
> ________________________________________
> From: Ben Bolker [bolker at ufl.edu]
> Sent: 24 November 2008 15:14
> To: Auguie, Baptiste
> Subject: Re: [R] besselK
> 
>  I took a little time to build a "complexbessel" package.
>  It's barely documented ... but see if this helps.
>  It would be nice to test this for speed and accuracy,
> document it further, etc ...
> 
> Ben Bolker
> 
> 
> 
> baptiste auguie wrote:
>> Hello,
>>
>> I've posted a few messages on the R mailing list concerning bessel
>> functions with a complex argument. It appears I missed your post when
>> browsing the archives <
>> http://tolstoy.newcastle.edu.au/R/e2/help/07/06/19044.html >.
>>
>> Do you still have the experimental wrapper code you mentioned at this
>> occasion? I am not familiar with Fortran, and my attempts at writing
>> such wrapper functions have failed.
>>
>> Best regards,
>>
>> baptiste
>>
>>
>>
>> _____________________________
>>
>> Baptiste Auguié
>>
>> School of Physics
>> University of Exeter
>> Stocker Road,
>> Exeter, Devon,
>> EX4 4QL, UK
>>
>> Phone: +44 1392 264187
>>
>> http://newton.ex.ac.uk/research/emag
>> ______________________________
>>
> 
> 
> -- 
> Ben Bolker
> Associate professor, Biology Dep't, Univ. of Florida
> bolker at ufl.edu / www.zoology.ufl.edu/bolker
> GPG key: www.zoology.ufl.edu/bolker/benbolker-publickey.asc


-- 
Ben Bolker
Associate professor, Biology Dep't, Univ. of Florida
bolker at ufl.edu / www.zoology.ufl.edu/bolker
GPG key: www.zoology.ufl.edu/bolker/benbolker-publickey.asc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20081124/a41b13d5/attachment.bin>


More information about the R-devel mailing list