# ControlledPhase¶

Module: pennylane

class ControlledPhase(s, wires)[source]

Controlled phase operation.

$\text{CZ}(s) = \iint dx dy \: e^{i sxy/\hbar} \ket{x,y}\bra{x,y} = e^{i s \: \hat{x} \otimes \hat{x}/\hbar}.$

Details:

• Number of wires: 2

• Number of parameters: 1

• Gradient recipe: $$\frac{d}{ds}f(\text{CZ}(s)) = \frac{1}{2 a} \left[f(\text{CZ}(s+a)) - f(\text{CZ}(s-a))\right]$$, where $$a$$ is an arbitrary real number ($$0.1$$ by default) and $$f$$ is an expectation value depending on $$\text{CZ}(s)$$.

• Heisenberg representation:

$\begin{split}M = \begin{bmatrix} 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & s & 0 \\ 0 & 0 & 0 & 1 & 0 \\ 0 & s & 0 & 0 & 1 \end{bmatrix}\end{split}$
Parameters: s (float) – phase shift multiplier wires (Sequence[int] or int) – the wire the operation acts on