-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Once #603 is merged in, users will be able to do something like the following:
from bloqade import squin
@squin.kernel
def example():
qs = squin.qalloc(4)
ms = squin.broadcast.measure(qs)
squin.set_observable([ms[0]])
squin.set_observable([ms[1]])Currently, set_observable defaults to generate the stim equivalent INCLUDE_OBSERVABLE instruction with the hard-code index of 0 regardless of how many times set_observable is called (that is, you see INCLUDE_OBSERVABLE(0) in the stim codegen output).
This is fine if you only have one observable you care about but becomes incorrect when you're dealing with multiple logical qubits (or you have something like:
M 0
OBSERVABLE_INCLUDE(1) rec[-1]
REPEAT 7 {
...
M 0
}
M 0
OBSERVABLE_INCLUDE(1) rec[-1]
which @rafaelha pointed out to me where you want to "append" multiple record indexes in time with one observable.
)
To compromise between the squin and stim semantics, @kaihsin has proposed that every instance of set_observable encountered in a squin kernel should have a unique integer value when converting to stim.
For the cases where something like Rafael pointed out comes up, one should rely on squin-stim interop (see #551 )