Skip to content

dq.rz

rz(theta: ArrayLike) -> QArray

Returns the \(R_z(\theta)\) rotation gate.

It is defined by $$ R_z(\theta) = \begin{pmatrix} e^{-i\theta/2} & 0 \\ 0 & e^{i\theta/2} \end{pmatrix} $$

Parameters

  • theta (array-like of shape (...)) –

    Rotation angle \(\theta\) in radians.

Returns

(qarray of shape (2, 2)) \(R_z(\theta)\) gate.

Examples

>>> dq.rz(jnp.pi)
QArray: shape=(2, 2), dims=(2,), dtype=complex64, layout=dense
[[-0.-1.j  0.+0.j]
 [ 0.+0.j -0.+1.j]]
>>> dq.rz([0, jnp.pi/4, jnp.pi/3, jnp.pi/2, jnp.pi]).shape
(5, 2, 2)