ControlledAddition

Module: pennylane

class ControlledAddition(s, wires)[source]

Controlled addition operation.

\[\text{CX}(s) = \int dx \ket{x}\bra{x} \otimes D\left({\frac{1}{\sqrt{2\hbar}}}s x\right) = e^{-i s \: \hat{x} \otimes \hat{p}/\hbar}.\]

Details:

  • Number of wires: 2

  • Number of parameters: 1

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

  • Heisenberg representation:

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