def to_0xyz_basis(ptm):
"""Transform a Pauli transfer in the 0xy1 basis [1],
to the the usual 0xyz. The inverse of to_0xy1_basis.
ptm: The input transfer matrix in 0xy1 basis. Must be 4x4.
[1] Daniel Greenbaum, Introduction to Quantum Gate Set Tomography, http://arxiv.org/abs/1509.02921v1
"""
ptm = np.array(ptm)
if ptm.shape == (4, 4):
trans_mat = basis_transformation_matrix
return np.dot(trans_mat, np.dot(ptm, trans_mat))
elif ptm.shape == (16, 16):
trans_mat = np.kron(basis_transformation_matrix, basis_transformation_matrix)
return np.dot(trans_mat, np.dot(ptm, trans_mat))
else:
raise ValueError("Dimensions wrong, must be one- or two Pauli transfer matrix ")
评论列表
文章目录