Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Quantum
提交
96095814
Q
Quantum
项目概览
PaddlePaddle
/
Quantum
1 年多 前同步成功
通知
20
Star
492
Fork
166
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
5
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
Quantum
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
5
Issue
5
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
96095814
编写于
11月 04, 2021
作者:
Y
yangguohao
提交者:
GitHub
11月 04, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update 单测文件.py
上级
932f3340
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
5 addition
and
9 deletion
+5
-9
documents/单测文件.py
documents/单测文件.py
+5
-9
未找到文件。
documents/单测文件.py
浏览文件 @
96095814
from
paddle_quantum.state
import
density_op_random
from
paddle_quantum.circuit
import
UAnsatz
from
paddle_quantum.utils
import
partial_trace
,
plot_state_in_bloch_sphere
,
partial_trace_discontiguous
,
NKron
,
plot_n_qubit_state_in_bloch_sphere
from
mpl_toolkits.mplot3d
import
Axes3D
import
numpy
as
np
import
paddle
cir1
=
UAnsatz
(
1
)
...
...
@@ -12,14 +12,10 @@ omega = paddle.to_tensor(omega, dtype='float64')
cir1
.
rx
(
phi
,
0
)
cir1
.
rz
(
omega
,
0
)
cir2
.
ry
(
theta
,
0
)
mat1
,
mat2
=
np
.
array
(
cir1
.
run_density_matrix
()),
np
.
array
(
cir2
.
run_density_matrix
())
rho
=
NKron
(
mat1
,
mat2
)
state
=
[
cir1
.
run_state_vector
(),
cir2
.
run_state_vector
(),
rho
]
state
=
rho
plot_n_qubit_state_in_bloch_sphere
(
state
,
show_arrow
=
True
)
n
=
2
rho
=
density_op_random
(
n
)
#print(rho)
plot_n_qubit_state_in_bloch_sphere
(
rho
,
show_arrow
=
True
)
plot_n_qubit_state_in_bloch_sphere
(
rho
,
show_qubits
=
[[
0
]],
show_arrow
=
True
)
plot_n_qubit_state_in_bloch_sphere
(
cir2
.
run_density_matrix
(),
show_arrow
=
True
)
plot_n_qubit_state_in_bloch_sphere
(
cir1
.
run_state_vector
(),
show_arrow
=
True
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录