The process tomography fitter does not correctly include the trace preserving constraint when using the cvx method
Steps to reproduce the problem
from qiskit import *
from qiskit.providers.aer.noise import NoiseModel, depolarizing_error
from qiskit.ignis.verification import process_tomography_circuits, ProcessTomographyFitter
from qiskit.quantum_info import Choi
# Create some noise model
noise_model = NoiseModel()
depol_error = depolarizing_error(0.1, 2)
noise_model.add_all_qubit_quantum_error(depol_error, ['cx'])
# Create some circuit
qreg = QuantumRegister(2)
qc = QuantumCircuit(qreg)
qc.cx(0,1)
# Run process tomography
pt_circs = process_tomography_circuits(qc, qreg)
res = execute(pt_circs, Aer.get_backend('qasm_simulator'),noise_model=noise_model, shots=8192).result()
tomo_fitter = ProcessTomographyFitter(res, pt_circs)
choi = tomo_fitter.fit(method='cvx', psd=True, solver="CVXOPT", eps=1e-20)
choi = Choi(choi)
assert choi.is_cp() # Succeeds
assert choi.is_tp() # Fails
What is the expected behavior?
The resulting channel should be trace preserving, i.e. the second assert should not fail in the above code.
Suggested solutions
I have tracked down the error to the file qiskit/ignis/verification/tomography/fitters/cvx_fit.py. The cvxpy fitting routine is supposed to add the TP constraint by making sure that the partial trace of the Choi matrix is the identity. However it only checks the real part of the partial trace and not the imaginary part. The resulting choi matrix is therefore not TP.
Informations
What is the current behavior?
The process tomography fitter does not correctly include the trace preserving constraint when using the
cvx
methodSteps to reproduce the problem
What is the expected behavior?
The resulting channel should be trace preserving, i.e. the second assert should not fail in the above code.
Suggested solutions
I have tracked down the error to the file
qiskit/ignis/verification/tomography/fitters/cvx_fit.py
. The cvxpy fitting routine is supposed to add the TP constraint by making sure that the partial trace of the Choi matrix is the identity. However it only checks the real part of the partial trace and not the imaginary part. The resulting choi matrix is therefore not TP.