paddle_quantum.gate.encoding.rst 2.5 KB
Newer Older
Q
Quleaf 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
paddle\_quantum.gate.encoding
====================================

量子编码的功能实现。

.. py:class:: BasisEncoding(qubits_idx='full', num_qubits=None)

   基类::py:class:`paddle_quantum.gate.base.Gate`

   将输入的经典数据编码成量子态的基态编码门。

   在基态编码中,输入的经典数据只能包括 0 和 1。如输入数据为 1101,则编码后的量子态为 :math:`|1101\rangle`。
   这里假设量子态在编码前为全 0 的态,即 :math:`|00\ldots 0\rangle`。

   :param qubits_idx: 作用在的量子比特的编号,默认为 ``'full'``。
   :type qubits_idx: Union[Iterable[int], int, str], optional
   :param num_qubits: 总的量子比特个数,默认为 ``None``。
   :type num_qubits: int, optional

.. py:class:: AmplitudeEncoding(qubits_idx='full', num_qubits=None)

   基类::py:class:`paddle_quantum.gate.base.Gate`

   将输入的经典数据编码成量子态的振幅编码门。

   :param qubits_idx: 作用在的量子比特的编号,默认为 ``'full'``。
   :type qubits_idx: Union[Iterable[int], int, str], optional
   :param num_qubits: 总的量子比特个数,默认为 ``None``。
   :type num_qubits: int, optional

.. py:class:: AngleEncoding(feature, qubits_idx='full', num_qubits=None, encoding_gate=None)

   基类::py:class:`paddle_quantum.gate.base.Gate`

   将输入的经典数据编码成量子态的角度编码门。

   :param feature: 待编码的向量。
   :type feature: paddle.Tensor
   :param qubits_idx: 作用在的量子比特的编号,默认为 ``'full'``。
   :type qubits_idx: Union[Iterable[int], int, str], optional
   :param num_qubits: 总的量子比特个数,默认为 ``None``。
   :type num_qubits: int, optional
   :param encoding_gate: 编码用的量子门,应是 ``"rx"``、``"ry"``,和 ``"rz"`` 中的一种。默认为 ``None``。
   :type encoding_gate: str, optional

.. py:class:: IQPEncoding(feature, qubits_idx=None, num_qubits=None, num_repeat=1)

   基类::py:class:`paddle_quantum.gate.base.Gate`

   将输入的经典数据编码成量子态的 IQP 编码门。

   :param feature: 待编码的向量。
   :type feature: paddle.Tensor
   :param qubits_idx: 作用在的量子比特的编号,默认为 ``None``。
   :type qubits_idx: Iterable[Iterable[int]], optional
   :param num_qubits: 总的量子比特个数,默认为 ``None``。
   :type num_qubits: int, optional
   :param num_repeat: 编码层的层数,默认为 ``1``。
   :type num_repeat: int, optional