How to write efficient matrix multiplication
Sorry, but this is not at all how to write efficient matrix multiplication.<p>The correct answer is: don&#x27;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).<p>The longer answer is: matrix multiplication is a highly non-trivial algorithmic problem[1], which is, in fact, still open.<p>The asymptotically fast algorithms (such as Strassen&#x27;s[2]) outperform the naive algorithm (i.e. by definition, such is in the article) when matrices get large.<p>After skimming the article it is still unclear to me how the optimized naive algorithm fares against Strassen&#x27;s, for example.<p>The final bit of advice this article is offers is reading the paper on... implementation of BLAS (that&#x27;s what Goto describes there).<p>And so that&#x27;s basically <i>the</i> case where <i>avoiding</i> Goto is considered harmful.<p>[1]<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Matrix_multiplication_algorithm#Sub-cubic_algorithms" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Matrix_multiplication_algorith...</a><p>[2]<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Strassen_algorithm" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Strassen_algorithm</a><p>[3]<a href="https:&#x2F;&#x2F;en.wikiquote.org&#x2F;wiki&#x2F;Donald_Knuth" rel="nofollow">https:&#x2F;&#x2F;en.wikiquote.org&#x2F;wiki&#x2F;Donald_Knuth</a>