Hacker News new | past | comments | ask | show | jobs | submit login

I was surprised to see when I installed R for the first time, that a large amount of the libraries it makes use of are written in fortran.

To complete the installation required me to choose from one of several current and compatible fortran compilers even.

So at least for fortran, the answer is scientific computing.




Fortran is far from extinct, because scientists often prefer it to C/C++, and it's often faster.

Part of the reason is that Fortran passes arrays by value, while C passes them by reference. It's very hard for compilers to optimise a pass-by-reference array, because it might have the memory altered by another part of the program. If it's pass by value, then you know it's safe. It's kind of like threads vs messages.

I think C has some recent work done to close the gap, but even if it's already as fast, it will take a while to port 50 years of legacy numerical code.


Part of the reason is that Fortran passes arrays by value, while C passes them by reference.

Actually, the reason is that Fortran arguments may not alias (passing big arrays by value would be horribly inefficient).

Btw, one of the main goals of C99 was making C a better language for numerics (ie catching up to Fortran): The restrict qualifier was introduced (mainly to mark non-aliasing parameters) as well as complex numbers, variable-length arrays and type-generic math functions.


Some discussion here - http://stackoverflow.com/questions/146159/is-fortran-faster-... - my takeaway is it's possible to write numerical code in C in a way the compiler can optimize it, but Fortran does it by default, and the Fortran culture is about making numerical code as fast as possible.


A lot of NumPy/SciPy (Python's scientific computation libraries) are written in Fortran too: http://docs.scipy.org/doc/numpy/user/install.html


Yup, mostly because they are the same libraries that R uses. I really feel like I may need to learn Fortran at some point, given its ridiculously good numerical capabilities.


Even matlab uses those libraries (http://en.wikipedia.org/wiki/LAPACK )


I actually think that LAPACK will outlive us all, as I can't see anyone ever rewriting (and re-testing) the software that essentially runs science (and a large proportion of "Big Data" approaches).


And, also Octave




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: