Add matrix comparing functionality, only tested for exception freeness