quri_parts.core.estimator.sampling.overlap_estimator module#

sampling_overlap_estimate(ket, bra, shots, sampler)#

Estimate the magnitude squared overlap of a pair of quantum states by sampling measurement.

The sampling measurements are configured with arguments as follows.

Parameters:
  • ket (CircuitQuantumState) – The state whose direct circuit is used

  • bra (CircuitQuantumState) – The state whose inverse circuit is used

  • shots (int) –

  • sampler (core.sampling.ConcurrentSampler) –

Returns:

The estimated value (can be accessed with value) with standard error

of estimation (can be accessed with error).

Return type:

Estimate[float]

create_sampling_overlap_estimator(shots, sampler)#

Create a OverlapEstimator that estimates the squared magnitude of the overlap of a pair of wavefunctions by sampling measurement.

The sampling measurements are configured with arguments as follows.

Parameters:
  • shots (int) – Number of shots available for sampling measurements.

  • sampler (ConcurrentSampler) – A Sampler that actually performs the sampling measurements.

Return type:

OverlapEstimator[CircuitQuantumState]

sampling_overlap_weighted_sum_estimate(kets, bras, weights, total_shots, sampler, shots_allocator)#

Estimate the weighted sum of magnitude squared overlaps of pairs of quantum states by a sampling measurement.

The sampling measurements are configured with arguments as follows.

Parameters:
  • kets (Sequence[CircuitQuantumState]) – The states whose direct circuit is used

  • bras (Sequence[CircuitQuantumState]) – The states whose inverse circuit is used

  • weights (Sequence[complex]) – Weights used in summing the overlaps

  • total_shots (int) – Total number of shots used for sampling measurements.

  • sampler (core.sampling.ConcurrentSampler) – A Sampler that actually performs the sampling measurements.

  • shots_allocator (core.sampling.WeightedSamplingShotsAllocator) – shot allocator which takes weights as an argument.

Returns:

The estimated value (can be accessed with value) with standard error

of estimation (can be accessed with error).

Return type:

Estimate[complex]

create_sampling_overlap_weighted_sum_estimator(total_shots, sampler, shots_allocator)#

Create a OverlapWeightedSumEstimator that estimates the squared magnitude of the overlap of pairs of wavefunctions by sampling measurement and returns a weighted sum.

The sampling measurements are configured with arguments as follows.

Parameters:
  • total_shots (int) – Total number of shots available for sampling measurements.

  • sampler (ConcurrentSampler) – A Sampler that actually performs the sampling measurements.

  • shots_allocator (WeightedSamplingShotsAllocator) – shot allocator which takes weights as an argument.

Return type:

OverlapWeightedSumEstimator[CircuitQuantumState]