Tests made more rigorous

This commit is contained in:
Fabian Joswig 2021-10-23 17:24:39 +01:00
parent 8aa3fba222
commit e1fd4606d3
2 changed files with 3 additions and 7 deletions

View file

@ -94,15 +94,11 @@ def test_matrix_functions():
for (i, j), entry in np.ndenumerate(check):
diff = entry - sym[i, j]
diff.gamma_method()
assert math.isclose(diff.value, 0.0, abs_tol=1e-9), 'value ' + str(i) + ',' + str(j)
assert math.isclose(diff.dvalue, 0.0, abs_tol=1e-9), 'dvalue ' + str(i) + ',' + str(j)
assert diff.is_zero()
# Check eigh
e, v = pe.linalg.eigh(sym)
for i in range(dim):
tmp = sym @ v[:, i] - v[:, i] * e[i]
for j in range(dim):
tmp[j].gamma_method()
assert math.isclose(tmp[j].value, 0.0, abs_tol=1e-9), 'value ' + str(i) + ',' + str(j)
assert math.isclose(tmp[j].dvalue, 0.0, abs_tol=1e-9), 'dvalue ' + str(i) + ',' + str(j)
assert tmp[j].is_zero()

View file

@ -245,4 +245,4 @@ def test_cobs():
assert np.allclose(0.0, diff.real.deltas['t'])
assert np.allclose(0.0, diff.imag.deltas['t'])
div = my_cobs / other
assert (my_cobs / other * other - my_cobs).is_zero()