Browse Source

Comments

master
Pete Shadbolt 8 years ago
parent
commit
51bdb17d31
3 changed files with 6 additions and 3 deletions
  1. +1
    -0
      cz_table.py
  2. +0
    -1
      tables.py
  3. +5
    -2
      tests/test_graph.py

+ 1
- 0
cz_table.py View File

@@ -11,6 +11,7 @@ no_bond = np.kron(qi.plus, qi.plus)


for u in tables.unitaries: for u in tables.unitaries:
psi = qi.cz*np.kron(u, qi.ha)*bond psi = qi.cz*np.kron(u, qi.ha)*bond
print u


for bb in bond, no_bond: for bb in bond, no_bond:
for a in tables.unitaries: for a in tables.unitaries:


+ 0
- 1
tables.py View File

@@ -50,7 +50,6 @@ def construct_tables(filename="tables.cache"):
cPickle.dump(output, f) cPickle.dump(output, f)
return output return output



decompositions = ("xxxx", "xx", "zzxx", "zz", "zxx", "z", "zzz", "xxz", decompositions = ("xxxx", "xx", "zzxx", "zz", "zxx", "z", "zzz", "xxz",
"xzx", "xzxxx", "xzzzx", "xxxzx", "xzz", "zzx", "xxx", "x", "xzx", "xzxxx", "xzzzx", "xxxzx", "xzz", "zzx", "xxx", "x",
"zzzx", "xxzx", "zx", "zxxx", "xxxz", "xzzz", "xz", "xzxx") "zzzx", "xxzx", "zx", "zxxx", "xxxz", "xzzz", "xz", "xzxx")


+ 5
- 2
tests/test_graph.py View File

@@ -4,6 +4,7 @@ import time




def demograph(): def demograph():
""" A graph for testing with """
g = GraphState() g = GraphState()
g.add_edge(0, 1) g.add_edge(0, 1)
g.add_edge(1, 2) g.add_edge(1, 2)
@@ -13,7 +14,8 @@ def demograph():
return g return g




def test_graph():
def test_graph_basic():
""" Test that we can construct graphs, delete edges, whatever """
g = demograph() g = demograph()
assert g.ngbh[0] == set([1, 2, 3]) assert g.ngbh[0] == set([1, 2, 3])
g.del_edge(0, 1) g.del_edge(0, 1)
@@ -58,9 +60,10 @@ def test_edgelist():




def test_million_sites(): def test_million_sites():
""" Testing that making a graph of tent housand qubits takes less than half a second"""
""" Testing that making a graph of ten thousand qubits takes less than half a second"""
g = GraphState() g = GraphState()
t = time.clock() t = time.clock()
for i in xrange(100000): for i in xrange(100000):
g.add_edge(i, i + 1) g.add_edge(i, i + 1)
assert time.clock() - t < .5 assert time.clock() - t < .5


Loading…
Cancel
Save