未验证 提交 9bb5444c 编写于 作者: Y yangguohao 提交者: GitHub

Create test.py

上级 5a194b7c
from paddle_quantum.utils import img_to_density_matrix
import paddle
import matplotlib.image
import numpy as np
img_file = '/home/aistudio/f1.jpeg'
rho = (img_to_density_matrix(img_file))
#半正定
w,_=np.linalg.eig(rho)
print(all(w>=0))
#迹为1
print(np.trace(rho))
#shape为[2**n,2**n]
print(rho.shape)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册