Prev Tutorial: Chi
Next Tutorial: Hellinger Distance
Introduction
Pauli Transfer Matrix (PTM) representation of a Quantum Channel.
The PTM representation of an n-qubit quantum channel \(\mathcal{E}\) is an n-qubit SuperOp \(\mathcal{R}\) defined with respect to vectorization in the Pauli basis instead of column-vectorization. The elements of the PTM
\[
\mathcal{R}
\]
are given by
\[
R_{i, j}=\frac{1}{2^{n}} \operatorname{Tr}\left[P_{i} \mathcal{E}\left(P_{j}\right)\right]
\]
where
\[
\left[P_{0}, P_{1}, \ldots, P_{4^{n}-1}\right]
\]
is the \(\mathcal{n}\) -qubit Pauli basis in lexicographic order.
Evolution of a DensityMatrix \(\rho\)
ρ with respect to the PTM is given by
\[
\left.|\mathcal{E}(\rho)\rangle_{P}=S_{P}|\rho\rangle\right\rangle_{P}
\]
Please refer: 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]
In QPanda3 Quantum Information
Constructing a PTM object
Here is API doc
From Choi
Generate another PTM object from a Choi object
Please refer to 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)
ptm = PTM(choi)
print("ptm:",ptm)
if __name__ == "__main__":
test_construct_from_choi()
Output
ptm: {
{
{(3,0)},{(0,0)},{(0,0)},{(0,0)},
}
{
{(0,0)},{(-1,0)},{(0,0)},{(0,0)},
}
{
{(0,0)},{(0,0)},{(-1,0)},{(0,0)},
}
{
{(0,0)},{(0,0)},{(0,0)},{(-1,0)},
}
}
From Chi
Generate another PTM object from a Chi object
Please refer to 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)
ptm = PTM(chi)
print("ptm:", ptm)
if __name__ == "__main__":
test_construct_from_chi()
Output
ptm: {
{
{(3,0)},{(0,0)},{(0,0)},{(0,0)},
}
{
{(0,0)},{(-1,0)},{(0,0)},{(0,0)},
}
{
{(0,0)},{(0,0)},{(-1,0)},{(0,0)},
}
{
{(0,0)},{(0,0)},{(0,0)},{(-1,0)},
}
}
From SuperOp
Generate another PTM object from a SuperOp object
Please refer to 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)
ptm = PTM(sop)
print("ptm:", ptm)
if __name__ == "__main__":
test_construct_from_superop()
Output
ptm: {
{
{(3,0)},{(0,0)},{(0,0)},{(0,0)},
}
{
{(0,0)},{(-1,0)},{(0,0)},{(0,0)},
}
{
{(0,0)},{(0,0)},{(-1,0)},{(0,0)},
}
{
{(0,0)},{(0,0)},{(0,0)},{(-1,0)},
}
}
From Kraus
Generate another PTM object from a Kraus object
Please refer to 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)
ptm = PTM(Kra3)
print("ptm:",ptm)
if __name__ == "__main__":
test_construct_from_kraus()
Output
ptm: {
{
{(3,0)},{(0,0)},{(0,0)},{(0,0)},
}
{
{(0,0)},{(-1,0)},{(0,0)},{(0,0)},
}
{
{(0,0)},{(0,0)},{(-1,0)},{(0,0)},
}
{
{(0,0)},{(0,0)},{(0,0)},{(-1,0)},
}
}
From PTM
Generate another PTM object from a PTM object
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)
ptm2 = PTM(ptm)
print("ptm2:", ptm2)
if __name__ == "__main__":
test_construct_from_ptm()
Output
ptm2: {
{
{(3,0)},{(0,0)},{(0,0)},{(0,0)},
}
{
{(0,0)},{(-1,0)},{(0,0)},{(0,0)},
}
{
{(0,0)},{(0,0)},{(-1,0)},{(0,0)},
}
{
{(0,0)},{(0,0)},{(0,0)},{(-1,0)},
}
}
Obtain internal data
Input and output dim
Obtain the input dimension input_dim and output dimension output_dim of the quantum channel
Here is API doc for PTM.get_input_dim
Here is API doc for PTM.get_output_dim
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)
ptm = PTM(Kra3)
input_dim = ptm.get_input_dim()
output_dim = ptm.get_output_dim()
print("input_dim:",input_dim)
print("output_dim:",output_dim)
if __name__ == "__main__":
test_dim()
Output
input_dim: 2
output_dim: 2
Evolution of quantum states
Here is API doc for PTM.evolve
DensityMatrix
Evolution of a DensityMatrix object, and the evolution result is returned as a DensityMatrix object
The dimension of the density matrix is obtained by the member method dim() and should be equal to the input dimension of the PTM object
Please refer to DensityMatrix.
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)
ptm = PTM(Kra3)
res = ptm.evolve(dm)
print("res:", res)
if __name__ == "__main__":
test_evolve()
Output
res: {
{
{(1.30728,0)},{(-0.383385,0.177724)},
}
{
{(-0.383385,-0.177724)},{(1.69272,0)},
}
}
StateVector
Evolution of the StateVector object is performed, and the result is returned as a DensityMatrix object
The dimension of the StateVector object is obtained by the member method dim() and should be equal to the input dimension of the PTM object
Please refer to DensityMatrix
Please refer to StateVector
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)
ptm = PTM(Kra3)
res = ptm.evolve(stv)
print("res:",res)
if __name__ == "__main__":
test_evolve()
Output
res: {
{
{(1,0)},{(0,0)},
}
{
{(0,0)},{(2,0)},
}
}
Boolean function
Equal
Determine whether the internal data of two PTM objects are equal
Here is API doc
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)
ptm = PTM(Kra3)
ptm2 = ptm
print(ptm2==ptm)
if __name__ == "__main__":
test_equal()
Output