SamplerResonance

SamplerResonance#

class iqm.qaoa.backends.SamplerResonance(token, server_url='https://cocos.resonance.meetiqm.com/garnet', transpiler='SparseTranspiler')[source]#

Bases: SamplerBackend

A sampler that runs the circuit on IQM Resonance and returns the result.

Parameters:
  • token (str) – The API token to be used to connect to IQM Resonance.

  • server_url (str) – The URL to the quantum computer (defaults to Garnet).

  • transpiler (str) – The transpiling strategy to be used when building the quantum circuit for the QC. Defaults to “SparseTranspiler”

Methods

sample(qaoa_object, shots)

Samples from the QAOA on a quantum computer via IQM Resonance.

sample(qaoa_object, shots)[source]#

Samples from the QAOA on a quantum computer via IQM Resonance.

First, it creates a QuantumCircuit (using a custom transpilation approach) and then sends it to IQM Resonance.

Parameters:
  • qaoa_object (QAOA) – The QAOA object, to be sampled from.

  • shots (int) – The number of samples (measurements) to take.

Returns:

A dictionary whose keys are the measured bitstrings and values their frequencies in the results.

Return type:

dict[str, int]