paddle_quantum.gate.encoding

The source file of the classes for quantum encoding.

class paddle_quantum.gate.encoding.BasisEncoding(qubits_idx='full', num_qubits=None)

Bases: Operator

Basis encoding gate for encoding input classical data into quantum states.

In basis encoding, the input classical data can only consist of 0’s and 1’s. If the input data are 1101, then the quantum state after encoding is \(|1101\rangle\). Note that the quantum state before encoding is assumed to be \(|00\ldots 0\rangle\).

Parameters:
  • qubits_idx (Iterable[int] | int | str) – Indices of the qubits on which the gates are applied. Defaults to 'full'.

  • num_qubits (int) – Total number of qubits. Defaults to None.

class paddle_quantum.gate.encoding.AmplitudeEncoding(qubits_idx='full', num_qubits=None)

Bases: Operator

Amplitude encoding gate for encoding input classical data into quantum states.

Parameters:
  • qubits_idx (Iterable[int] | int | str | None) – Indices of the qubits on which the gates are applied. Defaults to 'full'.

  • num_qubits (int | None) – Total number of qubits. Defaults to None.

class paddle_quantum.gate.encoding.AngleEncoding(feature, qubits_idx='full', num_qubits=None, encoding_gate=None)

Bases: Operator

Angle encoding gate for encoding input classical data into quantum states.

Parameters:
  • feature (Tensor) – Vector to be encoded.

  • qubits_idx (Iterable[int] | int | str | None) – Indices of the qubits on which the gates are applied. Defaults to 'full'.

  • num_qubits (int | None) – Total number of qubits. Defaults to None.

  • encoding_gate (str | None) – The type of quantum gates used for encoding, which should be one of "rx", "ry", and "rz". Defaults to None.

class paddle_quantum.gate.encoding.IQPEncoding(feature, qubits_idx=None, num_qubits=None, num_repeat=1)

Bases: Operator

IQP style encoding gate for encoding input classical data into quantum states.

Parameters:
  • feature (Tensor) – Vector to be encoded.

  • qubits_idx (Iterable[Iterable[int]] | None) – Indices of the qubits on which the gates are applied. Defaults to None.

  • num_qubits (int | None) – Total number of qubits. Defaults to None.

  • num_repeat (int | None) – Number of encoding layers. Defaults to 1.