Pete Shadbolt před 8 roky
rodič
revize
51bdb17d31
3 změnil soubory, kde provedl 6 přidání a 3 odebrání
  1. +1
    -0
      cz_table.py
  2. +0
    -1
      tables.py
  3. +5
    -2
      tests/test_graph.py

+ 1
- 0
cz_table.py Zobrazit soubor

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

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

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


+ 0
- 1
tables.py Zobrazit soubor

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


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


+ 5
- 2
tests/test_graph.py Zobrazit soubor

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


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


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


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()
t = time.clock()
for i in xrange(100000):
g.add_edge(i, i + 1)
assert time.clock() - t < .5


Načítá se…
Zrušit
Uložit