Checks if a matrix is an identity matrix.