qrunch.quantum.samplers.sampler

Base class for samplers.

Classes

Sampler

Sampler class for sampling from a quantum circuit.

class Sampler

Bases: ABC

Sampler class for sampling from a quantum circuit.

clear_cache() None

Clear the measurement cache.

Return type:

None

run(circuits: MeasurementCircuit) QuantumMeasurement
run(circuits: Sequence[MeasurementCircuit]) list[QuantumMeasurement]

Start job for sampling on the given circuits a given number of times.

Parameters:

circuits (MeasurementCircuit | Sequence[MeasurementCircuit]) – Measurement circuit or sequence of circuits to be sampled.

Return type:

QuantumMeasurement | list[QuantumMeasurement]

abstractmethod validate_shots_type(shots_type: Type[int | None]) list[str]

Validate that the sampler supports the given shots type. Return a list of error messages if not supported.

Parameters:

shots_type (Type[int | None])

Return type:

list[str]