I want to do a simulation involving:
- mid-circuit measurement (i.e. based on the measurement result of some qubits to append further gates on other qubits; e.g., Pauli error correction in entanglement swapping)
- initialize the circuit with a general density matrix (i.e., initialize a circuit with a mixed state)
I have tried three frameworks: Qiskit, Cirq, and QuTip. These are my observations (might be wrong)
Qiskit: support mid-circuit measurement, but does not support initialization by density matrix
Cirq: support both.
QuTip: does not support mid-circuit measurement, but supports initialization by density matrix.
So, I used Cirq to do the simulation. However, I found that initialization by density matrix leads to results whose density matrix's trace < 1. I was wondering if I mistake something. As far as I know, initializing a circuit with a density matrix is quite complex, requiring ancilla qubits. It seems that having a line of code to do such a thing is too good to be true?
Besides these frameworks, do you know any frameworks that can do the above two things? Thanks very much for your time!
P.S. If you are curious about what I am trying to do: If we have $n$ Bell pairs, we can do Bell state measurement (or so-called entanglement swapping) $n-1$ times to generate one single Bell pair. This involves mid-circuit measurement and initialization with a density matrix to be memory-efficient.