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. The dictionary of counts is obtained from qiskit and then the bitstrings are reversed, so they don’t use the qiskit convention of the first bit being on the right of the bitstring.

Parameters:
  • qaoa_object (QUBOQAOA) – The QUBOQAOA 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]