Is "the math stuff" all the optimizations being performed e.g. vectorizing multiplication?
Not trying to sound dismissive here but the core math the post is working with is actually a pretty straightforward matrix multiplication.
The bulk of the discussion focuses on optimizing the execution of that straightforward multiplication algorithm [triple-nested for loop; O(n^3)] rather than making algorithmic/mathematic optimizations.
And again, specific questions are easier to answer. :)
JavaScript code is readable, at least.