Module: pennylane.templates.embeddings

DisplacementEmbedding(features, wires, method='amplitude', c=0.1)[source]
Encodes \(N\) features into the displacement amplitudes \(r\) or phases \(\phi\) of \(M\) modes,
where \(N\leq M\).

The mathematical definition of the displacement gate is given by the operator

\[D(\alpha) = \exp(r (e^{i\phi}\ad -e^{-i\phi}\a)),\]

where \(\a\) and \(\ad\) are the bosonic creation and annihilation operators.

features has to be an array of at most len(wires) floats. If there are fewer entries in features than wires, the circuit does not apply the remaining displacement gates.

  • features (array) – Array of features of size (N,)
  • wires (Sequence[int]) – sequence of mode indices that the template acts on
Keyword Arguments:
  • method (str) – 'phase' encodes the input into the phase of single-mode displacement, while 'amplitude' uses the amplitude
  • c (float) – value of the phase of all displacement gates if execution='amplitude', or the amplitude of all displacement gates if execution='phase'