10 ms·
I've been using Fortran 90/95 extensively over the last few years, for numerical simulation of quantum systems. I think there's a lot of misconceptions about Fo
by goerz 11y ago
I've been using Fortran 90/95 extensively over the last few years, for numerical simulation of quantum systems. I think there's a lot of misconceptions about Fortran (which is partly due to Fortran 77, with its punchcard format and spaghetti code). Fortran 90 is basically a different language, and is actually reasonably modern. I see it as significantly more suitable for numerical programming than C/C++. Fortran is conceptually much simpler than C. Having multi-dimensional arrays at the core of the language and not having to deal with pointers makes it much harder to shoot yourself in the foot, and yields more robust and easier to read code. Also, Fortran beats any other language (including C) in terms of speed. I would not recommend using it outside of numerical applications, but in its niche, it's pretty much perfect. For more high-level tasks I mostly use Python.
- tfgg 11y agoI also worked on a quantum (DFT) code in Fortran 95. I agree on your points, once you get used to it, it's basically isomorphic to C but with better numerical support. Compared to C++ it's verbose but understandable and with little magic, which is an advantage when working on a team, similar to Java. Main disadvantages I found were rubbish string and IO handling, no standard library of algorithms/data structures (lists, sort, etc.), and (in my codebase) there was still a bit too much reliance on global variables. Most of those are effectively fixed as the high-level controlling code is moved to Python and the F95 code is libraryized.
- m_mueller 11y ago> Most of those are effectively fixed as the high-level controlling code is moved to Python and the F95 code is libraryized. That's exactly how I think high performance numerical code should be structured like. Unfortunately this thinking hasn't quite arrived in the Fortran world yet where most don't really think about a two-language-approach.
- mmarx 11y agoFirst-year students in our maths curriculum here are still taught Fortran 95. > not having to deal with pointers There are pointers in Fortran, though. It's the absence of things like pointer arithmetic that makes them much safer to use.
- phamilton 11y agoHPF (high performance fortran) is quite nice actually. I was very impressed when we played with it in a parallel programming class I took years ago.