Optimization for setting Matrix[].
Merge branch 'matrix' into stable_BtA