Allow NoiseModel to substitute and/or add qubits
When DensityMatrixSimulator is run with a noise model, the simulator assumes that the noise model only returns operations on the same qubits and crashes otherwise.
There are two main use cases for this:
- Simulating noise caused by leakage to the |2> state. The noise model needs to return operations on qutrits corresponding to the input circuit's qubits.
- Simulating entanglement with the environment. The noise model needs to add extra qubit(s) to represent the environment.
I propose adding a method to NoiseModel named something like substituted_system_qubits that takes an ordered list of the circuit qubits and returns a list of the qubits the NoiseModel plans to output. Simulators will need to be updated to account for this.
Related to #933 and #1610.
Is the main motivation behind updating the qubits "online" during simulation, instead creating space for them upfront to optimize resource usage? Or is it more of a user experience concern, that you'll have to now add the extra qubits upfront when constructing the circuit?
This isn't about updating qubits "online". The simulators currently take an ideal circuit and a noise model, then simulates the noisy circuit. This issue here is the density simulator assumes the qubits in the ideal circuit are the same as the noisy circuit. This limits the transformations a NoiseModel can perform on a circuit.
My current workaround for the two use cases I mentioned is to first apply the noise model, then give the noisy circuit to the simulator.
Marking as after-1.0 assuming only method additions are necessary. cc @95-martin-orion
Closing because of age (6 years since first openened) and prioritization. If this is in error, someone please feel free to reopen it.