Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Process Tomography does not handle trace preserving constraint correctly #437

Closed
ChriPiv opened this issue Jun 22, 2020 · 1 comment · Fixed by #438
Closed

Process Tomography does not handle trace preserving constraint correctly #437

ChriPiv opened this issue Jun 22, 2020 · 1 comment · Fixed by #438
Labels
bug Something isn't working

Comments

@ChriPiv
Copy link
Contributor

ChriPiv commented Jun 22, 2020

Informations

  • Qiskit Ignis version: master (0.4.0)
  • Python version: 3.7.3
  • Operating system: Debian WSL

What is the current behavior?

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.

@ChriPiv ChriPiv added the bug Something isn't working label Jun 22, 2020
@ChriPiv
Copy link
Contributor Author

ChriPiv commented Jun 22, 2020

The fix is a simple one-liner, I will submit a PR

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant