Skip to content

Commit

Permalink
update to v2.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Quleaf committed Dec 7, 2022
1 parent 9a5ad8a commit 2ac9f37
Show file tree
Hide file tree
Showing 98 changed files with 11,561 additions and 1,263 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ English | [简体中文](README_CN.md)
</a>
<!-- PyPI -->
<a href="https://pypi.org/project/paddle-quantum/">
<img src="https://img.shields.io/badge/pypi-v2.2.1-orange.svg?style=flat-square&logo=pypi"/>
<img src="https://img.shields.io/badge/pypi-v2.2.2-orange.svg?style=flat-square&logo=pypi"/>
</a>
<!-- Python -->
<a href="https://www.python.org/">
Expand Down Expand Up @@ -152,6 +152,9 @@ We provide tutorials covering quantum simulation, machine learning, combinatoria
9. [Simulate the Spin Dynamics on a Heisenberg Chain](./tutorials/quantum_simulation/SimulateHeisenberg_EN.ipynb)
10. [Distributed Variational Quantum Eigensolver Based on Schmidt Decomposition](./tutorials/quantum_simulation/DistributedVQE_EN.ipynb)
11. [Quantum Signal Processing and Quantum Singular Value Transformation](./tutorials/quantum_simulation/QSP_and_QSVT_EN.ipynb)
12. [Hamiltonian Simulation with qDRIFT](./tutorials/quantum_simulation/QDRIFT_EN.ipynb)
13. [Quantum Phase Processing](./tutorials/quantum_simulation/QPP_EN.ipynb)
14. [Variational Quantum Metrology](./tutorials/quantum_simulation/VariationalQM_EN.ipynb)

- [Machine Learning](./tutorials/machine_learning)
1. [Encoding Classical Data into Quantum States](./tutorials/machine_learning/DataEncoding_EN.ipynb)
Expand All @@ -163,6 +166,7 @@ We provide tutorials covering quantum simulation, machine learning, combinatoria
7. [Variational Quantum Singular Value Decomposition (VQSVD)](./tutorials/machine_learning/VQSVD_EN.ipynb)
8. [Data Encoding Analysis](./tutorials/machine_learning/EncodingAnalysis_EN.ipynb)
9. [Quantum Neural Network Approximating Functions](./tutorials/machine_learning/QApproximating_EN.ipynb)
10. [Variational quantum amplitude estimation](./tutorials/machine_learning/VQAE_EN.ipynb)

- [Combinatorial Optimization](./tutorials/combinatorial_optimization)
1. [Quantum Approximation Optimization Algorithm (QAOA)](./tutorials/combinatorial_optimization/QAOA_EN.ipynb)
Expand Down
8 changes: 6 additions & 2 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</a>
<!-- PyPI -->
<a href="https://pypi.org/project/paddle-quantum/">
<img src="https://img.shields.io/badge/pypi-v2.2.1-orange.svg?style=flat-square&logo=pypi"/>
<img src="https://img.shields.io/badge/pypi-v2.2.2-orange.svg?style=flat-square&logo=pypi"/>
</a>
<!-- Python -->
<a href="https://www.python.org/">
Expand Down Expand Up @@ -75,7 +75,7 @@

### 安装 Paddle Quantum

我们推荐通过 `pip` 完成安装,
我们推荐通过 `pip` 完成安装

