Skip to content

U Gate

The single-qubit gate applies phase and rotation with three Euler angles.

Matrix representation:

\[ U(\gamma,\phi,\theta,\lambda) = e^{i\gamma}\begin{pmatrix} \cos(\frac{\theta}{2}) & -e^{i\lambda}\sin(\frac{\theta}{2}) \\ e^{i\phi}\sin(\frac{\theta}{2}) & e^{i(\phi+\lambda)}\cos(\frac{\theta}{2}) \\ \end{pmatrix} \]

Syntax

Function: UGate

Parameters:

  • theta: Union[float, Parameter]
  • phi: Union[float, Parameter]
  • lam: Union[float, Parameter]
  • gam: Union[float, Parameter]

Example

{
  "functions": [
    {
      "name": "main",
      "body": [
        {
          "function": "UGate",
          "function_params": {
            "theta": "theta",
            "phi": "phi",
            "lam": "lam",
            "gam": "gam"
          }
        }
      ]
    }
  ]
}
from classiq.builtin_functions import UGate
from classiq import Model

model = Model()
u_params = UGate(theta="theta", phi="phi", lam="lam", gam="gam")
model.UGate(u_params)

 U_example