Skip to content

PatchRelation

Bases: Displayable

Runtime data about a relationship between a set of patches, at some point during a program's execution.

Analogous to QECCodePatch's runtime half (.pauli_frame/.data), never to QECCode -- there is no template/instance split here and no Instruction lookup on this class. When a multi-patch operation genuinely needs a physical circuit, it is built directly by an ordinary codepack function, independent of any PatchRelation: a circuit must be fixed at Instruction-build time, before any QuantumProgram/PatchLayout (and therefore any relation) exists, so a relation could never supply one anyway.

data is fully unstructured, with no reserved keys -- exactly like data. patch_labels names the participants by role (e.g. {"ctrl": "L0", "tgt": "L1"}), the same convention InstructionLabel's patch_labels already uses.

Examples:

>>> from loqs.core.recordables import PatchRelation
>>> rel = PatchRelation({"a": "L0", "b": "L1"}, data={"seam_qubits": ["S0", "S1", "S2"]})
>>> rel.patch_labels
{'a': 'L0', 'b': 'L1'}
>>> rel.data["seam_qubits"]
['S0', 'S1', 'S2']

PatchRelation

PatchRelation(patch_labels: Mapping[str, str], data: dict | None = None) -> None

Parameters:

Name Type Description Default
patch_labels Mapping[str, str] required
data dict | None

Tracked relation-specific data dictionary. If provided, it will be deep-copied to ensure independence of the new relation's state.

None

copy

copy() -> 'PatchRelation'

Return a copy of this PatchRelation, deep-copying data.

Returns:

Type Description
PatchRelation

The copied PatchRelation.


decode

Inherited static method from Serializable.decode().


display

Inherited method from Displayable.display().


dump

Inherited method from Serializable.dump().


encode

Inherited static method from Serializable.encode().


load

Inherited class method from Serializable.load().


read

Inherited class method from Serializable.read().


serialize_function

Inherited static method from Serializable.serialize_function().


write

Inherited method from Serializable.write().