Skip to content
Snippets Groups Projects
Commit 798fe150 authored by Joseph Weston's avatar Joseph Weston Committed by Christoph Groth
Browse files

fix test

The fact that this test was broken was not seen before because
in Python 2 dictionaries have the same sort-order on subsequent
program runs. This is not the case for Python 3.
parent a00dc0dd
No related branches found
No related tags found
No related merge requests found
......@@ -91,10 +91,10 @@ def test_hamiltonian_submatrix():
sys[((gr(i), gr(i + 1)) for i in xrange(2))] = hopping
sys2 = sys.finalized()
mat = sys2.hamiltonian_submatrix((2, 1))
mat_should_be = [[5, 1, 0], [1, 4, 1.], [0, 1, 3]]
mat_should_be = [[3, 1, 0], [1, 4, 1], [0, 1, 5]]
# Sorting is required due to unknown compression order of builder.
onsite_hamiltonians = mat.flat[::3]
onsite_hamiltonians = mat.flat[::4]
perm = np.argsort(onsite_hamiltonians)
mat = mat[perm, :]
mat = mat[:, perm]
......
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