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

Fixed block collection with classical conditions in Collect2QBlocks #2956

Merged
merged 4 commits into from
Aug 12, 2019

Conversation

maddy-tod
Copy link
Contributor

Summary

As revealed in the random testing there was a niche bug in Collect2QBlocks that lead to blocks of 3 qubits being collected. This occured because the predeccessors/successors of the nodes were added using the calls predecessors() and successors() rather than quantum_predecessors() and quantum_successors(). This meant that if there was a pred/succ node that shared the same classical register, but was not a cx node it could be added despite potentially not sharing the same qubits as the node currently being looked at.

As it is blocks of quantum gates we are looking for, it makes sense to only look at the quantum successors/predecessors.

Details and comments

Solved by replacing all the relevant calls.

NB there are still some calls to predecessors() and successors() as these calls are looking at the ordering of the nodes, so they need to take into account any classical aspects as well as quantum.

@maddy-tod maddy-tod changed the title Fixed bug in Collect2QBlocks Fixed block collection with classical conditions in Collect2QBlocks Aug 9, 2019
@kdk kdk merged commit 5303420 into Qiskit:master Aug 12, 2019
faisaldebouni pushed a commit to faisaldebouni/qiskit-terra that referenced this pull request Aug 5, 2020
…iskit#2956)

* Updated calls to be the quantum versions

* Added in a test case

* Fixed linting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants