Skip to content

dq.rx

rx(theta: ArrayLike) -> Array

Returns the Rx(θ)R_x(\theta) rotation gate.

It is defined by Rx(θ)=(cos(θ/2)isin(θ/2)isin(θ/2)cos(θ/2)) R_x(\theta) = \begin{pmatrix} \cos(\theta/2) & -i\sin(\theta/2) \\ -i\sin(\theta/2) & \cos(\theta/2) \end{pmatrix}

Parameters

  • theta (array_like of shape (...))

    Rotation angle θ\theta in radians.

Returns

(array of shape (..., 2, 2)) Rx(θ)R_x(\theta) gate.

Examples

>>> dq.rx(jnp.pi)
Array([[-0.+0.j,  0.-1.j],
       [ 0.-1.j, -0.+0.j]], dtype=complex64)
>>> dq.rx([0, jnp.pi/4, jnp.pi/3, jnp.pi/2, jnp.pi]).shape
(5, 2, 2)