Skip to content

Extend QuSimPy with rotgates #4

Description

@BramDo

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_mat
theta_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 ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions