Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving docstrings in final qubit mapping, w/ {logical: physical} #1563

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/qibo/transpiler/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __call__(self, circuit: Circuit, *args) -> Tuple[Circuit, dict]:
circuit (:class:`qibo.models.circuit.Circuit`): Circuit to be routed.

Returns:
(:class:`qibo.models.circuit.Circuit`, dict): Routed circuit and final logical-physical qubit mapping.
(:class:`qibo.models.circuit.Circuit`, dict): Routed circuit and final {logical: physical} qubit mapping.
"""


Expand Down
4 changes: 2 additions & 2 deletions src/qibo/transpiler/asserts.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def assert_transpiling(
original_circuit (:class:`qibo.models.circuit.Circuit`): Circuit before transpiling.
transpiled_circuit (:class:`qibo.models.circuit.Circuit`): Circuit after transpiling.
connectivity (:class:`networkx.Graph`): Hardware connectivity.
final_layout (dict): Final logical-physical qubit mapping.
final_layout (dict): Final {logical: physical} qubit mapping.
native_gates (:class:`qibo.transpiler.unroller.NativeGates`, optional): Native gates supported by the hardware.
Defaults to :class:`qibo.transpiler.unroller.NativeGates.default()`.
check_circuit_equivalence (bool, optional): Check if the transpiled circuit is equivalent to the original one.
Expand Down Expand Up @@ -68,7 +68,7 @@ def assert_circuit_equivalence(
Args:
original_circuit (:class:`qibo.models.circuit.Circuit`): Circuit before transpiling.
transpiled_circuit (:class:`qibo.models.circuit.Circuit`): Circuit after transpiling.
final_layout (dict): Final logical-physical qubit mapping.
final_layout (dict): Final {logical: physical} qubit mapping.
test_states (list, optional): List of states to test the equivalence.
If ``None``, ``ntests`` random states will be tested. Defauts to ``None``.
ntests (int, optional): Number of random states to test the equivalence. Defaults to :math: `3`.
Expand Down
2 changes: 1 addition & 1 deletion src/qibo/transpiler/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __call__(self, circuit):
circuit (:class:`qibo.models.circuit.Circuit`): Circuit to be transpiled.

Returns:
(:class:`qibo.models.circuit.Circuit`, dict): Transpiled circuit and final logical-physical qubit mapping.
(:class:`qibo.models.circuit.Circuit`, dict): Transpiled circuit and final {logical: physical} qubit mapping.
"""

final_layout = None
Expand Down
10 changes: 5 additions & 5 deletions src/qibo/transpiler/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def routed_circuit(self, circuit_kwargs: Optional[dict] = None):
return self._routed_blocks.circuit(circuit_kwargs=circuit_kwargs)

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

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

Expand Down Expand Up @@ -338,7 +338,7 @@ def __call__(self, circuit: Circuit):
circuit (:class:`qibo.models.circuit.Circuit`): Circuit to be matched to hardware connectivity.

Returns:
(:class:`qibo.models.circuit.Circuit`, dict): Routed circuit and final logical-physical qubit mapping.
(:class:`qibo.models.circuit.Circuit`, dict): Routed circuit and final {logical: physical} qubit mapping.
"""
assert_placement(circuit, self.connectivity)
self._preprocessing(circuit=circuit)
Expand Down Expand Up @@ -519,7 +519,7 @@ def _update_front_layer(self):

def _preprocessing(self, circuit: Circuit):
"""The following objects will be initialised:
- circuit: class to represent circuit and to perform logical-physical qubit mapping.
- circuit: class to represent circuit and to perform {logical: physical} qubit mapping.
- _final_measurements: measurement gates at the end of the circuit.
- _front_layer: list containing the blocks to be executed.

Expand Down Expand Up @@ -629,7 +629,7 @@ def __call__(self, circuit: Circuit):
circuit (:class:`qibo.models.circuit.Circuit`): Circuit to be routed.

Returns:
(:class:`qibo.models.circuit.Circuit`, dict): Routed circuit and final logical-physical qubit mapping.
(:class:`qibo.models.circuit.Circuit`, dict): Routed circuit and final {logical: physical} qubit mapping.
"""
assert_placement(circuit, self.connectivity)
self._preprocessing(circuit=circuit)
Expand Down Expand Up @@ -669,7 +669,7 @@ def added_swaps(self):

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