You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hope all are well. I would like to know how I can add a global phase gate. I initially wanted to do this by adding its unitary matrix form, but since that is not currently supported, I'd like to know how I can add it with the current 0.7.x releases.
The text was updated successfully, but these errors were encountered:
Global phase rotation can be accommodated by the custom unitary matrix gate feature (upcoming 0.8 release) or by using a gate decomposition.
The latter leveraged the fact that r1 and rz gates (CUDA-Q supported gates) are equivalent up to a global phase.
Here is a simple example demonstrating that:
import cudaq
import math
@cudaq.kernel
def global_phase(theta: float):
# Global phase e(i*theta) == r1(2*theta) * rz(-2*theta)
qubit = cudaq.qubit()
# make it |0> + |1>
h(qubit)
rz(-2*theta, qubit)
r1(2*theta, qubit)
# Global phase of pi == multiply the state by -1
state = cudaq.get_state(global_phase, math.pi)
print(state) # expect (-(|0> + |1>))
Greetings there,
Hope all are well. I would like to know how I can add a global phase gate. I initially wanted to do this by adding its unitary matrix form, but since that is not currently supported, I'd like to know how I can add it with the current 0.7.x releases.
The text was updated successfully, but these errors were encountered: