AngleEmbedding

Module: pennylane.templates.embeddings

AngleEmbedding(features, wires, rotation='X')[source]

Encodes \(N\) features into the rotation angles of \(n\) qubits, where \(N \leq n\).

The rotations can be chosen as either RX, RY or RZ gates, as defined by the rotation parameter:

  • rotation='X' uses the features as angles of RX rotations
  • rotation='Y' uses the features as angles of RY rotations
  • rotation='Z' uses the features as angles of RZ rotations

The length of features has to be smaller or equal to the number of qubits. If there are fewer entries in features than rotations, the circuit does not apply the remaining rotation gates.

This embedding method can also be used to encode a binary sequence into a basis state. For example, to prepare basis state \(|0,1,1,0\rangle\), choose rotation='X' and use the feature vector \([0, \pi/2, \pi/2, 0]\). Alternatively, one can use the BasisEmbedding() template.

Parameters:
  • features (array) – Input array of shape (N,), where N is the number of input features to embed, with \(N\leq n\)
  • wires (Sequence[int]) – sequence of qubit indices that the template acts on
Keyword Arguments:
 

rotation (str) – Type of rotations used