Skip to content

Feed-forward support in classical mixtures #103

Description

@david-pl

While mid-circuit measurements are already supported as of #101, feed-forward is trickier.

What we need

  1. We need to track the probability of each outcome at every mid-circuit measurement (this will also be needed for STIM support). This makes merging different branches trickier. We have to come up with a way to track mid-circuit measurement probabilities through merged entries (e.g. by using a Vec<Vec<_>>) and somehow connect them to the actual measurement gate that produced it. The alternative is to not merge entries with different mid-circuit measurement probabilities, but that will probably lead to branch blow-up.

  2. Once we have the above, we need to replace an if-statement such as shown in the snippet below, and replace the outcome if with branching, where each branch is weighed by the respective outcome probability of the used mid-circuit measurement. This will require rewriting the IR and it's genuinely not quite clear to me what the best approach here is.

let m = tab_sum.measure(0);
if m {
    tab_sum.x(0);
}

Non-goal

We do not want to support arbitrary if statements. Specifically, it may be fine to have a more or less arbitrary if body, but the condition needs to be based on a single measurement (maybe multiple measurements if it's not too hard). I'm also not quite sure how to best do this, maybe adding a designated statement for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions