SamplerBackend#
Module: iqm.qaoa.backends
- class iqm.qaoa.backends.SamplerBackend[source]#
Bases:
objectThe template for sampler backends, i.e., those returning samples from the QAOA.
Methods
Sample bitstrings from the QAOA circuit.
- sample(qaoa_object, shots)[source]#
- sample(qaoa_object, shots)
- sample(qaoa_object, shots)
Sample bitstrings from the QAOA circuit.
This method uses
singledispatchmethod()to dispatch to a type-specific implementation based on the runtime type ofqaoa_object. If no registered implementation matches, it falls back to_sample_unsupported(). Subclasses should override the type-specific private methods rather than this one.- Parameters:
- Returns:
A dictionary of samples. The keys are bitstrings and the values are their counts (which should add up to
shots)- Raises:
TypeError – If no registered implementation exists for the type of
qaoa_object.- Return type:
Inheritance
