Commit dad8845e authored by Anton Akhmerov's avatar Anton Akhmerov Committed by Christoph Groth
Browse files

fix a broken case in gaussian

parent 58bd15e9
......@@ -106,12 +106,14 @@ def gaussian(n, sym='A', v=1.):
"""
if sym not in sym_list:
raise ValueError('Unknown symmetry type.')
if (c(sym) or t(sym) == -1 or p(sym) == -1) and n % 2:
raise ValueError('Matrix dimension should be even in chosen symmetry'
'class.')
else:
tau_z = np.array((n // 2) * [1, -1])
idx_x = np.arange(n) + tau_z
if (c(sym) or t(sym) == -1 or p(sym) == -1):
if n % 2:
raise ValueError('Matrix dimension should be even in'
' chosen symmetry class.')
else:
tau_z = np.array((n // 2) * [1, -1])
idx_x = np.arange(n) + tau_z
if sym == 'CII' and n % 4:
raise ValueError('Matrix dimension should be a multiple of 4 in'
'symmetry class CII.')
......
......@@ -19,6 +19,8 @@ def test_gaussian():
for sym in rmt.sym_list:
if sym not in ('A', 'D', 'AI'):
assert_raises(ValueError, rmt.gaussian, 5, sym)
else:
rmt.gaussian(5, sym) # Check it is allowed.
h = rmt.gaussian(n, sym)
if rmt.t(sym):
t_mat = np.array(rmt.h_t_matrix[sym])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment