Fixing minor bug in disjoint_2q_block
Layering and adding option add_barriers_between_layers
#405
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.
Description
This PR fixes a minor bug in
disjoint_2q_block
Layering, where it previously pushed 2q-gates erroneously to the second layer, if the first layer has 1q-gates already applied to the same qubits.I also took this as an opportunity to separate
disjoint_2q_block
anddisjoint_qubits
into 2 different functions for the sake of readability. It was already getting cluttered now, and with a soon-to-come suggestion for another similar layering technique (specifically designed for noise-aware mapping) the problem will probably only get worse.In my opinion, the ensuing code duplication is not too bad, but if you disagree, I am also happy to reintegrate both functions back into one.
Additionally, I added the mapping option
add_barriers_between_layers
intended for making layer boundaries visible after the mapping process.Checklist: