#17095·qiskit

Choi-to-Kraus conversion mutates input Choi data

Author: Silas-ZengCreated Sep 30, 2026Updated Sep 30, 2026

Choi-to-Kraus conversion mutates the input Choi data

Environment

  • Qiskit main checkout at 51dd141c57baee0eaaf2072b99dd0c014cf19fa1
  • Python 3.13.9, NumPy 2.5.3

What is happening?

Converting a rank-deficient Choi object to Kraus form changes the original Choi.data array. The change comes from the numerical stabilization path and is visible to the caller after conversion.

How can we reproduce the issue?

python
import numpy as np
from qiskit.quantum_info import Choi, Kraus, Operator

choi = Choi(Operator(np.eye(2)))
before = choi.data.copy()
Kraus(choi)
print(np.max(np.abs(choi.data - before)))

On the affected checkout this prints approximately 1.0e-10.

What should happen?

A representation conversion should leave the input object unchanged.

Any suggestions?

Could the stabilization path operate on a local copy and add a regression test that checks the source data before and after conversion?