def test_empty(self) -> None: circuit = Circuit(1) assert circuit.get_parallelism() == 0 circuit = Circuit(4) assert circuit.get_parallelism() == 0 circuit = Circuit(4, [2, 3, 4, 5]) assert circuit.get_parallelism() == 0
def test_adding_gate_3(self) -> None: circuit = Circuit(2) assert circuit.get_parallelism() == 0 circuit.append_gate(U3Gate(), [0]) assert circuit.get_parallelism() == 1 circuit.append_gate(U3Gate(), [1]) assert circuit.get_parallelism() == 2 circuit.append_gate(CNOTGate(), [0, 1]) assert circuit.get_parallelism() == 2
def test_adding_gate(self) -> None: circuit = Circuit(1) assert circuit.get_parallelism() == 0 circuit.append_gate(U3Gate(), [0]) assert circuit.get_parallelism() == 1 circuit.append_gate(U3Gate(), [0]) assert circuit.get_parallelism() == 1 circuit.append_gate(U3Gate(), [0]) assert circuit.get_parallelism() == 1
def test_adding_gate_2(self) -> None: circuit = Circuit(2) assert circuit.get_parallelism() == 0 circuit.append_gate(U3Gate(), [0]) assert circuit.get_parallelism() == 1 circuit.append_gate(U3Gate(), [1]) assert circuit.get_parallelism() == 2 circuit.append_gate(U3Gate(), [0]) assert circuit.get_parallelism() == 1.5 circuit.append_gate(U3Gate(), [1]) assert circuit.get_parallelism() == 2 circuit.append_gate(U3Gate(), [0]) assert circuit.get_parallelism() - 5 / 3 < 1e-12 circuit.append_gate(U3Gate(), [1]) assert circuit.get_parallelism() == 2
def test_get_parallelism(self, simple_circuit: Circuit) -> None: assert simple_circuit.get_parallelism() == 1.5
def test_value(self, r6_qudit_circuit: Circuit) -> None: assert r6_qudit_circuit.get_parallelism() > 0
def test_type(self, r6_qudit_circuit: Circuit) -> None: assert isinstance(r6_qudit_circuit.get_parallelism(), float)
def test_get_parallelism(self, toffoli_circuit: Circuit) -> None: assert toffoli_circuit.get_parallelism() == 21 / 11
def test_get_parallelism(self, swap_circuit: Circuit) -> None: assert swap_circuit.get_parallelism() == 2