Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Upgrades
TranspileLayout
class adding one more field (i.e.output_qubit_mapping
), a property, and a few convenience methods.Details and comments
Field:
output_qubit_mapping
is added in order to makeTranspileLayout
self contained; meaning that it will not need to know about the (transpiled) circuit that it as attached to in order to understand itsfinal_layout
field. This mimics the wayinput_qubit_mapping
allows interpretation ofinitial_layout
.Property:
num_qubits
is added as a convenient way to assess the number of qubits involved in the layout. Notice that checking the size of a dictionary is anMethods:
get_initial_permutation
allows retrieval of the permutation performed byinitial_layout
.get_final_permutation
allows retrieval of the permutation performed byfinal_layout
.get_complete_permutation
allows retrieval of the composed permutation frominitial_layout
andfinal_layout
(in order).get_complete_layout
allows retrieval of the complete layout that results from composinginitial_layout
andfinal_layout
.#9486 should be updated accordingly