qarp.devices¶
Devices: architectures, noise models and the compile-for-device pipeline. Public depth: flat. Submodules are private.
- class qarp.devices.Architecture(*args, **kwargs)¶
Bases:
object- property edges¶
Edge list; assigning rebuilds the adjacency indices.
- property n_qubits¶
(self) -> int
- property name¶
(self) -> str
- class qarp.devices.Device(*args, **kwargs)¶
Bases:
object- property architecture¶
(self) -> qarpx.Architecture | None
- property directedness¶
(self) -> bool
- property gate_set¶
(self) -> qarpx.GateSet | None
- property n_qubits¶
(self) -> int
- property noise_model¶
(self) -> qarpx.NoiseModel | None
- class qarp.devices.NoiseModel(_inner: NoiseModel | None = None)[source]¶
Bases:
objectPer-gate noise model attached to a
qarp.devices.Device.Ergonomic builders (
depolarizing(),pauli(),bit_flip(),amplitude_damping()) cover the common cases. Compose with the+operator (right operand wins on collision).The underlying C++ object is reachable via
innerfor callers that need to pass it straight intoqx.QarpSimulator.- Parameters:
_inner – existing
qx.NoiseModelto wrap (internal use). End users construct via the named class methods.
- classmethod amplitude_damping(p: float, gate_set: str | GateSet | Iterable[GateType] | None = '1q') NoiseModel[source]¶
Amplitude damping (T1-like relaxation) of strength
p.
- classmethod bit_flip(p: float, gate_set: str | GateSet | Iterable[GateType] | None = '1q') NoiseModel[source]¶
PauliChannel(p, 0, 0)— flip the qubit with probability p.
- classmethod depolarizing(p: float, gate_set: str | GateSet | Iterable[GateType] | None = '2q') NoiseModel[source]¶
Depolarizing channel of strength
p.1q gates receive
PauliChannel(p/3, p/3, p/3); 2q gates receive the uniform 2q depolarizing (each of the 15 non-identity Paulis with weightp/15).
- property inner: NoiseModel¶
Underlying C++
qx.NoiseModelfor direct simulator use.
- qarp.devices.compile_for_device(*args, router=None)[source]¶
Run check_fits → rebase → route → rebase against a Device.
Two call forms:
compile_for_device(block, device) -> CompiledCircuit compile_for_device(commands, n_qubits, device) -> CompiledCircuit
The block form is a thin wrapper around the commands form: it calls
block.flatten()and readsblock.n_qubitsfor the user.- Parameters:
router – Optional
qx.RouterKindselecting the routing implementation (defaultSabre;qx.RouterKind.Liteis the simpler greedy sweep).
- qarp.devices.get_all_to_all_architecture(n_qubits: int) Architecture[source]¶
All-to-all connectivity (undirected).
- qarp.devices.get_nearest_neighbour_architecture(xdim: int, ydim: int) Architecture[source]¶
Nearest-neighbour grid connectivity (undirected).
- Parameters:
xdim – Number of qubits per row.
ydim – Number of qubits per column.
- Returns:
A
qx.Architecturefor the requested grid.