quri_parts.algo.mitigation.post_selection.post_selection module#

PostSelectionFilterFunction#

Represents a filter function for post-selection.

alias of Callable[[int], bool]

post_selection(filter_fn, meas_counts)#

Functions that filter out unwanted measurement results from given meas_counts.

Parameters:
  • filter_fn (algo.mitigation.post_selection.post_selection.PostSelectionFilterFunction) –

  • meas_counts (core.sampling.MeasurementCounts) –

Return type:

core.sampling.MeasurementCounts

create_general_post_selection_sampler(sampler, filter_fn)#

Returns `class`:Sampler: that performs post-selection after sampling.

Note that the effective shots might decrease by discarding the measurement results which do not pass filter_fn.

Parameters:
  • sampler (core.sampling.Sampler) –

  • filter_fn (algo.mitigation.post_selection.post_selection.PostSelectionFilterFunction) –

Return type:

core.sampling.Sampler