Thank you @JohnCampbell for your very detailed and insightful response.
First, I acknowledge that my claim about “the performance of
matmul is sometimes inferior to a naive triple loop” is WRONG . My apologies to everyone who read this and many thanks to John for pointing it out.
Second, I would like to emphasize that I am more than happy to hear advantages of Fortran, particularly intrinsic like
matmul etc, because I always use them. I rely on them.
Now, let me share my views on your other comments. Since I know only MATLAB (in addition to Fortran), I will focus on it.
Yes, MATLAB does. In MATLAB, you can choose which implementation of BLAS to link to. However, the good news is that you almost never need to do so unless you have quite particular hardware. The default setting works perfectly in most cases. This is why most users do not even know the existence of such options.
I do not know, but probably they do create temporary arrays. However, MATLAB is never supposed to crash due to the creation of temporary arrays — whatever options you use when running your code. If a crash does happen, everybody (the user and the vendor) will agree that it is a bug of MATLAB that should be fixed.
Sure. But the advantage will become much bigger if it does not depend on options, which vary from one compiler to another. In MATLAB, such options are not needed unless, again, you have quite particular hardware.
Totally agree. Thank you for pointing this out.
For your reference, here is what I said:
I am sorry, but according to my limited and humble knowledge of mathematics, Taylor expansion is not considered a matrix/vector operation in normal contexts. I will be very happy to learn from a different opinion.
Totally agree. Regarding MATLAB, it turns out that “the types of calculations their intrinsic functions have been tuned for” mean almost all calculations that MATLAB users normally do. What interests me is why we couldn’t tune the Fortran intrinsic functions also up to the same optimality, without dependence on options. If such a requirement is too high, avoiding stack overflows might be a reasonable starting point.
Sorry, I do not see quite well the relation of this point to the questions under discussion, but I totally agree.
Many thanks again for the detailed response and helpful perspectives.