How to write efficient matrix multiplication
Sorry, but this is not at all how to write efficient matrix multiplication.The correct answer is: don't. Use BLAS (yes, written in Fortran) + OpenMP (if needed), and let the smart people handle this. (Unless you are one of those smart people - in which case, you should improve BLAS, which the rest of us mortals will use).The longer answer is: matrix multiplication is a highly non-trivial algorithmic problem[1], which is, in fact, still open.The asymptotically fast algorithms (such as Strassen's[2]) outperform the naive algorithm (i.e. by definition, such is in the article) when matrices get large.After skimming the article it is still unclear to me how the optimized naive algorithm fares against Strassen's, for example.The final bit of advice this article is offers is reading the paper on... implementation of BLAS (that's what Goto describes there).And so that's basically the case where avoiding Goto is considered harmful.[1]https://en.wikipedia.org/wiki/Matrix_multiplication_algorith...[2]https://en.wikipedia.org/wiki/Strassen_algorithm[3]https://en.wikiquote.org/wiki/Donald_Knuth