Skip to content

Commit

Permalink
fix: minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
changsookim committed Oct 25, 2024
1 parent 36c1348 commit f19dc6e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
3 changes: 1 addition & 2 deletions src/qibo/models/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,7 @@ def light_cone(self, *qubits):
qubit_map = {q: i for i, q in enumerate(sorted(qubits))}
kwargs = dict(self.init_kwargs)
kwargs["nqubits"] = len(qubits)
new_wire_names = [self.wire_names[q] for q in list(sorted(qubits))]
kwargs["wire_names"] = new_wire_names
kwargs["wire_names"] = [self.wire_names[q] for q in list(sorted(qubits))]
circuit = self.__class__(**kwargs)
circuit.add(gate.on_qubits(qubit_map) for gate in reversed(list_of_gates))
return circuit, qubit_map
Expand Down
6 changes: 3 additions & 3 deletions src/qibo/transpiler/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def __call__(self, circuit: Circuit) -> Circuit:
)
if logical_qubits == physical_qubits:
return circuit
new_wire_names = circuit.wire_names.copy() + [
name for name in self.connectivity.nodes if name not in circuit.wire_names
]
new_wire_names = circuit.wire_names + list(
self.connectivity.nodes - circuit.wire_names
)
new_circuit = Circuit(nqubits=physical_qubits, wire_names=new_wire_names)
for gate in circuit.queue:
new_circuit.add(gate)
Expand Down
2 changes: 0 additions & 2 deletions src/qibo/transpiler/placer.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ def __call__(self, circuit: Circuit = None):
Args:
circuit (:class:`qibo.models.circuit.Circuit`): circuit to be transpiled.
"""
if circuit is None:
raise_error(ValueError, "Circuit must be provided.")
return


Expand Down
7 changes: 0 additions & 7 deletions tests/test_transpiler_placer.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,6 @@ def test_trivial(star_connectivity):
assert_placement(circuit, connectivity)


def test_trivial_error(star_connectivity):
connectivity = star_connectivity()
placer = Trivial(connectivity=connectivity)
with pytest.raises(ValueError):
placer()


def test_trivial_restricted(star_connectivity):
names = ["q0", "q2"]
circuit = Circuit(2, wire_names=names)
Expand Down

0 comments on commit f19dc6e

Please sign in to comment.