[R] R vs Fortran

Mike Prager Mike.Prager at noaa.gov
Thu Oct 3 19:24:28 CEST 2002

[This was sent to Robin earlier and is posted here in case any others are 
interested in modern Fortran.]

At 09:38 AM 10/03/2002 +1200, Robin Hankin wrote:

>I work in computational fluid dynamics in 2D: I have a 200-by-200
>array of fluid properties such as density and velocity and these
>evolve in time (the precise equations depend on the problem).
>Up to now, I've been using Fortran and the code is very very messy.


>flux =  ( r*right(u) + right(r)*u ) /2
>[where right <- function(x){cbind(x[,-1],NA)} ]

Just to remind you, you can do this kind of thing in modern 
Fortran.  Intrinsic vector and matrix operations have been available in the 
Fortran language for about ten years (since Fortran 90).  In my experience, 
Fortran is usually much faster than R.  It will probably be easier to port 
your code to modern Fortran than to C and its derivatives, and also less 
error prone.

If the code is messy, why not clean it up?  It is possible to write good 
code, and messy code, in any language.

Some comparisons of Fortran and C++, and information on modern Fortran as a 
scientific programming language, can be found at





Whatever path you choose, good luck!

Michael Prager      <Mike.Prager at noaa.gov>
NOAA Center for Coastal Fisheries and Habitat Research
Beaufort, North Carolina  28516  USA

Standard Disclaimers:
* Opinions expressed here are personal and are not otherwise represented.
* Any use of tradenames does not constitute a NOAA or NMFS endorsement.

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list