-
Notifications
You must be signed in to change notification settings - Fork 166
Open
Labels
Description
Is your feature request related to a problem? Please describe.
When simulating a Q# program I would like to force post-select a qubit to a state (e.g., a Z basis state). This makes it easier to analyze the program for both possible outputs without relying on the random measurement result returning the desired value (especially when the probability of the post-select result is low). This can also be useful in tests.
Describe the solution you'd like
Maybe something that works like this:
use (a, b, c) = (Qubit(), Qubit(), Qubit())
// prepare GHZ state
H(a);
CNOT(a, b);
CNOT(a, c);
// post-select b on |0><0|
PostSelectZ(b, false);
Fact(CheckAllZero([a, b, c]), "State expected to collapse into all-0");Describe alternatives you've considered
- Obtain state vector programmatically and manually update state based on expected post-selection result
- Perform multiple rounds of simulation and check for expected measurement result (only works if it has high probability)
Reactions are currently unavailable