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

efficient_su2 & co should handle the num_qubits=1 case #13480

Closed
Cryoris opened this issue Nov 22, 2024 · 3 comments · Fixed by #13523
Closed

efficient_su2 & co should handle the num_qubits=1 case #13480

Cryoris opened this issue Nov 22, 2024 · 3 comments · Fixed by #13523
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Cryoris
Copy link
Contributor

Cryoris commented Nov 22, 2024

Environment

  • Qiskit version: 1.3.0rc2
  • Python version: 3.11.9
  • Operating system: macOS

What is happening?

Calling some library functions, like efficient_su2 don't work for num_qubits=1, since the entangling gate requires 2 qubits. This should still work, but simply not add an entangling gate.

We should check this edge case for all other functions, as well.

How can we reproduce the issue?

from qiskit.circuit.library import efficient_su2

efficient_su2(1)

What should happen?

Build a circuit without CX entangling gate. This should be handled in the efficient_su2 function and adjust the internal call to n_local.

Any suggestions?

No response

@Cryoris Cryoris added the bug Something isn't working label Nov 22, 2024
@trigpolynom
Copy link
Contributor

I'd like to take this one on.

@Cryoris Cryoris modified the milestones: 2.0.0, 1.4.0 Dec 3, 2024
@Cryoris
Copy link
Contributor Author

Cryoris commented Dec 3, 2024

Great @trigpolynom! You can verify what should happen if you run the circuit-versions of these functions with a single qubit, e.g.

from qiskit.circuit.library import EfficientSU2, efficient_su2

circuit = EfficientSU2(1, flatten=True)
also_circuit = efficient_su2(1)  # should equal ``circuit``

We also need to add tests in this file and add a release note. You can check out the contributing guidelines on how to do that.

Let me know if you have any questions, I'm happy to discuss!

@trigpolynom
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants