cosmiq.qiskit#
Qiskit on the digital path (see the Qiskit guide): a Target for a device’s digital
profile on a register, and local SamplerV2 and EstimatorV2 primitives. Needs the extra,
pip install "cosmiq[qiskit]".
from qiskit import transpile
from cosmiq.qiskit import target, SamplerV2, EstimatorV2
tgt = target("cosmiq-ref-1", reg)
qc_t = transpile(qc, target=tgt, optimization_level=2)
SamplerV2(device="cosmiq-ref-1", register=reg, noise=True, seed=7).run([qc_t]).result()
import cosmiq never imports this package (or Qiskit).
Qiskit's |
|
Qiskit's |
|
The |
Classes
- class cosmiq.qiskit.EstimatorV2(*args: Any, session: object = None, **kwargs: Any)#
Bases:
BaseEstimatorV2Qiskit’s
EstimatorV2on the digital path, on this machine (see the Qiskit guide).device,register,seed,max_memory: asSamplerV2’s.noise: False for exact values, True for the trajectory mean and its standard error.trajectories: per parameter point with noise (at least 2; default 4096).default_precision: recorded, never applied (no shot noise).
With
session=(a vqpu:* session orcq.remote.local()) it’s the remote estimator instead:EstimatorV2(session=..., register=..., device=None, seed=None, default_precision=0.05), with shot noise.
- class cosmiq.qiskit.SamplerV2(*args: Any, session: object = None, **kwargs: Any)#
Bases:
BaseSamplerV2Qiskit’s
SamplerV2on the digital path, on this machine (see the Qiskit guide).device: “cosmiq-ref-1” or “cosmiq-ref-1-ideal”;register: the atoms, qubit q on atom q (at most 16).noise: the profile’s Pauli trajectories and readout errors, or none.seed: the root of every draw (None: a fresh one per pub, in its metadata).trajectories: None for one per shot, else at most that many per parameter point.max_memory: a planning budget in bytes for the states that run together, from a memory model; not a bound on the process (default 2 GiB).
Circuits must be native (
cosmiq.qiskit.target), measured at the end only.With
session=(a vqpu:* session orcq.remote.local()) it’s the remote sampler instead:SamplerV2(session=..., register=..., device=None, seed=None, default_shots=None), whose default is the target’s maximum, 1,000 shots.
Functions
- cosmiq.qiskit.target(device: str, register: Register) Target#
The
Targetofdevice‘s digital profile onregister:czon every pair of atoms within itscz_range_um(both orders),randrzon every atom, andmeasure. Qubit q is atom q. With noMove, the coupling is fixed by the register.Refuses a device with no profile (
DIGITAL_DEVICE) and a register of 17 or more atoms (DIGITAL_SIZE).