def test_n_rows_less_than_2(): pytest.importorskip("cirq_google") with pytest.raises(AssertionError): with cirq.testing.assert_deprecated('_beyond_classical_', deadline='v0.16'): supremacy_v2.generate_boixo_2018_supremacy_circuits_v2_bristlecone( n_rows=1, cz_depth=0, seed=0)
def test_google_v2_supremacy_bristlecone(): pytest.importorskip("cirq_google") # Check instance consistency with cirq.testing.assert_deprecated('_beyond_classical_', deadline='v0.16', count=2): c = supremacy_v2.generate_boixo_2018_supremacy_circuits_v2_bristlecone( n_rows=11, cz_depth=8, seed=0) assert len(c) == 10 assert len(c.all_qubits()) == 70 assert len(list(c.findall_operations_with_gate_type(ops.CZPowGate))) == 119 assert len(list(c.findall_operations_with_gate_type(ops.XPowGate))) == 43 assert len(list(c.findall_operations_with_gate_type(ops.YPowGate))) == 69 assert isinstance(c.operation_at(GridQubit(2, 5), 2).gate, ops.YPowGate) assert isinstance(c.operation_at(GridQubit(3, 2), 2).gate, ops.XPowGate) assert isinstance(c.operation_at(GridQubit(1, 6), 3).gate, ops.XPowGate) # test smaller subgraph with cirq.testing.assert_deprecated('_beyond_classical_', deadline='v0.16', count=2): c = supremacy_v2.generate_boixo_2018_supremacy_circuits_v2_bristlecone( n_rows=9, cz_depth=8, seed=0) qubits = list(c.all_qubits()) qubits.sort() assert len(qubits) == 48 assert isinstance(c.operation_at(qubits[5], 2).gate, ops.YPowGate) assert isinstance(c.operation_at(qubits[7], 3).gate, ops.YPowGate) assert len(list(c.findall_operations_with_gate_type(ops.CZPowGate))) == 79 assert len(list(c.findall_operations_with_gate_type(ops.XPowGate))) == 32
def test_google_v2_supremacy_bristlecone(): # Check instance consistency c = supremacy_v2.generate_boixo_2018_supremacy_circuits_v2_bristlecone( n_rows=11, cz_depth=8, seed=0) assert len(c) == 10 assert len(c.all_qubits()) == 70 assert len(list(c.findall_operations_with_gate_type(ops.CZPowGate))) == 119 assert len(list(c.findall_operations_with_gate_type(ops.XPowGate))) == 43 assert len(list(c.findall_operations_with_gate_type(ops.YPowGate))) == 69 assert isinstance(c.operation_at(GridQubit(2, 5), 2).gate, ops.YPowGate) assert isinstance(c.operation_at(GridQubit(3, 2), 2).gate, ops.XPowGate) assert isinstance(c.operation_at(GridQubit(1, 6), 3).gate, ops.XPowGate) #test smaller subgraph c = supremacy_v2.generate_boixo_2018_supremacy_circuits_v2_bristlecone( n_rows=9, cz_depth=8, seed=0) qubits = list(c.all_qubits()) qubits.sort() assert len(qubits) == 48 assert isinstance(c.operation_at(qubits[5], 2).gate, ops.YPowGate) assert isinstance(c.operation_at(qubits[7], 3).gate, ops.YPowGate) assert len(list(c.findall_operations_with_gate_type(ops.CZPowGate))) == 79 assert len(list(c.findall_operations_with_gate_type(ops.XPowGate))) == 32
def test_n_rows_less_than_2(): pytest.importorskip("cirq.google") with pytest.raises(AssertionError): supremacy_v2.generate_boixo_2018_supremacy_circuits_v2_bristlecone( n_rows=1, cz_depth=0, seed=0)