Dense matrix optimizations

Tested on the ExternalData/.../cube_1e3 groundwater simulation.

A little rewriting of the code (const correctness and local variables) give small improvement: ~1e6 less instructions.
The largest (3.5x) improvement is coming from removed `throw` in matrix access operator. This is replaced by assert now. Number of instructions decreases from ~44.904e9 to ~12.610e9.