示例#1
0
def test_greater():
    assert yx_cmp(GridQubit(1, 1), GridQubit(0, 0)) > 0
    assert yx_cmp(GridQubit(1, 1), GridQubit(0, 1)) > 0
    assert yx_cmp(GridQubit(0, 1), GridQubit(1, 0)) > 0
示例#2
0
文件: greedy.py 项目: google2013/Cirq
 def lower_left():
     cand = None
     for n in device.qubits:
         if cand is None or yx_cmp(n, cand) < 0:
             cand = n
     return cand
示例#3
0
def test_lower():
    assert yx_cmp(GridQubit(0, 0), GridQubit(1, 1)) < 0
    assert yx_cmp(GridQubit(0, 1), GridQubit(1, 1)) < 0
    assert yx_cmp(GridQubit(1, 0), GridQubit(0, 1)) < 0
示例#4
0
def test_equal():
    assert yx_cmp(GridQubit(0, 0), GridQubit(0, 0)) == 0
    assert yx_cmp(GridQubit(1, 1), GridQubit(1, 1)) == 0
示例#5
0
def test_equal():
    assert yx_cmp(GridQubit(0, 0), GridQubit(0, 0)) == 0
    assert yx_cmp(GridQubit(1, 1), GridQubit(1, 1)) == 0
示例#6
0
def test_greater():
    assert yx_cmp(GridQubit(1, 1), GridQubit(0, 0)) > 0
    assert yx_cmp(GridQubit(1, 1), GridQubit(0, 1)) > 0
    assert yx_cmp(GridQubit(0, 1), GridQubit(1, 0)) > 0
示例#7
0
def test_lower():
    assert yx_cmp(GridQubit(0, 0), GridQubit(1, 1)) < 0
    assert yx_cmp(GridQubit(0, 1), GridQubit(1, 1)) < 0
    assert yx_cmp(GridQubit(1, 0), GridQubit(0, 1)) < 0
示例#8
0
def test_greater():
    assert yx_cmp(XmonQubit(1, 1), XmonQubit(0, 0)) > 0
    assert yx_cmp(XmonQubit(1, 1), XmonQubit(0, 1)) > 0
    assert yx_cmp(XmonQubit(0, 1), XmonQubit(1, 0)) > 0
示例#9
0
def test_equal():
    assert yx_cmp(XmonQubit(0, 0), XmonQubit(0, 0)) == 0
    assert yx_cmp(XmonQubit(1, 1), XmonQubit(1, 1)) == 0
示例#10
0
def test_lower():
    assert yx_cmp(XmonQubit(0, 0), XmonQubit(1, 1)) < 0
    assert yx_cmp(XmonQubit(0, 1), XmonQubit(1, 1)) < 0
    assert yx_cmp(XmonQubit(1, 0), XmonQubit(0, 1)) < 0
示例#11
0
 def lower_left():
     cand = None
     for n in device.qubits:
         if cand is None or yx_cmp(n, cand) < 0:
             cand = n
     return cand