```bash
pip install paddle-quantum
Expand Down Expand Up @@ -161,6 +161,9 @@ Paddle Quantum(量桨)建立起了人工智能与量子计算的桥梁,为
9. [模拟一维海森堡链的自旋动力学](./tutorials/quantum_simulation/SimulateHeisenberg_CN.ipynb)
10. [基于施密特分解的分布式变分量子本征求解器](./tutorials/quantum_simulation/DistributedVQE_CN.ipynb)
11. [量子信号处理与量子奇异值变换](./tutorials/quantum_simulation/QSP_and_QSVT_CN.ipynb)
12. [利用 qDRIFT 模拟时间演化](./tutorials/quantum_simulation/QDRIFT_CN.ipynb)
13. [量子相位处理](./tutorials/quantum_simulation/QPP_CN.ipynb)
14. [变分量子精密测量](./tutorials/quantum_simulation/VariationalQM_CN.ipynb)


- [机器学习](./tutorials/machine_learning)
Expand All @@ -173,6 +176,7 @@ Paddle Quantum(量桨)建立起了人工智能与量子计算的桥梁,为
7. [变分量子奇异值分解(VQSVD)](./tutorials/machine_learning/VQSVD_CN.ipynb)
8. [数据编码分析](./tutorials/machine_learning/EncodingAnalysis_CN.ipynb)
9. [量子神经网络模拟函数](./tutorials/machine_learning/QApproximating_CN.ipynb)
10. [变分量子振幅估算](./tutorials/machine_learning/VQAE_CN.ipynb)

- [组合优化](./tutorials/combinatorial_optimization)
1. [量子近似优化算法(QAOA)](./tutorials/combinatorial_optimization/QAOA_CN.ipynb)
Expand Down
4 changes: 3 additions & 1 deletion docs/source/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
paddle_quantum.hamiltonian
paddle_quantum.linalg
paddle_quantum.qinfo
paddle_quantum.qml
paddle_quantum.shadow
paddle_quantum.trotter
paddle_quantum.visual
paddle_quantum.qsvt
paddle_quantum.qsvt
paddle_quantum.qpp
1 change: 1 addition & 0 deletions docs/source/paddle_quantum.gate.functional.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ paddle\_quantum.gate.functional
paddle_quantum.gate.functional.base
paddle_quantum.gate.functional.multi_qubit_gate
paddle_quantum.gate.functional.single_qubit_gate
paddle_quantum.gate.functional.visual
6 changes: 6 additions & 0 deletions docs/source/paddle_quantum.gate.functional.visual.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
paddle\_quantum.gate.functional.base
===========================================

.. automodule:: paddle_quantum.gate.functional.visual
:members:
:show-inheritance:
14 changes: 14 additions & 0 deletions docs/source/paddle_quantum.qml.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
paddle\_quantum.qml
============================

.. automodule:: paddle_quantum.qml
:members:
:undoc-members:
:show-inheritance:

.. rubric:: Submodules

.. toctree::
:maxdepth: 4

paddle_quantum.qml.vsql
7 changes: 7 additions & 0 deletions docs/source/paddle_quantum.qml.vsql.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
paddle\_quantum.qml.vsql
==================================

.. automodule:: paddle_quantum.qml.vsql
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/paddle_quantum.qpp.angles.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
paddle\_quantum.qpp.angles
============================

.. automodule:: paddle_quantum.qpp.angles
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/paddle_quantum.qpp.laurent.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
paddle\_quantum.qpp.laurent
============================

.. automodule:: paddle_quantum.qpp.laurent
:members:
:undoc-members:
:show-inheritance:
16 changes: 16 additions & 0 deletions docs/source/paddle_quantum.qpp.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
paddle\_quantum.qpp
============================

.. automodule:: paddle_quantum.qpp
:members:
:undoc-members:
:show-inheritance:

.. rubric:: Submodules

.. toctree::
:maxdepth: 4

paddle_quantum.qpp.angles
paddle_quantum.qpp.laurent
paddle_quantum.qpp.utils
7 changes: 7 additions & 0 deletions docs/source/paddle_quantum.qpp.utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
paddle\_quantum.qpp.qpp.utils
=============================

.. automodule:: paddle_quantum.qpp.utils
:members:
:undoc-members:
:show-inheritance:
2 changes: 2 additions & 0 deletions docs_zh_CN/source/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
paddle_quantum.hamiltonian
paddle_quantum.linalg
paddle_quantum.qinfo
paddle_quantum.qml
paddle_quantum.shadow
paddle_quantum.trotter
paddle_quantum.visual
paddle_quantum.qsvt
paddle_quantum.qpp
108 changes: 98 additions & 10 deletions docs_zh_CN/source/paddle_quantum.ansatz.circuit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ paddle\_quantum.ansatz.circuit
展平后的电路参数梯度。
.. py:property:: depth()
电路深度
.. py:method:: update_param(theta, idx=None)
替换单层或所有的电路参数。
Expand Down Expand Up @@ -98,6 +94,27 @@ paddle\_quantum.ansatz.circuit
:param depth: 层数,默认为 ``1``
:type depth: int, optional
.. py:method:: sdg(qubits_idx='full', num_qubits=None, depth=1)
添加单量子比特 S dagger (逆S)门。
其矩阵形式为:
.. math::
S ^\dagger =
\begin{bmatrix}
1 & 0\ \
0 & -i
\end{bmatrix}
:param qubits_idx: 作用在的量子比特的编号,默认为 ``'full'``
:type qubits_idx: Union[Iterable[int], int, str], optional
:param num_qubits: 总共的量子比特数量,默认为 ``None``
:type num_qubits: int, optional
:param depth: 层数,默认为 ``1``
:type depth: int, optional
.. py:method:: t(qubits_idx='full', num_qubits=None, depth=1)
添加单量子比特 T 门。
Expand All @@ -118,7 +135,28 @@ paddle\_quantum.ansatz.circuit
:type num_qubits: int, optional
:param depth: 层数,默认为 ``1``
:type depth: int, optional
.. py:method:: tdg(qubits_idx='full', num_qubits=None, depth=1)
添加单量子比特 T dagger (逆T)门。
其矩阵形式为:
.. math::
T ^\dagger =
\begin{bmatrix}
1 & 0\ \
0 & e^\frac{i\pi}{4}
\end{bmatrix}
:param qubits_idx: 作用在的量子比特的编号,默认为 ``'full'``
:type qubits_idx: Union[Iterable[int], int, str], optional
:param num_qubits: 总共的量子比特数量,默认为 ``None``
:type num_qubits: int, optional
:param depth: 层数,默认为 ``1``
:type depth: int, optional
.. py:method:: x(qubits_idx='full', num_qubits=None, depth=1)
添加单量子比特 X 门。
Expand Down Expand Up @@ -767,7 +805,7 @@ paddle\_quantum.ansatz.circuit
:param param_sharing: 同一层中的量子门是否共享参数,默认为 ``False``
:type param_sharing: bool, optional
.. py:method:: oracle(oracle, qubits_idx, num_qubits=None, depth=1)
.. py:method:: oracle(oracle, qubits_idx, num_qubits=None, depth=1, gate_name='0', latex_name=None, plot_width=None)
添加一个 oracle 门。
Expand All @@ -781,8 +819,12 @@ paddle\_quantum.ansatz.circuit
:type depth: int, optional
:param gate_name: oracle 的名字,默认为 ``O``
:type gate_name: str, optional
:param latex_name: oracle 的Latex名字,默认为 None, 此时用 gate_name。
:type latex_name: str, optional
:param plot_width: 电路图中此门的宽度,默认为None,此时与门名称成比例。
:type gate_name: float, optional
.. py:method:: control_oracle(oracle, qubits_idx, num_qubits=None, depth=1)
.. py:method:: control_oracle(oracle, qubits_idx, num_qubits=None, depth=1, gate_name='0', latex_name=None, plot_width=None)
添加一个受控 oracle 门。
Expand All @@ -796,6 +838,10 @@ paddle\_quantum.ansatz.circuit
:type depth: int, optional
:param gate_name: oracle 的名字,默认为 ``cO``
:type gate_name: str, optional
:param latex_name: oracle 的Latex名字,默认为 None, 此时用 gate_name。
:type latex_name: str, optional
:param plot_width: 电路图中此门的宽度,默认为None,此时与门名称成比例。
:type gate_name: float, optional
.. py:method:: collapse(qubits_idx='full', num_qubits=None, desired_result=None, if_print=False, measure_basis='z')
Expand Down Expand Up @@ -936,13 +982,13 @@ paddle\_quantum.ansatz.circuit
:param num_qubits: 总的量子比特个数,默认为 ``None``
:type num_qubits: int, optional
.. py:method:: generalized_amplitude_damping(gamma, qubits_idx='full', num_qubits=None)
.. py:method:: generalized_amplitude_damping(gamma, prob, qubits_idx='full', num_qubits=None)
添加广义振幅阻尼信道。
:param gamma: 减振概率。
:param gamma: 减振概率,其值应该在 :math:`[0, 1]` 区间内
:type prob: Union[paddle.Tensor, float]
:param prob: 激发概率。
:param prob: 激发概率,其值应该在 :math:`[0, 1]` 区间内
:type prob: Union[paddle.Tensor, float]
:param qubits_idx: 作用在的量子比特的编号, 默认为 ``'full'``
:type qubits_idx: Union[Iterable[int], int, str], optional
Expand Down Expand Up @@ -1006,6 +1052,17 @@ paddle\_quantum.ansatz.circuit
:param num_qubits: 总的量子比特个数,默认为 ``None``
:type num_qubits: int, optional
.. py:method:: mixed_unitary_channel(num_unitary, qubits_idx='full', num_qubits=None)
添加混合酉矩阵信道
:param num_unitary: 用于构成信道的酉矩阵的数量。
:type num_unitary: Union[paddle.Tensor, Iterable[int]]
:param qubits_idx: 作用在的量子比特的编号, 默认为 ``'full'``
:type qubits_idx: Union[Iterable[int], int, str], optional
:param num_qubits: 总的量子比特个数,默认为 ``None``
:type num_qubits: int, optional
.. py:method:: kraus_repr(kraus_oper, qubits_idx, num_qubits=None)
添加一个 Kraus 表示的自定义量子信道。
Expand Down Expand Up @@ -1040,3 +1097,34 @@ paddle\_quantum.ansatz.circuit
:return: 每个比特上的量子门的插入历史
:rtype: List[List[Tuple[Dict[str, Union[str, List[int], paddle.Tensor]], int]]]
.. py:method:: plot(save_path, dpi=100, show=True, output=False, scale=1.0, tex=False)
画出量子电路图
:param save_path: 图像保存的路径,默认为 ``None``
:type save_path: str, optional
:param dpi: 每英寸像素数,这里指分辨率, 默认为 `100`
:type dpi: int, optional
:param show: 是否执行 ``plt.show()``, 默认为 ``True``
:type show: bool, optional
:param output: 是否返回 ``matplotlib.figure.Figure`` 实例,默认为 ``False``
:type output: bool, optional
:param scale: ``figure````scale`` 系数,默认为 `1.0`
:type scale: float, optional
:param tex: 一个布尔变量,用于控制是否使用 TeX 字体,默认为 ``False``
:type tex: bool, optional
:return: 根据 ``output`` 参数返回 ``matplotlib.figure.Figure`` 实例或 ``None``
:rtype: Union[None, matplotlib.figure.Figure]
.. note::
使用 ``plt.show()`` 或许会导致一些问题,但是在保存图片时不会发生。如果电路太深可能会有一些图形无法显示。如果设置 ``tex = True`` 则需要在你的系统上安装 TeX 及其相关的依赖包。更多细节参考 https://matplotlib.org/stable/gallery/text_labels_and_annotations/tex_demo.html
.. py:method:: extend(cir)
量子电路扩展
:param cir: 量子电路。
:type cir: Circuit
30 changes: 15 additions & 15 deletions docs_zh_CN/source/paddle_quantum.ansatz.vans.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ paddle\_quantum.ansatz.vans

可变结构电路的功能实现。

.. py:function:: cir_decompose(cir)
将电路中的 Layer 分解成量子门, 如果需要的话可以把所有参数门的输入转为可训练参数

:param cir: 待分解电路
:type cir: Circuit
:param trainable: 是否将分解后的参数量子门输入转为参数baidu
:type trainable: bool, optional
:return: 分解后的电路
:rtype: Circuit

.. note::

该量子电路稳定支持原生门,不支持 oracle 等其他自定义量子门。

.. py:class:: Inserter
基类: :py:class:`object`
Expand Down Expand Up @@ -39,21 +54,6 @@ paddle\_quantum.ansatz.vans
:return: 简化后的电路。
:rtype: Circuit

.. py:function:: cir_decompose(cir)
将电路中的 Layer 分解成量子门, 如果需要的话可以把所有参数门的输入转为可训练参数

:param cir: 待分解电路
:type cir: Circuit
:param trainable: 是否将分解后的参数量子门输入转为参数
:type trainable: bool, optional
:return: 分解后的电路
:rtype: Circuit

.. note::

该量子电路稳定支持原生门,不支持 oracle 等其他自定义量子门。

.. py:class:: VAns(n, loss_func, *loss_func_args, epsilon=0.1, insert_rate=2, iter=100, iter_out=10, LR =0.1, threshold=0.002, accept_wall=100, zero_init_state=True)
基类: :py:class:`object`
Expand Down
Loading

0 comments on commit 2ac9f37

Please sign in to comment.