# qml.templates.embeddings.DisplacementEmbedding¶

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.

Parameters
• features (array) – Array of features of size (N,)

• wires (Iterable or Wires) – Wires that the template acts on. Accepts an iterable of numbers or strings, or a Wires object.

• 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'

Raises

ValueError – if inputs do not have the correct format