cirq_superstaq.sampler
A cirq.Sampler implementation for the Superstaq API.
Classes
A sampler that works against the Superstaq API. Users should get a sampler from the sampler |
Module Contents
- class cirq_superstaq.sampler.Sampler(service: cirq_superstaq.service.Service, target: str)
Bases:
cirq.SamplerA sampler that works against the Superstaq API. Users should get a sampler from the sampler method on cirq_superstaq.Service.
Example:
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
- 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.
- Parameters:
program – The circuit to sample from.
params – The parameters to run with program.
repetitions – The number of times to sample. Defaults to 1.
- Returns:
A list of Cirq results, one for each parameter resolver.