# cirq.PauliSumCollector¶

class cirq.PauliSumCollector(circuit: cirq.Circuit, observable: cirq.PauliSumLike, *, samples_per_term: int, max_samples_per_job: int = 1000000)[source]

Estimates the energy of a linear combination of Pauli observables.

__init__(circuit: cirq.Circuit, observable: cirq.PauliSumLike, *, samples_per_term: int, max_samples_per_job: int = 1000000)[source]
Parameters
• circuit – Produces the state to be tested.

• observable – The pauli product observables to measure. Their sampled expectations will be scaled by their coefficients and their dictionary weights, and then added up to produce the final result.

• samples_per_term – The number of samples to collect for each PauliString term in order to estimate its expectation.

• max_samples_per_job – How many samples to request at a time.

Methods

 collect(sampler, *[, concurrency, …]) Collects needed samples from a sampler. collect_async(sampler, *[, concurrency, …]) Asynchronously collects needed samples from a sampler. Sums up the sampled expectations, weighted by their coefficients. Determines what to sample next. on_job_result(job, result) Incorporates sampled results.