You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Strawberry Fields allows having multi-mode measurements in a Program by having measurement operators targetting several registers that reference the modes to be measured.
Within the definition of a program, this means having MeasurementOperator | (q[0], q[1], q[2], ...) , where q[0], q[1], ... refer to the registers of the modes to be measured.
Intuitively, one could want to define the same measurement by having consecutive measurement operators targetting a single register in the following fashion:
This would most likely include a change in how compilers handle measurement operators and introduce logic so that compilers will automatically group measurements that are terminal.
The text was updated successfully, but these errors were encountered:
Also worth mentioning that while this is unintuitive, it is also expected behaviour; the backend API was designed such that after a measurement operation, the mode is always traced out and replaced with the vacuum state. This allows the state to be re-used without needing to add additional modes to the system, which might be costly.
I propose that we simply modify the compilers such that terminal measurements of a program (e.g, those that are 'dangling' nodes of the DAG with no other operations depending on them) are compiled into a single measurement result.
Issue description
Strawberry Fields allows having multi-mode measurements in a
Program
by having measurement operators targetting several registers that reference the modes to be measured.Within the definition of a program, this means having
MeasurementOperator | (q[0], q[1], q[2], ...)
, whereq[0], q[1], ...
refer to the registers of the modes to be measured.Intuitively, one could want to define the same measurement by having consecutive measurement operators targetting a single register in the following fashion:
Specific example
Let's have a look at a specific example, where it is expected to see correlation between the outcomes for each mode
can result in an output like:
Program
definition:which can result in an output like:
With the second example, mode
q[0]
gets reinitialized to the vacuum state after being measured.Expected behavior:
The previous two code snippets both output samples where the samples for each run of the program are correlated.
Actual behavior:
There is a correlation between samples of the two modes for each run of the program only for the first code example.
Reproduces how often:
Each time.
System information:
Additional information
This would most likely include a change in how compilers handle measurement operators and introduce logic so that compilers will automatically group measurements that are terminal.
The text was updated successfully, but these errors were encountered: