-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Description
The simulator works great, however, i would like to extend with rotation gates and U1, U2 and U3 gates. I have defined for U3
@staticmethod
def U3(theta,phi,lambd):
theta_mat=np.matrix([[np.cos(theta/2),np.sin(theta/2)],[-np.sin(theta/2),np.cos(theta/2)]])
phi_mat=np.matrix([[1,0],[0, e**(i phi)]])
lambd_mat=np.matrix([[1,0],[0,e*(i lambd)]])
return phi_mattheta_mat*lambd_mat
So now i can do the following
gateMatrix = gates.U3(pi/2,pi/3,0)
print(gateMatrix)
Result
[[ 0.70710678+0.j 0.70710678+0.j ]
[-0.35355339-0.61237244j 0.35355339+0.61237244j]]
How todo insert this in to the applygate ?
Metadata
Metadata
Assignees
Labels
No labels