quchip.chip.partition

Exact subsystem partitioning — connected components of a chip’s independence graph.

Two device labels share a component when any structural object couples them: a coupling edge, a non-separable bath whose target set contains both, or classical drive crosstalk between lines targeting them. All decisions are made from labels and object presence — never from parameter values, which may be JAX tracers.

When splitting observables via split_e_ops: every user key is resolved and validated up front (duplicate resolved keys and malformed correlator values both raise), then grouped per (component, label) before anything is emitted, so collisions never depend on dict iteration order. A user key whose value is already a list keeps index=None in its LocalEop — the wrapper passes the user’s own indices through unchanged, and any injected factor is appended after them. A scalar local value that collides with one or more factors gets re-indexed to 0, with each factor appended after it in encounter order. The key plan built here is always keyed by the resolved label (or label pair), matching how PartitionedSimulationResult() normalizes lookups — never by the raw user key, which may be an object rather than its label.

The independence graph only recognizes line-mixing as Crosstalk entries: a user-authored SignalTransform that mixes drive lines any other way is invisible to it and must be expressed as Crosstalk for the corresponding devices to land in one component.

Functions

connected_components(labels, edges)

Union-find components, each in labels order, ordered by first member.

independence_edges(chip)

Label pairs that must share one solve.

partition_chip(chip)

Split a chip into independent sub-chips along its independence graph.

split_drive_ops(part, chip, drive_ops)

Route drive ops to their owning component (edge targets via an endpoint).

split_e_ops(part, e_ops)

Distribute dict-form e_ops over components; cross-component correlators become factor pairs.

split_state_mapping(part, mapping)

Distribute a device-keyed state mapping over components.

Classes

CrossEop(a, b)

A cross-component correlator: its two local factors, multiplied at recombine time.

LocalEop(component, key[, index])

Where one user e_ops key landed: component, component-dict key, optional list index.

PartitionComponent(labels, chip)

One independent block: its device labels (chip order) and its solve-ready sub-chip.

PartitionResult(components, chip_order[, notes])

Connected components of a chip's independence graph, as solve-ready sub-chips.

quchip.chip.partition.independence_edges(chip)[source]

Label pairs that must share one solve.

A clique over N labels is emitted as an (N-1)-edge star — identical connected components, fewer edges.

Parameters:

chip (Chip)

Return type:

list[tuple[str, str]]

quchip.chip.partition.connected_components(labels, edges)[source]

Union-find components, each in labels order, ordered by first member.

Parameters:
Return type:

list[list[str]]

class quchip.chip.partition.PartitionComponent(labels, chip)[source]

Bases: object

One independent block: its device labels (chip order) and its solve-ready sub-chip.

Parameters:
labels: tuple[str, ...]
chip: Chip
class quchip.chip.partition.PartitionResult(components, chip_order, notes=())[source]

Bases: object

Connected components of a chip’s independence graph, as solve-ready sub-chips.

chip_order is the parent chip’s original device-label order (its chip.devices order) — not the concatenation of components’ labels, which follows connected-component discovery order instead and can interleave differently whenever a chip’s device order doesn’t already group each component’s members together. Anything that reconstructs a joint state from the per-component pieces (e.g. PartitionedSimulationResult) must permute into chip_order to match the joint solve.

Parameters:
components: tuple[PartitionComponent, ...]
chip_order: tuple[str, ...]
notes: tuple[str, ...] = ()
property is_trivial: bool
owner_of(device)[source]
Parameters:

device (Any)

Return type:

int

quchip.chip.partition.partition_chip(chip)[source]

Split a chip into independent sub-chips along its independence graph.

Exact: the joint solve of the original chip factorizes as the tensor product of the component solves. With one component, the original chip is returned uncloned inside a trivial result.

Parameters:

chip (Chip)

Return type:

PartitionResult

class quchip.chip.partition.LocalEop(component, key, index=None)[source]

Bases: object

Where one user e_ops key landed: component, component-dict key, optional list index.

Parameters:
  • component (int)

  • key (Any)

  • index (int | None)

component: int
key: Any
index: int | None = None
class quchip.chip.partition.CrossEop(a, b)[source]

Bases: object

A cross-component correlator: its two local factors, multiplied at recombine time.

Parameters:
a: LocalEop
b: LocalEop
quchip.chip.partition.split_drive_ops(part, chip, drive_ops)[source]

Route drive ops to their owning component (edge targets via an endpoint).

Parameters:
Return type:

list[list]

quchip.chip.partition.split_e_ops(part, e_ops)[source]

Distribute dict-form e_ops over components; cross-component correlators become factor pairs.

Order-independent by construction: every key is resolved and validated in one pass (PASS 0), grouped per (component, label) in a second pass (PASS 1), and only then emitted (PASS 2) — so no fixup pass over already-built plan entries is ever needed, and dict iteration order cannot change the result.

Parameters:
Return type:

tuple[list[dict], dict]

quchip.chip.partition.split_state_mapping(part, mapping)[source]

Distribute a device-keyed state mapping over components.

Parameters:
Return type:

list[dict]