types

Contents

types#

Full path: iqm.qrisp_iqm.passes.routing.core.types

Dynamic index-type selection for plasma-sabre routing passes.

Provides a single source of truth for choosing the narrowest numpy integer dtype that can safely represent a given index range. All data structures (coupling topology, instruction DAGs, layout permutations, depth trackers, etc.) should derive their dtype from the functions in this module rather than hard-coding np.int32.

Rationale#

Plasma-sabre targets NISQ devices (< 32 768 qubits). Quantum circuits are expected to contain fewer than 32 768 two-qubit gates before decoherence destroys any meaningful entanglement. Under these assumptions all index values fit into np.int16, which doubles cache-line density compared to np.int32 and substantially improves ALU throughput in the hot SABRE metric loop.

Functions

data_dtype(n_physical, n_nodes)

Return dtype for instruction_data (Mx3) arrays.

index_dtype(max_value)

Return the narrowest numpy signed-integer dtype for the given range.

node_dtype(n_nodes)

Return dtype suitable for per-DAG-node data structures.

qubit_dtype(n_physical)

Return dtype suitable for per-qubit data structures.