# How to compute the unitary from the $\chi$ matrix obtained from QPT

I am trying to do quantum process tomography for one qubit and obtain the unitary for the gates that are applied on the qubit. I have studied the theory on process tomography from mike and ike and the box 8.5 describes a simple procedure for obtaining the chi matrix for our quantum operation.

Now I am a little confused how would I go from the said chi matrix to obtaining the unitary which directly depend upon $$E_i$$'s.

Note - I am not getting the same chi matrix when I compare my results to qiskit backends but I figured that was happening because of different basis states.

Furthermore I have implemented the above using Qiskit and I dont think I am getting the correct result.

def one_qubit_process_tomography(circuit, samples):

# I, rho_1
qc = QuantumCircuit(1,1)
qc = qc.compose(circuit)

rhod_1 = one_qubit_tomography(qc, samples)

# X, rho_4
qc = QuantumCircuit(1,1)
qc.x(0)
qc = qc.compose(circuit)
rhod_4 =  one_qubit_tomography(qc, samples)

# H, rho_h,  E(|+><+|)
qc = QuantumCircuit(1,1)
qc.h(0)
qc = qc.compose(circuit)
rhod_h = one_qubit_tomography(qc, samples)

# XH, rho_xh,  E(|-><-|)
qc = QuantumCircuit(1,1)
qc.x(0)
qc.h(0)
qc = qc.compose(circuit)
rhod_xh =   one_qubit_tomography(qc, samples)

# this is E(|0><1|)
rhod_2 = rhod_h - 1j*rhod_xh - (1-1j)*(rhod_1 + rhod_4)/2

# this is E(|1><0|)
rhod_3 = rhod_h + 1j*rhod_xh - (1+1j)*(rhod_1 + rhod_4)/2

# now we will find the chi matrix
lambdaa = 0.5*np.array([[1,0,0,1],[0,1,1,0],[0,1,-1,0],[1,0,0,-1]])

#print(rhod_1)
#print(rhod_2)
#print(rhod_3)
#print(rhod_4)

rho = np.zeros([4,4],dtype=np.complex_)
rho[0:2,0:2] = rhod_1
rho[0:2,2:4] = rhod_2
rho[2:4,0:2] = rhod_3
rho[2:4,2:4] = rhod_4

chi = np.matmul(np.matmul(lambdaa, rho), lambdaa)
#print(rho)

return chi


Not all quantum operations are unitary. A more general type of quantum operation is the completely positive trace-preserving (CPTP) linear map which is the main subject of chapter $$8$$ of Nielsen & Chuang. The $$\chi$$ matrix is one of several concrete descriptions of a CPTP map and is the output of the standard quantum process tomography.

A CPTP map with a given $$\chi$$ matrix corresponds to a unitary if and only if the $$\chi$$ matrix is rank one. This is very unlikely to be the case for a $$\chi$$ matrix obtained in experiment due to noise and decoherence. That said, if the $$\chi$$ matrix does describe a unitary operation then we can obtain it by converting from the $$\chi$$ matrix representation to a Kraus representation as described near equation $$(8.167)$$ on page $$392$$ in Nielsen & Chuang. Unitary quantum operations have a Kraus representation with a single Kraus operator equal to the unitary operator.

• Thanks for your answer and I also tried your implementation but I am not getting a correct result. Could you please take a look at the code for getting the chi matrix maybe there is something wrong there.. Commented Dec 24, 2021 at 17:49

As @AdamZalcman has pointed out, the $$\chi$$ matrix represents a (more general than unitary) Quantum channel. If you were trying to implement a unitary operation, your channel might be close to a unitary operation (depending on how well your system performs).

As the $$\chi$$ matrix is positive semidefinite, it has a (unique) eigendecomposition $$\{\lambda_{i},\vec{v}_{i}\}$$, with the eigenvectors forming an orthonormal basis. To obtain the unitary that you were trying to implement, grab that eigenvector $$\vec{v}_{max}$$ for which its eigenvalue $$\lambda$$ is the maximum one (over all eigenvalues of $$\chi$$). Assuming your $$\chi$$ matrix is in the Pauli basis, your unitary $$U_{implemented}$$ is then:

$$U_{implemented} = \sum_{j} (\vec{v}_{max})_{j} P_{j}$$ where $$P_{j}$$ are the Paulis $$\{I,X,Y,Z\}$$ (in that order!), assuming you are performing single-qubit process tomography. Using the operators from N&C as defined in your question, it would be $$\{I, X, -iY, Z\}$$.

If $$U_{implemented}$$ is exactly the unitary $$U_{goal}$$ that you were trying to implement, all your noise is completely random, and your process fidelity is $$\lambda_{max}$$.

If $$U_{implemented}$$ is not exactly $$U_{goal}$$, you (also) have a systematic error, which means that your system is performing an extra (unitary) rotation $$U_{err} = U_{implemented}U_{goal}^{\dagger}$$ and your process fidelity is (strictly) bounded from above by $$\lambda_{max}$$.

• BTW, 'unique' is up to degeneracy of the eigenvalues, but that's not important because in experimental QPT you will very very unlikely have these. Moreover, one can always find an orthonormal basis, which is the important tid-bit here.
– JSdJ
Commented Dec 23, 2021 at 16:53
• thanks for your reply. Actually I am trying to implement process tomography using QISKIT and your method is actually simpler to implement.Although I am not able to properly understand why it should work. Could you please elaborate on the reasoning behind this Commented Dec 23, 2021 at 21:05
• I have been trying to implement your method and I am not getting the correct results. I am not sure why that is happening. But could you please take a look at the code I am using to obtain the $\chi$ matrix Commented Dec 23, 2021 at 22:27