예제 #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