Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【PaddlePaddle Hackathon】80 多量子比特独立系统的 Bloch 球展示 #26

Merged
merged 14 commits into from
Nov 5, 2021

Conversation

yangguohao
Copy link
Contributor

@yangguohao yangguohao commented Oct 19, 2021

task:#16
编写了一个新的函数 plot_n_qubit_state_in_bloch_sphere,实现了将多比特量子态表现在布洛赫球上。
单测文件:https://github.com/yangguohao/Quantum-1/tree/task80/documents

@yangguohao yangguohao changed the title 【PaddlePaddle Hackathon】80 多量子比特独立系统的 Bloch 球展示Task80 【PaddlePaddle Hackathon】80 多量子比特独立系统的 Bloch 球展示 Oct 19, 2021
@Quleaf
Copy link
Collaborator

Quleaf commented Oct 25, 2021

review 了一下你的代码,整体实现的挺好的,有一些小细节我认为可以修改一下:

  1. 能否用子图的形式,将一个量子态的多个独立系统的bloch球展示在同一个图中。
  2. 在绘制的Bloch球上的量子比特,有时是红色,有时是黑色,这个最好也可以统一一下。
  3. 在代码规范方面,可以再加强一些。可以参考Python代码规范,让代码更容易被阅读。

@yangguohao
Copy link
Contributor Author

yangguohao commented Oct 26, 2021 via email

@Quleaf
Copy link
Collaborator

Quleaf commented Oct 27, 2021

嗯,是的。这样会更直观一些。对于量子比特数较多的量子态,可以考虑以多个图片(每个图片包括一个子图)的形式展示,或者不予展示也可以。

@Quleaf
Copy link
Collaborator

Quleaf commented Nov 4, 2021

测试了一下,目前的代码仍然有bug。在plot_state_in_bloch_sphere()中没有添加n_qubit这个参数。
以及,我倾向于这里不修改plot_state_in_bloch_sphere()函数,plot_n_qubit_state_in_bloch_sphere并不是必须要调用plot_state_in_bloch_sphere()函数。

实现一个plot_state_in_bloch_sphere()函数,函数输入为一个由多个量子比特组成的量子态,将其进行展示。展示效果为一个图片,由n个子图组成,每个子图分别为每个独立系统对应的bloch球展示,这样就可以了。

@Quleaf
Copy link
Collaborator

Quleaf commented Nov 5, 2021

整体功能已经大致完成了。只是代码仍有两个小问题。一个是which_qubitsshow_qubits这里有问题,参数里是前者,代码里用了后者;还有一个是对于态矢量的模式没有适配,测试用例的最后一个似乎不能跑通。

@Quleaf
Copy link
Collaborator

Quleaf commented Nov 5, 2021

很棒,之前的问题都解决了。不过我发现,在保存文件的代码似乎没有修改。这里的话,可以考虑把显示的图片进行保存,也可以不用保存gif,可以考虑保存成静态图片,比如png格式。

@Quleaf Quleaf merged commit 7b61f77 into PaddlePaddle:master Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants