Post Selection on StateVector

Dear All,

First of all let me congratulate with the entire team, I haven’t used Perceval in a long while and I have seen a tremendous progress!

I have a comment/question regarding the post selection functionality.
Currently is it possible to apply a PostSelect function only to “erase” unwanted states from a ProbabilityDistribution?
In that case, do you plan to extend it to StateVector? A general postselection rule allows to throw away unwanted portions of any kind of states, potentially, maintaining its coherence.

As a result, the Simulator object despite evolving a state cannot really apply a rule to the output, despite the presence of the set_postselection method (I mean, I can still get transform to distribution and postselect there but I’d like to keep the state coherent, along with its phasis!).

Thanks a lot & best


Thanks for your kind words, I’ll pass them to the whole software team! :slight_smile:

Currently a PostSelect object can only do one thing: you feed him a Fock state and if answers True (select it) or False (filter it out). It’s used inside the Processor class to post-select measured states during a probability distribution or a sampling simulation.

So, in Perceval 0.10, you’d have to add some code in order to apply post-selection to an evolved StateVector. For instance, call:

def postselect_statevector(ps: PostSelect, sv: StateVector):
    sv_out = StateVector()
    for state, ampli in sv:
        if ps(state):
           sv_out += ampli*state
    return sv_out

This will be done automatically in Perceval 0.11.

I hope this helps!
Best wishes,

1 Like