Skip to content

Fix AncillaQubits added via .add_bits to be included in .qubits.#6051

Merged
mergify[bot] merged 1 commit into
Qiskit:masterfrom
kdk:quantumcircuit-add_bits-ancilla-fix
Mar 18, 2021
Merged

Fix AncillaQubits added via .add_bits to be included in .qubits.#6051
mergify[bot] merged 1 commit into
Qiskit:masterfrom
kdk:quantumcircuit-add_bits-ancilla-fix

Conversation

@kdk
Copy link
Copy Markdown
Member

@kdk kdk commented Mar 18, 2021

Summary

As reported by @Cryoris , QuantumCircuit.add_bits (added in #5486 ) was handling AncillaQubits incorrectly, leading to the following:

>>> qr, ar = QuantumRegister(1), AncillaRegister(1)
>>> circuit = QuantumCircuit(ar, qr)
>>> circuit.x(0)

>>> circuit.draw()

      ┌───┐
a0_0: ┤ X ├
      └───┘
q0_0: ─────

>>> circuit.decompose.draw()

q0_0: ─────────────
      ┌───────────┐
a0_0: ┤ U3(π,0,π) ├
      └───────────┘

Details and comments

@kdk kdk added this to the 0.17 milestone Mar 18, 2021
@kdk kdk requested a review from a team as a code owner March 18, 2021 19:26
@kdk kdk changed the title Fix for AncillaQubits added via .add_bits to be included in .qubits. Fix AncillaQubits added via .add_bits to be included in .qubits. Mar 18, 2021
@mergify mergify Bot merged commit 6e20670 into Qiskit:master Mar 18, 2021
@kdk kdk added the Changelog: None Do not include in the GitHub Release changelog. label Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changelog: None Do not include in the GitHub Release changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants