Nothing Special   »   [go: up one dir, main page]

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

the use of the function about cu gate seems that there is something confusing. #13432

Open
5 tasks
Maochengang opened this issue Nov 13, 2024 · 2 comments
Open
5 tasks
Assignees
Labels
documentation Something is not clear or an error documentation

Comments

@Maochengang
Copy link

URL to the relevant documentation

https://docs.quantum.ibm.com/api/qiskit/qiskit.circuit.library.CU1Gate

Select all that apply

  • typo
  • code bug
  • out-of-date content
  • broken link
  • other

Describe the fix.

from qiskit import QuantumCircuit
from math import pi

#create the circuit
circuit = QuantumCircuit(4, 4)
circuit.cu(-pi/2, -pi/2, pi/2,0, 1, 3)
circuit.cu(-pi/2, 0 , 0, 3,2, 1)
circuit.draw(output='mpl', plot_barriers=False, fold=-1)

Image

It is strange to show the four phase in a cu gate while useful parameter is only the three phase and the control qubit and target qubit

#easier form to understand which keeps receiving Error - cu() missing 1 required positional argument: 'target_qubit'
circuit.cu(-pi/2, -pi/2, pi/2, 1, 3)

@beckykd
Copy link
Collaborator
beckykd commented Nov 13, 2024

Looks like this belongs in the API repo: https://github.com/Qiskit/qiskit

@Eric-Arellano Eric-Arellano transferred this issue from Qiskit/documentation Nov 13, 2024
@Eric-Arellano Eric-Arellano added the documentation Something is not clear or an error documentation label Nov 13, 2024
@Cryoris
Copy link
Contributor
Cryoris commented Nov 13, 2024

That's a design choice we made: U is a general 1-qubit gate and CU is a general 2-qubit gate, which needs the additional angle. I agree this can be confusing coming from the circuit method usage. We could consider adding a dispatch that allows to handle the case where only 3 parameters are given to the cu method, though this might open the door to accidentally using the wrong signature...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Something is not clear or an error documentation
Projects
Status: No status
Development

No branches or pull requests

6 participants