Skip to content

Commit cbcee14

Browse files
authored
Merge pull request #1563 from qilimanjaro-tech/docstring_qubit_mapping
Improving docstrings in final qubit mapping, w/ `{logical: physical}`
2 parents d32efb8 + 6145cc9 commit cbcee14

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/qibo/transpiler/abstract.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __call__(self, circuit: Circuit, *args) -> Tuple[Circuit, dict]:
4747
circuit (:class:`qibo.models.circuit.Circuit`): Circuit to be routed.
4848
4949
Returns:
50-
(:class:`qibo.models.circuit.Circuit`, dict): Routed circuit and final logical-physical qubit mapping.
50+
(:class:`qibo.models.circuit.Circuit`, dict): Routed circuit and final {logical: physical} qubit mapping.
5151
"""
5252

5353

src/qibo/transpiler/asserts.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def assert_transpiling(
3232
original_circuit (:class:`qibo.models.circuit.Circuit`): Circuit before transpiling.
3333
transpiled_circuit (:class:`qibo.models.circuit.Circuit`): Circuit after transpiling.
3434
connectivity (:class:`networkx.Graph`): Hardware connectivity.
35-
final_layout (dict): Final logical-physical qubit mapping.
35+
final_layout (dict): Final {logical: physical} qubit mapping.
3636
native_gates (:class:`qibo.transpiler.unroller.NativeGates`, optional): Native gates supported by the hardware.
3737
Defaults to :class:`qibo.transpiler.unroller.NativeGates.default()`.
3838
check_circuit_equivalence (bool, optional): Check if the transpiled circuit is equivalent to the original one.
@@ -68,7 +68,7 @@ def assert_circuit_equivalence(
6868
Args:
6969
original_circuit (:class:`qibo.models.circuit.Circuit`): Circuit before transpiling.
7070
transpiled_circuit (:class:`qibo.models.circuit.Circuit`): Circuit after transpiling.
71-
final_layout (dict): Final logical-physical qubit mapping.
71+
final_layout (dict): Final {logical: physical} qubit mapping.
7272
test_states (list, optional): List of states to test the equivalence.
7373
If ``None``, ``ntests`` random states will be tested. Defauts to ``None``.
7474
ntests (int, optional): Number of random states to test the equivalence. Defaults to :math: `3`.

src/qibo/transpiler/pipeline.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __call__(self, circuit):
7777
circuit (:class:`qibo.models.circuit.Circuit`): Circuit to be transpiled.
7878
7979
Returns:
80-
(:class:`qibo.models.circuit.Circuit`, dict): Transpiled circuit and final logical-physical qubit mapping.
80+
(:class:`qibo.models.circuit.Circuit`, dict): Transpiled circuit and final {logical: physical} qubit mapping.
8181
"""
8282

8383
final_layout = None

src/qibo/transpiler/router.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def routed_circuit(self, circuit_kwargs: Optional[dict] = None):
245245
return self._routed_blocks.circuit(circuit_kwargs=circuit_kwargs)
246246

247247
def final_layout(self):
248-
"""Returns the final physical-logical qubits mapping."""
248+
"""Returns the final {logical: physical} qubits mapping."""
249249

250250
return {self.wire_names[i]: self._l2p[i] for i in range(self.nqubits)}
251251

@@ -338,7 +338,7 @@ def __call__(self, circuit: Circuit):
338338
circuit (:class:`qibo.models.circuit.Circuit`): Circuit to be matched to hardware connectivity.
339339
340340
Returns:
341-
(:class:`qibo.models.circuit.Circuit`, dict): Routed circuit and final logical-physical qubit mapping.
341+
(:class:`qibo.models.circuit.Circuit`, dict): Routed circuit and final {logical: physical} qubit mapping.
342342
"""
343343
assert_placement(circuit, self.connectivity)
344344
self._preprocessing(circuit=circuit)
@@ -519,7 +519,7 @@ def _update_front_layer(self):
519519

520520
def _preprocessing(self, circuit: Circuit):
521521
"""The following objects will be initialised:
522-
- circuit: class to represent circuit and to perform logical-physical qubit mapping.
522+
- circuit: class to represent circuit and to perform {logical: physical} qubit mapping.
523523
- _final_measurements: measurement gates at the end of the circuit.
524524
- _front_layer: list containing the blocks to be executed.
525525
@@ -629,7 +629,7 @@ def __call__(self, circuit: Circuit):
629629
circuit (:class:`qibo.models.circuit.Circuit`): Circuit to be routed.
630630
631631
Returns:
632-
(:class:`qibo.models.circuit.Circuit`, dict): Routed circuit and final logical-physical qubit mapping.
632+
(:class:`qibo.models.circuit.Circuit`, dict): Routed circuit and final {logical: physical} qubit mapping.
633633
"""
634634
assert_placement(circuit, self.connectivity)
635635
self._preprocessing(circuit=circuit)
@@ -669,7 +669,7 @@ def added_swaps(self):
669669

670670
def _preprocessing(self, circuit: Circuit):
671671
"""The following objects will be initialised:
672-
- circuit: class to represent circuit and to perform logical-physical qubit mapping.
672+
- circuit: class to represent circuit and to perform {logical: physical} qubit mapping.
673673
- _final_measurements: measurement gates at the end of the circuit.
674674
- _dist_matrix: matrix reporting the shortest path lengh between all node pairs.
675675
- _dag: direct acyclic graph of the circuit based on commutativity.

0 commit comments

Comments
 (0)