上一章: SuperOp
下一章: PTM
简介
量子通道的 Chi 矩阵表示。
\(n\) 量子比特的量子通道 \(\mathcal{E}\) 的 Chi 矩阵表示为矩阵 χ,使得密度矩阵 \(\rho\) 的演化遵循以下公式:
\[\mathcal{E}(\rho)=\frac{1}{2^{n}} \sum_{i, j} \chi_{i, j} P_{i} \rho P_{j}
\]
其中
\[\left[P_{0}, P_{1}, \ldots, P_{4^{n}-1}\right]
\]
是按照字典序排列的 \(n\) 量子比特泡利基。Chi 矩阵与 Choi 表示之间通过 Choi 矩阵转换到泡利基得到。此外,定义中的
\[\frac{1}{2^{n}}
\]
是一个归一化因子,用于缩放泡利基使其正交归一化。
请参考已有文献: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 量子信息模块中
QPanda3 使用 Chi 类实现对 Chi 矩阵的抽象。
构造 Chi 对象
API文档链接
从 Choi 构造
从 Choi 对象生成一个 Chi 对象。请参考 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)
chi = Chi(choi)
print("chi:",chi)
if __name__ == "__main__":
test_construct_from_choi()
执行结果如下所示:
chi: [[0.+0.j 0.+0.j 0.+0.j 0.+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]
[0.+0.j 0.+0.j 0.+0.j 2.+0.j]]
从 Chi 构造
从一个Chi对象生成另外一个 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)
chi2 = Chi(chi)
print("chi2:", chi2)
if __name__ == "__main__":
test_construct_from_chi()
执行结果如下所示:
chi2: [[0.+0.j 0.+0.j 0.+0.j 0.+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]
[0.+0.j 0.+0.j 0.+0.j 2.+0.j]]
从 SuperOp 构造
从 SuperOp 对象生成 Chi 对象。请参考 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)
chi = Chi(sop)
print("chi:", chi)
if __name__ == "__main__":
test_construct_from_superop()
执行结果如下所示:
chi: [[0.+0.j 0.+0.j 0.+0.j 0.+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]
[0.+0.j 0.+0.j 0.+0.j 2.+0.j]]
从 Kraus 构造
从 Kraus 对象生成 Chi 对象。请参考 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)
chi = Chi(Kra3)
print("chi:",chi)
if __name__ == "__main__":
test_construct_from_kraus()
执行结果如下所示:
chi: [[0.+0.j 0.+0.j 0.+0.j 0.+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]
[0.+0.j 0.+0.j 0.+0.j 2.+0.j]]
从 PTM 构造
从 PTM 对象生成 Chi 对象。请参考 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)
chi = Chi(ptm)
print("chi:", chi)
if __name__ == "__main__":
test_construct_from_ptm()
执行结果如下所示:
chi: [[0.+0.j 0.+0.j 0.+0.j 0.+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]
[0.+0.j 0.+0.j 0.+0.j 2.+0.j]]
获取内部数据
输入与输出维度
获取量子通道的输入维度 input_dim
和输出维度 output_dim
。
获取input_dim
的API文档链接
获取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)
chi = Chi(Kra3)
input_dim = chi.get_input_dim()
output_dim = chi.get_output_dim()
print("input_dim:",input_dim)
print("output_dim:",output_dim)
if __name__ == "__main__":
test_dim()
执行结果如下所示:
input_dim: 2
output_dim: 2
量子态的演化
Chi.evolve的API文档链接
对密度矩阵的演化
对 DensityMatrix
对象进行演化,并返回演化后的 DensityMatrix
对象。密度矩阵的维度由 dim
方法获取,并应与 Chi 对象的输入维度相等。请参考密度矩阵。
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)
chi = Chi(Kra3)
res = chi.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()
方法获取,并应该与 Chi 对象的输入维度相等。请参考密度矩阵和态矢量。
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)
chi = Chi(Kra3)
res = chi.evolve(stv)
print("res:",res)
if __name__ == "__main__":
test_evolve()
执行结果如下所示:
res: [[1.+0.j 0.+0.j]
[0.+0.j 2.+0.j]]
布尔函数
判等
判断两个 Chi
对象的内部数据是否相等。
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)
chi = Chi(Kra3)
chi2 = chi
print(chi2==chi)
if __name__ == "__main__":
test_equal()
执行结果如下所示: