Open marco-lewis opened 3 years ago
In terms of the physical interpretation, there is no difference between the two states as global phases are irrelevant, but I see why picking up global phases can be annoying when trying to interpret the output.
I think one way to resolve this to some extent might be to reset the global phase to 1
whenever there is only one component in the superposition after a measurement. (But in general, it's hard to know what global phase the user wanted.)
Is there a method for resetting the global state if there are no quantum variables? I am considering some code that requires a repeat until success loop and the quantum state needs to be reset at the start of the loop.
Example with a minimal program:
On the first iteration, the quantum state is
(1+0i)·|⟩
or(1+0i)·|0⟩
up to the rotation statements. Once the rotations are done the quantum state is(0.850301-0.217117i)·|0⟩₂+(0.464521+0.118612i)·|1⟩₂
. Now if the measurement is1
the quantum state becomes(0.968912+0.247404i)·|⟩
, which leaks into the redefinition ofq
in the next iteration. The state is therefore(0.968912+0.247404i)·|0⟩
rather than(1+0i)·|0⟩
.Basically, I would be looking for something like:
where
reset()
changes an empty quantum state back to(1+0i)·|⟩
.