3 ms·
The main advantage of this approach is that you can use any C++ compiler and the library (in this case Eigen) will work. The disadvantage of this approach is th
by certik 7y ago
The main advantage of this approach is that you can use any C++ compiler and the library (in this case Eigen) will work.
The disadvantage of this approach is that the code is incomprehensible to average scientists, you must spend a lot of effort to become a C++ expert.
The advantage of Fortran is that the code is simple and comprehensible to average scientist, and yet fast, because the effort goes into the compiler itself. I would also argue it is easier to implement an optimization pass in the compiler than implement optimizations on the template level in C++.
The disadvantage is that you need a good Fortran compiler. If your compiler can't run your code on, say, GPU, then suddenly there is not a good path forward. While in C++, there is always a way forward via template metaprogramming: perhaps ugly, but at least it gets the job done.