quri_parts.core.estimator.sampling.estimator module#

quri_parts.core.estimator.sampling.estimator.sampling_estimate(op: Operator | PauliLabel, state: CircuitQuantumState, total_shots: int, sampler: Callable[[Iterable[tuple[NonParametricQuantumCircuit, int]]], Iterable[Mapping[int, int | float]]], measurement_factory: Callable[[Operator | Iterable[PauliLabel]], Iterable[CommutablePauliSetMeasurement]], shots_allocator: Callable[[Operator, Collection[Set[PauliLabel]], int], Collection[PauliSamplingSetting]]) Estimate[complex]#

Estimate expectation value of a given operator with a given state by sampling measurement.

The sampling measurements are configured with arguments as follows.

Parameters:
  • op – An operator of which expectation value is estimated.

  • state – A quantum state on which the operator expectation is evaluated.

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

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

  • measurement_factory – A function that performs Pauli grouping and returns a measurement scheme for Pauli operators constituting the original operator.

  • shots_allocator – A function that allocates the total shots to Pauli groups to be measured.

Returns:

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

of estimation (can be accessed with error).

quri_parts.core.estimator.sampling.estimator.create_sampling_estimator(total_shots: int, sampler: Callable[[Iterable[tuple[NonParametricQuantumCircuit, int]]], Iterable[Mapping[int, int | float]]], measurement_factory: Callable[[Operator | Iterable[PauliLabel]], Iterable[CommutablePauliSetMeasurement]], shots_allocator: Callable[[Operator, Collection[Set[PauliLabel]], int], Collection[PauliSamplingSetting]]) Callable[[Operator | PauliLabel, CircuitQuantumState], Estimate[complex]]#

Create a QuantumEstimator that estimates operator expectation value by sampling measurement.

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.

  • measurement_factory – A function that performs Pauli grouping and returns a measurement scheme for Pauli operators constituting the original operator.

  • shots_allocator – A function that allocates the total shots to Pauli groups to be measured.

quri_parts.core.estimator.sampling.estimator.concurrent_sampling_estimate(operators: Collection[Operator | PauliLabel], states: Collection[CircuitQuantumState], total_shots: int, sampler: Callable[[Iterable[tuple[NonParametricQuantumCircuit, int]]], Iterable[Mapping[int, int | float]]], measurement_factory: Callable[[Operator | Iterable[PauliLabel]], Iterable[CommutablePauliSetMeasurement]], shots_allocator: Callable[[Operator, Collection[Set[PauliLabel]], int], Collection[PauliSamplingSetting]]) Iterable[Estimate[complex]]#

Estimate expectation value of given operators with given states by sampling measurement.

The sampling measurements are configured with arguments as follows.

Parameters:
  • operators – Operators of which expectation value is estimated.

  • states – Quantum states on which the operator expectation is evaluated.

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

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

  • measurement_factory – A function that performs Pauli grouping and returns a measurement scheme for Pauli operators constituting the original operator.

  • shots_allocator – A function that allocates the total shots to Pauli groups to be measured.

Returns:

The estimated values (can be accessed with value) with standard errors

of estimation (can be accessed with error).

quri_parts.core.estimator.sampling.estimator.create_sampling_concurrent_estimator(total_shots: int, sampler: Callable[[Iterable[tuple[NonParametricQuantumCircuit, int]]], Iterable[Mapping[int, int | float]]], measurement_factory: Callable[[Operator | Iterable[PauliLabel]], Iterable[CommutablePauliSetMeasurement]], shots_allocator: Callable[[Operator, Collection[Set[PauliLabel]], int], Collection[PauliSamplingSetting]]) Callable[[Sequence[Operator | PauliLabel], Sequence[CircuitQuantumState]], Iterable[Estimate[complex]]]#

Create a ConcurrentQuantumEstimator that estimates operator expectation value by sampling measurement.

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.

  • measurement_factory – A function that performs Pauli grouping and returns a measurement scheme for Pauli operators constituting the original operator.

  • shots_allocator – A function that allocates the total shots to Pauli groups to be measured.