Added a faster implementation of some matrix ops