device_connectivity

Classes to describe the connectivity of quantum devices.

Connectivities are defined between qubits on a device. If two or more qubits are connected, the device supports an operation on this set of qubits.

class parityos.devices.device_connectivity.Connection(qubits: QubitT_co | Iterable[QubitT_co])

Bases: Generic[QubitT_co]

A connection between qubits in terms of a set of the qubits which share the connection.

qubits: frozenset[QubitT_co]

Qubits that make up this connection.

__len__() int

The number of qubits in this connection.

class parityos.devices.device_connectivity.DeviceConnectivity(qubit_connections: Iterable[Connection[QubitT]] | Iterable[Iterable[QubitT]])

Bases: Generic[QubitT_co]

Class for modeling the connectivity of quantum hardware as a set of qubit Connection instances.

Qubit connections represent groups of qubits which can interact by applying multi-qubit gates on them. Single-qubit capabilities are automatically assumed.

qubit_connections: frozenset[Connection[QubitT_co]]

Device connections describing direct interactions available on the device.

qubits: frozenset[QubitT_co]

All qubits on the device that are part of any device connection as a frozenset.

connections_with_n_qubits(n_qubits: int) frozenset[Connection[QubitT_co]]

Get connections with a certain number of qubits.

Parameters:

n_qubits – the number of qubits for which connections are returned.

Returns:

All connections on the device that have n_qubits qubits.

parityos.devices.device_connectivity.get_rectangular_nearest_neighbor_connectivity(length: int, width: int) DeviceConnectivity[Qubit[Point2D[int]]]

Create the DeviceConnectivity for a rectangular grid device with nearest-neighbor two-qubit connections according to the length and width of the device.

Parameters:
  • length – integer length of the rectangular device.

  • width – integer width of the rectangular device.

Returns:

The constructed rectangular nearest-neighbor connectivity for a device of size length times height.

parityos.devices.device_connectivity.get_rectangular_plaquette_connectivity(length: int, width: int, include_triangles: bool = True) DeviceConnectivity[Qubit[Point2D[int]]]

Create the DeviceConnectivity for a rectangular grid device with quadratic four-qubit nearest-neighbor plaquette connections and (optionally) three-qubit triangle nearest-neighbor connections according to the length and width of the device.

Parameters:
  • length – integer length of the rectangular device.

  • width – integer width of the rectangular device.

  • include_triangles – whether to include triangle plaquettes. Defaults to True.

Returns:

The constructed rectangular plaquette connectivity for a device of size length times

height.