Skip to content

Commit

Permalink
update the api-doc and some details
Browse files Browse the repository at this point in the history
  • Loading branch information
Quleaf committed Jan 18, 2023
1 parent 195b41b commit 2884515
Show file tree
Hide file tree
Showing 33 changed files with 747 additions and 3,263 deletions.
8 changes: 4 additions & 4 deletions applications/portfolio_optimization/introduction_cn.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"## 量子编码及求解\n",
"我们通过变换 $x_i \\mapsto \\frac{I-Z_i}{2}$ 将损失函数转为一个哈密顿量,从而完成投资组合优化问题的编码。这里$Z_i=I \\otimes I \\otimes \\ldots \\otimes Z \\otimes \\ldots \\otimes I$,即 $Z_{i}$ 是作用在第$i$ 个比特上的Pauli算符。我们用这个映射将 $C_x$ 转化成量子比特数为 $n$ 的系统的哈密顿矩阵 $H_C$,其基态即为投资组合优化问题的最优解。为了寻找这一哈密顿量的基态,我们使用变分量子算法的思想,通过一个参数化量子线路,生成一个试验态 $|\\theta^* \\rangle$。我们通过量子线路获得哈密顿量在该试验态上的期望值,然后,通过经典的梯度下降算法调节参数化量子线路的参数,使期望值向基态能量靠拢。重复若干次之后,我们找到最优解:\n",
"$$\n",
"|\\theta^* \\rangle = \\argmin_\\theta L(\\vec{\\theta})=\\argmin_\\theta \\left\\langle\\vec{\\theta}\\left|H_C\\right| \\vec{\\theta}\\right\\rangle.\n",
"|\\theta^* \\rangle = \\arg\\min_\\theta L(\\vec{\\theta})=\\arg\\min_\\theta \\left\\langle\\vec{\\theta}\\left|H_C\\right| \\vec{\\theta}\\right\\rangle.\n",
"$$\n",
"最后,我们读出测量结果的概率分布:$p(z)=\\left|\\left\\langle z \\mid \\vec{\\theta}^*\\right\\rangle\\right|^2$,即由量子编码还原出原先比特串的信息。某个比特串出现的概率越大,意味着其是投资组合优化问题最优解的可能性越大。"
]
Expand Down Expand Up @@ -225,7 +225,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.8.13 ('pq')",
"display_name": "pq-dev",
"language": "python",
"name": "python3"
},
Expand All @@ -239,12 +239,12 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
"version": "3.8.15 (default, Nov 10 2022, 13:17:42) \n[Clang 14.0.6 ]"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "d3caffbb123012c2d0622db402df9f37d80adc57c1cef1fdb856f61446d88d0a"
"hash": "5fea01cac43c34394d065c23bb8c1e536fdb97a765a18633fd0c4eb359001810"
}
}
},
Expand Down
8 changes: 4 additions & 4 deletions applications/portfolio_optimization/introduction_en.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"$\n",
"where $Z_i=I \\otimes I \\otimes \\ldots \\otimes Z \\otimes \\ldots \\otimes I$, i.e., $Z_{i}$ is the Pauli operator acting solely on the $i$-th qubit. Thus using the above mapping, we can transform the cost function $C_x$ into a Hamiltonian $H_C$ for the system of $n$ qubits, the ground state of which represents the solution of the portfolio optimization problem. In order to find the ground state, we use the idea of variational quantum algorithms. We implement a parametric quantum circuit, and use it to generate a trial state $|\\theta^* \\rangle$. We use the quantum circuit to measure the expectation value of the Hamiltonian on this state. Then, classical gradient descent algorithm is implemented to adjust the parameters of the parametric circuit, where the expectation value evolves towards the ground state energy. After some iterations, we arrive at the optimal value\n",
"$$\n",
"|\\theta^* \\rangle = \\argmin_\\theta L(\\vec{\\theta})=\\argmin_\\theta \\left\\langle\\vec{\\theta}\\left|H_C\\right| \\vec{\\theta}\\right\\rangle.\n",
"|\\theta^* \\rangle = \\arg\\min_\\theta L(\\vec{\\theta})=\\arg\\min_\\theta \\left\\langle\\vec{\\theta}\\left|H_C\\right| \\vec{\\theta}\\right\\rangle.\n",
"$$\n",
"\n",
"Finally, we read out the probability distribution from the measurement result (i.e. decoding the quantum problem to give information about the original bit string)\n",
Expand Down Expand Up @@ -238,7 +238,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.8.13 ('pq')",
"display_name": "pq-dev",
"language": "python",
"name": "python3"
},
Expand All @@ -252,12 +252,12 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
"version": "3.8.15 (default, Nov 10 2022, 13:17:42) \n[Clang 14.0.6 ]"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "d3caffbb123012c2d0622db402df9f37d80adc57c1cef1fdb856f61446d88d0a"
"hash": "5fea01cac43c34394d065c23bb8c1e536fdb97a765a18633fd0c4eb359001810"
}
}
},
Expand Down
Binary file modified applications/protein_folding/APRLRFY_3d_structure.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2884515

Please sign in to comment.