PySparQ.pysparq.register_layout

Logical registers backed by multiple native words, without truncating high bits.

The C++ machine-word ABI stays intact. Every bit operation still executes on the real sparse-state backend; logical values are reconstructed as Python ints.

Attributes

Classes

RegisterLayout

Own logical register allocations in one native SparseState.

Functions

register_bits(name, width) → list[tuple[str, int]]

Resolve one logical register to little-endian native bit coordinates.

Module Contents

class PySparQ.pysparq.register_layout.RegisterLayout(state: Any)[source]

Own logical register allocations in one native SparseState.

add returns bit coordinates accepted by native gate operators. value reads a complete logical word from a basis state, including every high word. Names must be distinct within the process-global native register namespace.

add(name: str, kind: Any, width: int) → list[tuple[str, int]][source]
bits(name: str) → list[tuple[str, int]][source]
remove(name: str, *, require_zero: bool = True) → None[source]
value(name: str, basis: Any) → int[source]
state[source]
widths: dict[str, int][source]
words: dict[str, tuple[tuple[str, int], ...]][source]
PySparQ.pysparq.register_layout.register_bits(name: str, width: int) → list[tuple[str, int]][source]

Resolve one logical register to little-endian native bit coordinates.

PySparQ.pysparq.register_layout.WORD_BITS = 64[source]