上一章: Kraus
下一章: SuperOp
简介
量子通道的 Choi 矩阵表示。
量子通道 \(\mathcal{E}\) 的 Choi 矩阵表示是一种矩阵形式。
\[\Lambda=\sum_{i, j}|i\rangle\langle j| \otimes \mathcal{E}(|i\rangle\langle j|)
\]
密度矩阵 \(\rho\) 相对于 Choi 矩阵的演化如下:
\[\mathcal{E}(\rho)=\operatorname{Tr}_{1}\left[\Lambda\left(\rho^{T} \otimes \mathbb{I}\right)\right]
\]
请参考已有文献:C.J. Wood, J.D. Biamonte, D.G. Cory, Tensor networks and graphical calculus for open quantum systems, Quant. Inf. Comp. 15, 0579-0811 (2015).arXiv:1111.6950 [quant-ph]。
在 QPanda3 量子信息模块中
构造 Choi 对象
API文档链接
从 Choi 构造
从 Choi 对象生成另一个 Choi 对象。
Python
import numpy as np
def test_construct_from_choi():
K0 = np.array([[0, 1], [1+0.j, 0]])
K1 = np.array([[1, 0], [0+0.j, -1]])
K2 = np.array([[0+0.j, -1.j], [1.j, 0]])
Ks1 = [K0, K1, K2]
Ks2 = [K1]
Kra3 = Kraus(Ks1, Ks2)
choi = Choi(Kra3)
choi2 = Choi(choi)
print("choi2:",choi2)
if __name__ == "__main__":
test_construct_from_choi()
执行结果如下所示:
choi2: [[ 1.+0.j 0.+0.j 0.+0.j -1.+0.j]
[ 0.+0.j 2.+0.j 0.+0.j 0.+0.j]
[ 0.+0.j 0.+0.j 2.+0.j 0.+0.j]
[-1.+0.j 0.+0.j 0.+0.j 1.+0.j]]
从 Chi 构造
从 Chi 对象生成 Choi 对象。请参考 Chi。
Python
import numpy as np
def test_construct_from_chi():
K0 = np.array([[0, 1], [1 + 0.j, 0]])
K1 = np.array([[1, 0], [0 + 0.j, -1]])
K2 = np.array([[0 + 0.j, -1.j], [1.j, 0]])
Ks1 = [K0, K1, K2]
Ks2 = [K1]
Kra3 = Kraus(Ks1, Ks2)
chi = Chi(Kra3)
choi = Choi(chi)
print("choi:", choi)
if __name__ == "__main__":
test_construct_from_chi()
执行结果如下所示:
choi: [[ 1.+0.j 0.+0.j 0.+0.j -1.+0.j]
[ 0.+0.j 2.+0.j 0.+0.j 0.+0.j]
[ 0.+0.j 0.+0.j 2.+0.j 0.+0.j]
[-1.+0.j 0.+0.j 0.+0.j 1.+0.j]]
从 SuperOp 构造
从 SuperOp 对象生成 Choi 对象。请参考 SuperOp。
Python
import numpy as np
def test_construct_from_superop():
K0 = np.array([[0, 1], [1 + 0.j, 0]])
K1 = np.array([[1, 0], [0 + 0.j, -1]])
K2 = np.array([[0 + 0.j, -1.j], [1.j, 0]])
Ks1 = [K0, K1, K2]
Ks2 = [K1]
Kra3 = Kraus(Ks1, Ks2)
sop = SuperOp(Kra3)
choi = Choi(sop)
print("choi:", choi)
if __name__ == "__main__":
test_construct_from_superop()
执行结果如下所示:
choi: [[ 1.+0.j 0.+0.j 0.+0.j -1.+0.j]
[ 0.+0.j 2.+0.j 0.+0.j 0.+0.j]
[ 0.+0.j 0.+0.j 2.+0.j 0.+0.j]
[-1.+0.j 0.+0.j 0.+0.j 1.+0.j]]
从 Kraus 构造
从 Kraus 对象生成 Choi 对象。请参考 Kraus。
Python
import numpy as np
def test_construct_from_kraus():
K0 = np.array([[0, 1], [1+0.j, 0]])
K1 = np.array([[1, 0], [0+0.j, -1]])
K2 = np.array([[0+0.j, -1.j], [1.j, 0]])
Ks1 = [K0, K1, K2]
Ks2 = [K1]
Kra3 = Kraus(Ks1, Ks2)
choi = Choi(Kra3)
print("choi:",choi)
if __name__ == "__main__":
test_construct_from_kraus()
执行结果如下所示:
choi: [[ 1.+0.j 0.+0.j 0.+0.j -1.+0.j]
[ 0.+0.j 2.+0.j 0.+0.j 0.+0.j]
[ 0.+0.j 0.+0.j 2.+0.j 0.+0.j]
[-1.+0.j 0.+0.j 0.+0.j 1.+0.j]]
从 PTM 构造
从 PTM 对象生成 Choi 对象。请参考 PTM。
Python
import numpy as np
def test_construct_from_ptm():
K0 = np.array([[0, 1], [1 + 0.j, 0]])
K1 = np.array([[1, 0], [0 + 0.j, -1]])
K2 = np.array([[0 + 0.j, -1.j], [1.j, 0]])
Ks1 = [K0, K1, K2]
Ks2 = [K1]
Kra3 = Kraus(Ks1, Ks2)
ptm = PTM(Kra3)
choi = Choi(ptm)
print("choi:", choi)
if __name__ == "__main__":
test_construct_from_ptm()
执行结果如下所示:
choi: [[ 1.+0.j 0.+0.j 0.+0.j -1.+0.j]
[ 0.+0.j 2.+0.j 0.+0.j 0.+0.j]
[ 0.+0.j 0.+0.j 2.+0.j 0.+0.j]
[-1.+0.j 0.+0.j 0.+0.j 1.+0.j]]
获取内部数据
输入和输出维度
获取量子通道的输入维度 input_dim
和输出维度 output_dim
。
Choi 矩阵的形状为 (input_dim * output_dim, input_dim * output_dim)
。
Choi.get_input_dim的API文档链接
Choi.get_output_dim的API文档链接
Python
import numpy as np
def test_dim():
K0 = np.array([[0, 1], [1+0.j, 0]])
K1 = np.array([[1, 0], [0+0.j, -1]])
K2 = np.array([[0+0.j, -1.j], [1.j, 0]])
Ks1 = [K0, K1, K2]
Ks2 = [K1]
Kra3 = Kraus(Ks1, Ks2)
choi = Choi(Kra3)
input_dim = choi.get_input_dim()
output_dim = choi.get_output_dim()
print("input_dim:",input_dim)
print("output_dim:",output_dim)
if __name__ == "__main__":
test_dim()
执行结果如下所示:
input_dim: 2
output_dim: 2
量子态的演化
Choi.evolve的API文档链接
密度矩阵
对 DensityMatrix
对象进行演化,演化结果为一个 DensityMatrix
对象。DensityMatrix
对象的维度可通过成员方法 dim
获取,并应等于 Choi 对象的输入维度。请参考密度矩阵。
Python
import numpy as np
def test_evolve():
data = np.array(
[[0.69272168 + 0.j, 0.38338527 - 0.17772383j],
[0.38338527 + 0.17772383j, 0.30727832 + 0.j]]
)
dm = DensityMatrix(data)
K0 = np.array([[0, 1], [1 + 0.j, 0]])
K1 = np.array([[1, 0], [0 + 0.j, -1]])
K2 = np.array([[0 + 0.j, -1.j], [1.j, 0]])
Ks1 = [K0, K1, K2]
Ks2 = [K1]
Kra3 = Kraus(Ks1, Ks2)
choi = Choi(Kra3)
res = choi.evolve(dm)
print("res:", res)
if __name__ == "__main__":
test_evolve()
执行结果如下所示:
res: [[ 1.30727832+0.j -0.38338527+0.17772383j]
[-0.38338527-0.17772383j 1.69272168+0.j ]]
态矢量
对 StateVector
对象执行演化,并将结果返回为 DensityMatrix
对象。StateVector
对象的维度由其成员方法 dim
获取,并且应等于 Choi 对象的输入维度。请参考密度矩阵和态矢量。
Python
import numpy as np
def test_evolve():
stv = StateVector()
K0 = np.array([[0, 1], [1+0.j, 0]])
K1 = np.array([[1, 0], [0+0.j, -1]])
K2 = np.array([[0+0.j, -1.j], [1.j, 0]])
Ks1 = [K0, K1, K2]
Ks2 = [K1]
Kra3 = Kraus(Ks1, Ks2)
choi = Choi(Kra3)
res = choi.evolve(stv)
print("res:",res)
if __name__ == "__main__":
test_evolve()
执行结果如下所示:
res: [[1.+0.j 0.+0.j]
[0.+0.j 2.+0.j]]
布尔函数
判等
判断两个 Choi 对象的内部数据是否相等。
API文档链接
Python
import numpy as np
def test_equal():
K0 = np.array([[0, 1], [1+0.j, 0]])
K1 = np.array([[1, 0], [0+0.j, -1]])
K2 = np.array([[0+0.j, -1.j], [1.j, 0]])
Ks1 = [K0, K1, K2]
Ks2 = [K1]
Kra3 = Kraus(Ks1, Ks2)
choi = Choi(Kra3)
choi2 = choi
print(choi2 == choi)
if __name__ == "__main__":
test_equal()
执行结果如下所示: