Skip to content

Commit a83ef4e

Browse files
committed
Make starting layout variable names plural
The starting layout is a list and can have more than one entry. To make this clearer, this commit renames starting_layout -> starting_layouts and sabre_starting_layout -> sabre_starting_layouts.
1 parent 89c5a6d commit a83ef4e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

qiskit/transpiler/passes/layout/sabre_layout.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ class SabreLayout(TransformationPass):
7676
7777
In addition to starting with a random initial `Layout` the pass can also take in
7878
an additional list of starting layouts which will be used for additional
79-
trials. If the ``sabre_starting_layout`` is present in the property set
79+
trials. If the ``sabre_starting_layouts`` is present in the property set
8080
when this pass is run, that will be used for additional trials. There will still
8181
be ``layout_trials`` of full random starting layouts run and the contents of
82-
``sabre_starting_layout`` will be run in addition to those. The output which results
82+
``sabre_starting_layouts`` will be run in addition to those. The output which results
8383
in the lowest amount of swap gates (whether from the random trials or the property
8484
set starting point) will be used. The value for this property set field should be a
8585
list of :class:`.Layout` objects representing the starting layouts to use. If a
@@ -89,7 +89,7 @@ class SabreLayout(TransformationPass):
8989
Property Set Fields Read
9090
------------------------
9191
92-
``sabre_starting_layout`` (``list[Layout]``)
92+
``sabre_starting_layouts`` (``list[Layout]``)
9393
An optional list of :class:`~.Layout` objects to use for additional layout trials. This is
9494
in addition to the full random trials specified with the ``layout_trials`` argument.
9595
@@ -261,9 +261,9 @@ def run(self, dag):
261261
else:
262262
target = self.coupling_map
263263
inner_run = self._inner_run
264-
if "sabre_starting_layout" in self.property_set:
264+
if "sabre_starting_layouts" in self.property_set:
265265
inner_run = functools.partial(
266-
self._inner_run, starting_layout=self.property_set["sabre_starting_layout"]
266+
self._inner_run, starting_layouts=self.property_set["sabre_starting_layouts"]
267267
)
268268
components = disjoint_utils.run_pass_over_connected_components(dag, target, inner_run)
269269
self.property_set["layout"] = Layout(
@@ -346,7 +346,7 @@ def run(self, dag):
346346
disjoint_utils.combine_barriers(mapped_dag, retain_uuid=False)
347347
return mapped_dag
348348

349-
def _inner_run(self, dag, coupling_map, starting_layout=None):
349+
def _inner_run(self, dag, coupling_map, starting_layouts=None):
350350
if not coupling_map.is_symmetric:
351351
# deepcopy is needed here to avoid modifications updating
352352
# shared references in passes which require directional
@@ -357,11 +357,11 @@ def _inner_run(self, dag, coupling_map, starting_layout=None):
357357
dist_matrix = coupling_map.distance_matrix
358358
original_qubit_indices = {bit: index for index, bit in enumerate(dag.qubits)}
359359
partial_layouts = []
360-
if starting_layout is not None:
360+
if starting_layouts is not None:
361361
coupling_map_reverse_mapping = {
362362
coupling_map.graph[x]: x for x in coupling_map.graph.node_indices()
363363
}
364-
for layout in starting_layout:
364+
for layout in starting_layouts:
365365
virtual_bits = layout.get_virtual_bits()
366366
out_layout = [None] * len(dag.qubits)
367367
for bit, phys in virtual_bits.items():

0 commit comments

Comments
 (0)