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 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

create_general_post_selection_concurrent_sampler(concurrent_sampler, filter_fn)#

Returns ConcurrentSampler 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:
  • concurrent_sampler (core.sampling.ConcurrentSampler) –

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

Return type:

core.sampling.ConcurrentSampler