def test_change_negative_semidef(self): eigv = np.array([[100, 1, 1], [-1, -2, -1]]) eigv = cond._fix_eigv(eigv, 500, 10, 1) assert np.allclose(eigv, [[100, 10, 10], [1, 1, 1]])
def test_change_large_eigv(self): eigv = np.array([[100, 1, 1], [200, 2, 2]]) eigv = cond._fix_eigv(eigv, 50, 100, 1) assert np.allclose(eigv, [[50, 1, 1], [50, 2, 2]])
def test_change_small_eigv(self): eigv = np.array([[100, 1, 1], [200, 2, 2]]) eigv = cond._fix_eigv(eigv, 500, 10, 1) assert np.allclose(eigv, [[100, 10, 10], [200, 20, 20]])
def test_change_negative_eigv(self): eigv = np.array([[10, 1, -2], [20, 2, -1]]) eigv = cond._fix_eigv(eigv, 100, 10, 1) assert np.allclose(eigv, [[10, 1, 1], [20, 2, 2]])