applied Matrix.assert for all functions