'Checks if a matrix is equal to the identity matrix.'

def assert_is_identity_matrix(self, got, rtol=None, atol=None):

    self.assertEqual(got.shape[(-1)], got.shape[(-2)])
    eye = np.eye(got.shape[(-1)], dtype=got.dtype)
    resolution = (5 * np.finfo(got.dtype).resolution)
    if (rtol is None):
        rtol = (10 * resolution)
    if (atol is None):
        atol = (100 * resolution)
    np.testing.assert_allclose(got, eye, rtol, atol)
