Skip to content
Prev 378381 / 398502 Next

[FORGED] Newbie Question on R versus Matlab/Octave versus C

If you forge on with your preconceptions of how such a simulation should be implemented then you will be able to reproduce your failure just as spectacularly using R as you did using Octave. It is crucial to employ vectorization of your algorithms if you want good performance with either Octave or R. That vectorization may either be over time or over separate simulations.

I am running simulations of a million cases of power plant performance over 25 years in about a minute. I know someone who used R to simulate a CFD river flow problem in a class in a few minutes, while others using Fortran or Matlab were struggling to get comparable runs completed in many hours. I believe the difference was in how the data were structured and manipulated more than the language that was being used. I think the strong capabilities for presenting results using R makes using it advantageous over Octave, though.

If your problems truly need a compiled language, the Rcpp package lets you mix C++ with R quite easily and then you get the best of both worlds. (C and Fortran are supported, but they are a bit more finicky to setup than C++).
On January 28, 2019 4:00:07 PM PST, Alan Feuerbacher <alanf00 at comcast.net> wrote: