quri_parts.core.estimator.sampling.overlap_estimator module#

quri_parts.core.estimator.sampling.overlap_estimator.sampling_overlap_estimate(ket: CircuitQuantumState, bra: CircuitQuantumState, shots: int, sampler: Callable[[Iterable[tuple[NonParametricQuantumCircuit, int]]], Iterable[Mapping[int, int | float]]]) Estimate[float]#

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 – The state whose direct circuit is used

  • bra – The state whose inverse circuit is used

Returns:

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

of estimation (can be accessed with error).

quri_parts.core.estimator.sampling.overlap_estimator.create_sampling_overlap_estimator(shots: int, sampler: Callable[[Iterable[tuple[NonParametricQuantumCircuit, int]]], Iterable[Mapping[int, int | float]]]) Callable[[CircuitQuantumState, CircuitQuantumState], Estimate[float]]#

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 – Number of shots available for sampling measurements.

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

quri_parts.core.estimator.sampling.overlap_estimator.sampling_overlap_weighted_sum_estimate(kets: Sequence[CircuitQuantumState], bras: Sequence[CircuitQuantumState], weights: Sequence[complex], total_shots: int, sampler: Callable[[Iterable[tuple[NonParametricQuantumCircuit, int]]], Iterable[Mapping[int, int | float]]], shots_allocator: Callable[[Sequence[complex], int], Sequence[int]]) Estimate[complex]#

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 – The states whose direct circuit is used

  • bras – The states whose inverse circuit is used

  • weights – Weights used in summing the overlaps

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

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

  • shots_allocator – 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).

quri_parts.core.estimator.sampling.overlap_estimator.create_sampling_overlap_weighted_sum_estimator(total_shots: int, sampler: Callable[[Iterable[tuple[NonParametricQuantumCircuit, int]]], Iterable[Mapping[int, int | float]]], shots_allocator: Callable[[Sequence[complex], int], Sequence[int]]) Callable[[Sequence[CircuitQuantumState], Sequence[CircuitQuantumState], Sequence[complex]], Estimate[complex]]#

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 – Total number of shots available for sampling measurements.

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

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