Skip to content
Snippets Groups Projects
Commit eaaf752b authored by Anton Akhmerov's avatar Anton Akhmerov Committed by Christoph Groth
Browse files

improve warning settings, add minimal test to general eigenproblem

parent f4f58d6d
No related branches found
No related tags found
No related merge requests found
......@@ -457,9 +457,9 @@ def unified_eigenproblem(h_onslice, h_hop, tol):
propselect = (np.abs(np.abs(alpha) - np.abs(beta)) <
eps * tol * np.abs(beta))
invalid_warning_setting = np.seterr(invalid='ignore')['invalid']
warning_settings = np.seterr(divide='ignore', invalid='ignore')
ev = alpha/beta
np.seterr(invalid=invalid_warning_setting)
np.seterr(**warning_settings)
# Note: the division is OK here, as we later only access
# eigenvalues close to the unit circle
......
......@@ -222,6 +222,14 @@ def test_singular_degenerate_with_crossing():
assert_almost_equal(g,
se.self_energy(h_onslice, h_hop))
def test_singular_h_and_t():
h = 0.1 * np.identity(6)
t = np.eye(6, 6, 4)
sigma = se.self_energy(h, t)
sigma_should_be = np.zeros((6,6))
sigma_should_be[4, 4] = sigma_should_be[5, 5] = -10
assert_almost_equal(se.self_energy(h, t), sigma_should_be)
def test_modes():
h, t = .3, .7
vecs, vecslinv, nrpop, svd = se.modes(np.mat(h), np.mat(t))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment