An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090326/9436f8cb/attachment-0002.pl>
Fortran-90 and R
6 messages · mauede at alice.it, Peter Dalgaard, Dieter Menne +2 more
mauede at alice.it wrote:
I have some code in Fortran-90 that outperforms my R implementation of the same algorithm (in terms of speed). I wonder whether it is possible to interface R with Fortran-90. that is would like to call a Fortran routine from my R script, passing to the Fortran routine some real numbers array, some scalar real numbers, and an integer number . I have no idea how to do that because Fortran is a compiled language whereas R s an interpreted language .. therefore I do not know whetehr it makes any sense to build a make file for the linker ... Is the linker necessary ? Thank you very much. Maura
You need to read this: http://cran.r-project.org/doc/manuals/R-exts.pdf -p
O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090326/abfd5603/attachment-0002.pl>
<mauede <at> alice.it> writes:
I do hope the chapte about "Interfacing R and Fortran" is sufficient. I have a heavy load of work from two projects and no previous experience in
either cases (analysis packages,
algorithms, and so on ...). I am a postdoc.
In that case, think hard if you are not better off using R pure and let the computer run at night. Dieter
On Thu, 2009-03-26 at 11:01 +0100, mauede at alice.it wrote:
I do hope the chapte about "Interfacing R and Fortran" is sufficient. I have a heavy load of work from two projects and no previous experience in either cases (analysis packages, algorithms, and so on ...). I am a postdoc.
Ranjan Maitra Posted this link http://www.stat.umn.edu/~charlie/rc/ last week. I found this quite simple to follow, so it might be a useful companion to the Writing R Extensions manual already suggested. The link above doesn't specifically address fortran 90, but if special handling of f90 code is required, the Writing R Extensions manual will tell you what needs to be done differently. HTH G
Thank you. Maura -----Messaggio originale----- Da: Peter Dalgaard [mailto:p.dalgaard at biostat.ku.dk] Inviato: gio 26/03/2009 8.57 A: mauede at alice.it Cc: r-help at r-project.org Oggetto: Re: [R] Fortran-90 and R mauede at alice.it wrote:
I have some code in Fortran-90 that outperforms my R implementation of the same algorithm (in terms of speed). I wonder whether it is possible to interface R with Fortran-90. that is would like to call a Fortran routine from my R script, passing to the Fortran routine some real numbers array, some scalar real numbers, and an integer number . I have no idea how to do that because Fortran is a compiled language whereas R s an interpreted language .. therefore I do not know whetehr it makes any sense to build a make file for the linker ... Is the linker necessary ? Thank you very much. Maura
You need to read this: http://cran.r-project.org/doc/manuals/R-exts.pdf -p
______________________________________________ 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.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Perhaps you should consider also the possibility of simply export the data from the R workspace to the system and make your fortran code to read these system files.
On Thu, 2009-03-26 at 11:01 +0100, mauede at alice.it wrote:
I do hope the chapte about "Interfacing R and Fortran" is sufficient. I have a heavy load of work from two projects and no previous experience in either cases (analysis packages, algorithms, and so on ...). I am a postdoc.
Ranjan Maitra Posted this link http://www.stat.umn.edu/~charlie/rc/ last week. I found this quite simple to follow, so it might be a useful companion to the Writing R Extensions manual already suggested. The link above doesn't specifically address fortran 90, but if special handling of f90 code is required, the Writing R Extensions manual will tell you what needs to be done differently. HTH G
Thank you. Maura -----Messaggio originale----- Da: Peter Dalgaard [mailto:p.dalgaard at biostat.ku.dk] Inviato: gio 26/03/2009 8.57 A: mauede at alice.it Cc: r-help at r-project.org Oggetto: Re: [R] Fortran-90 and R mauede at alice.it wrote:
I have some code in Fortran-90 that outperforms my R implementation of
the same algorithm (in terms of speed).
I wonder whether it is possible to interface R with Fortran-90. that
is would like to call a Fortran routine from my R
script, passing to the Fortran routine some real numbers array, some
scalar real numbers, and an integer number .
I have no idea how to do that because Fortran is a compiled language
whereas R s an interpreted language ..
therefore I do not know whetehr it makes any sense to build a make
file for the linker ... Is the linker necessary ?
Thank you very much. Maura
You need to read this: http://cran.r-project.org/doc/manuals/R-exts.pdf -p
______________________________________________ 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.
-- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
______________________________________________ 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.