cirq_superstaq.sampler ====================== .. py:module:: cirq_superstaq.sampler .. autoapi-nested-parse:: A `cirq.Sampler` implementation for the Superstaq API. Classes ------- .. autoapisummary:: cirq_superstaq.sampler.Sampler Module Contents --------------- .. py:class:: Sampler(service: cirq_superstaq.service.Service, target: str) Bases: :py:obj:`cirq.Sampler` A sampler that works against the Superstaq API. Users should get a sampler from the `sampler` method on `cirq_superstaq.Service`. Example: .. code-block:: python service = cirq_superstaq.Service( "Insert superstaq token that you received from https://superstaq.infleqtion.com" ) q0, q1 = cirq.LineQubit.range(2) sampler = service.sampler("ibmq_brisbane_qpu") circuit = cirq.Circuit(cirq.H(q0), cirq.CNOT(q0, q1), cirq.measure(q0)) print(sampler.sample(circuit, repetitions=5)) q(0) 0 0 1 0 2 0 3 1 4 1 .. py:method:: run_sweep(program: cirq.AbstractCircuit, params: cirq.Sweepable, repetitions: int = 1) -> list[cirq.ResultDict] Runs a sweep for the given circuit. .. note:: This creates jobs for each of the sweeps in the given sweepable, and then blocks until all of jobs are complete. :param program: The circuit to sample from. :param params: The parameters to run with program. :param repetitions: The number of times to sample. Defaults to 1. :returns: A list of Cirq results, one for each parameter resolver.