-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix snapshot wire order when simulation indices different than device…
… wires (#6461) **Context:** Internally, default qubit only performs the simulation with the wires that it needs for apply the operation. Any wires only present in measurements are only added in at the very end. This can be substantially more memory and time efficient in certain edge cases. Unfortunately, this can cause confusion about the snapshotted state taken mid-simulation. Mid simulation we have fewer wires and a different wire order. **Description of the Change:** 1) Add a `map_wires` method to snapshot to allow us to map the wires 2) Fill in device wires on Snapshots during `validate_device_wires`. 3) Allow `StateMP.process_state` to add in blank subsystems when the measurement has wires not present in the state's wire order. These three steps are sufficient to make sure that snapshots always match the device's wire order. **Benefits:** Less Confusion **Possible Drawbacks:** It's no longer the state being used during the simulation at that point. We are hiding away the fact we are working with a different state during the simulation. **Related GitHub Issues:** Fixes #6427 [sc-76515] --------- Co-authored-by: Yushao Chen (Jerry) <[email protected]> Co-authored-by: Astral Cai <[email protected]>
- Loading branch information
1 parent
76ca29e
commit d5d3c2b
Showing
9 changed files
with
131 additions
and
53 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
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