forked from quantumlib/Cirq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ResetGate to work with MPS, StabilizerSampler (quantumlib#4765)
This abstracts the implementation of ResetGate to be a measurment and then a PlusGate with an offset that gets the qubit back to the zero state (for 2-dimensional qubits, this is equivalent to X iff measurement==1). This allows Reset to work for all simulators, not just the specific ones whose cases were implemented in the existing code. There is a special consideration for density-matrix-like simulators. For these, we do not want to actually perform the measurement, as a density matrix can represent the mixed state of all measurement results. Performing the measurement would lose that information. Therefore, here we add a `can_represent_mixed_states` property to the ActOnArgs, and if that is true, then we allow the simulator to fall back to its own apply_channel implementation. This new property allows other density-matrix-like state representations (say a superoperator simulator) to adopt the same behavior without having to update `ResetGate._act_on_`.
- Loading branch information
1 parent
c054e14
commit af86156
Showing
7 changed files
with
56 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters