-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Global phase gate #8236
Comments
This idea was brought up at least once before, It would mean a significant change to how global phase is tracked which I'm not sure has a good justification over updating the global phase on the circuit. |
The use case I have in mind is for writing subroutines that yield gates without having the circuit around. Something like def quantum_fourier_transform(register: QuantumRegister) -> Iterator[tuple[Instruction, Sequence[Qubit]]] If you appended these operations into a circuit, it's true that any global phase gates wouldn't have an observable effect. But if you then wanted to create a controlled version of that circuit, the global phase gates would matter. |
I think since the issue Erick mentioned, there has been a significant change to how we handle global phase. The idea of a simple "global phase" gate that can be used in compound gate definitions sounds fairly convenient to me, for the reasons Kevin mentions above - when you control the gate onto a subset of the qubits, it's no longer a "global" phase, and it is convenient to be able to affect it in the same way as any other gate (OpenQASM 3 also takes this approach with the In theory we can just make a gate class whose definition is just |
It's currently possible to have a gate whose definition includes a global phase such that when it's controlled, that global (now relative) phase is taken into account. The fact that they appear in OpenQASM 3 sounds like a good reason to include them, although I'm still somewhat worried about the tracking of phase. In that description it sounds like the |
You don't really have to recalculate it - it all gets pulled in automatically by anything that walks the definitions, because it's all the exact same thing. At the end of the day, we're still encoding the global phase in the import math
from qiskit import QuantumCircuit
phase = QuantumCircuit(global_phase=math.pi).to_gate()
qc = QuantumCircuit(2, 2)
qc.append(phase, [], []) and it all works just fine. The global phase doesn't get pulled into |
If it's "tracked" how it is currently done through instruction definition that seems fine. Currently |
What should we add?
A gate that intruduces a global phase.
The text was updated successfully, but these errors were encountered: