Slight optimization for cacheing the matrix.