graphix.flow.exceptions module¶
Module for flows and XZ-corrections exceptions.
- class FlowPropositionErrorReason(*values)[source]¶
Bases:
EnumDescribe the reason of a
FlowPropositionErrorexception.- C0 = 1¶
A correction set in a causal flow has more than one element.
- C1 = 2¶
Causal flow (C1). A node and its corrector must be neighbors.
- G3 = 3¶
Gflow (G3). Nodes measured on plane XY cannot be in their own correcting set and must belong to the odd neighbourhood of their own correcting set.
- G4 = 4¶
Gflow (G4). Nodes measured on plane XZ must belong to their own correcting set and its odd neighbourhood.
- G5 = 5¶
Gflow (G5). Nodes measured on plane YZ must belong to their own correcting set and cannot be in the odd neighbourhood of their own correcting set.
- P4 = 6¶
Pauli flow (P4). Equivalent to (G3) but for Pauli flows.
- P5 = 7¶
Pauli flow (P5). Equivalent to (G4) but for Pauli flows.
- P6 = 8¶
Pauli flow (P6). Equivalent to (G5) but for Pauli flows.
- P7 = 9¶
Pauli flow (P7). Nodes measured along axis X must belong to the odd neighbourhood of their own correcting set.
- P8 = 10¶
Pauli flow (P8). Nodes measured along axis Z must belong to their own correcting set.
- P9 = 11¶
Pauli flow (P9). Nodes measured along axis Y must belong to the closed odd neighbourhood of their own correcting set.
- class FlowPropositionOrderErrorReason(*values)[source]¶
Bases:
EnumDescribe the reason of a
FlowPropositionOrderErrorexception.- C2 = 1¶
Causal flow (C2). Nodes must be in the past of their correction set.
- C3 = 2¶
Causal flow (C3). Neighbors of the correcting nodes (except the corrected node) must be in the future of the corrected node.
- G1 = 3¶
Gflow (G1). Equivalent to (C2) but for gflows.
- G2 = 4¶
Gflow (G2). The odd neighbourhood (except the corrected node) of the correcting nodes must be in the future of the corrected node.
- P1 = 5¶
Pauli flow (P1). Nodes must be in the past of their correcting nodes that are not measured along the X or the Y axes.
- P2 = 6¶
Pauli flow (P2). The odd neighbourhood (except the corrected node and nodes measured along axes Y or Z) of the correcting nodes must be in the future of the corrected node.
- P3 = 7¶
Pauli flow (P3). Nodes that are measured along axis Y and that are not in the future of the corrected node (except the corrected node itself) cannot be in the closed odd neighbourhood of the correcting set.
- class FlowGenericErrorReason(*values)[source]¶
Bases:
EnumDescribe the reason of a
FlowGenericError.- IncorrectCorrectionFunctionDomain = 1¶
The domain of the correction function is not the set of non-output nodes (measured qubits) of the open graph.
- IncorrectCorrectionFunctionImage = 2¶
The image of the correction function is not a subset of non-input nodes (prepared qubits) of the open graph.
- XYPlane = 3¶
A causal flow is defined on an open graphs with non-XY measurements.
- NoPauliFlow = 4¶
the GF(2) system that reconstructs the correction function has no solution for at least one measured node.
- Type:
No Pauli flow is compatible with the given XZ-corrections
- class XZCorrectionsOrderErrorReason(*values)[source]¶
Bases:
EnumDescribe the reason of an
XZCorrectionsOrderErrorexception.- X = 1¶
An X-correction set contains nodes in the present or the past of the corrected node.
- Z = 2¶
An X-correction set contains nodes in the present or the past of the corrected node.
- class XZCorrectionsGenericErrorReason(*values)[source]¶
Bases:
EnumDescribe the reason of an
XZCorrectionsGenericError.- IncorrectKeys = 1¶
Keys of correction dictionaries are not a subset of the measured nodes.
- IncorrectValues = 2¶
Values of correction dictionaries contain labels which are not nodes of the open graph.
- ClosedLoop = 3¶
XZ-corrections are not runnable since the induced directed graph contains closed loops.
- IncompatibleOrder = 4¶
The input total measurement order is not compatible with the partial order induced by the XZ-corrections.
- class PartialOrderErrorReason(*values)[source]¶
Bases:
EnumDescribe the reason of a
PartialOrderErrorexception.- Empty = 1¶
The partial order is empty and the open graph is not.
- IncorrectNodes = 2¶
The partial order does not contain all the nodes of the open graph or contains nodes that are not in the open graph.
- class PartialOrderLayerErrorReason(*values)[source]¶
Bases:
EnumDescribe the reason of a
PartialOrderLayerErrorexception.- FirstLayer = 1¶
The first layer of the partial order is not the set of output nodes (non-measured qubits) of the open graph or is empty.
- NthLayer = 2¶
Nodes in the partial order beyond the first layer are not non-output nodes (measured qubits) of the open graph, layer is empty or contains duplicates.
- exception XZCorrectionsError[source]¶
Bases:
ExceptionException subclass to handle XZ-corrections errors.
- exception FlowPropositionError(reason: FlowPropositionErrorReason, node: int, correction_set: AbstractSet[int])[source]¶
Bases:
FlowErrorException subclass to handle violations of the flow-definition propositions which concern the correction function only (C0, C1, G1, G3, G4, G5, P4, P5, P6, P7, P8, P9).
- __init__(reason: FlowPropositionErrorReason, node: int, correction_set: AbstractSet[int]) None¶
- reason: FlowPropositionErrorReason¶
- exception FlowPropositionOrderError(reason: FlowPropositionOrderErrorReason, node: int, correction_set: AbstractSet[int], past_and_present_nodes: AbstractSet[int])[source]¶
Bases:
FlowErrorException subclass to handle violations of the flow-definition propositions which concern the correction function and the partial order (C2, C3, G1, G2, P1, P2, P3).
- __init__(reason: FlowPropositionOrderErrorReason, node: int, correction_set: AbstractSet[int], past_and_present_nodes: AbstractSet[int]) None¶
- reason: FlowPropositionOrderErrorReason¶
- exception FlowGenericError(reason: FlowGenericErrorReason)[source]¶
Bases:
FlowErrorException subclass to handle generic flow errors.
- __init__(reason: FlowGenericErrorReason) None¶
- reason: FlowGenericErrorReason¶
- exception PartialOrderError(reason: PartialOrderErrorReason)[source]¶
Bases:
FlowError,XZCorrectionsErrorException subclass to handle general flow and XZ-corrections errors in the partial order.
- __init__(reason: PartialOrderErrorReason) None¶
- reason: PartialOrderErrorReason¶
- exception PartialOrderLayerError(reason: PartialOrderLayerErrorReason, layer_index: int, layer: AbstractSet[int])[source]¶
Bases:
FlowError,XZCorrectionsErrorException subclass to handle flow and XZ-corrections errors concerning a specific layer of the partial order.
- __init__(reason: PartialOrderLayerErrorReason, layer_index: int, layer: AbstractSet[int]) None¶
- reason: PartialOrderLayerErrorReason¶
- exception XZCorrectionsOrderError(reason: XZCorrectionsOrderErrorReason, node: int, correction_set: AbstractSet[int], past_and_present_nodes: AbstractSet[int])[source]¶
Bases:
XZCorrectionsErrorException subclass to handle incorrect XZ-corrections objects where the error concerns the correction dictionaries and the partial order.
- __init__(reason: XZCorrectionsOrderErrorReason, node: int, correction_set: AbstractSet[int], past_and_present_nodes: AbstractSet[int]) None¶
- reason: XZCorrectionsOrderErrorReason¶
- exception XZCorrectionsGenericError(reason: XZCorrectionsGenericErrorReason)[source]¶
Bases:
XZCorrectionsErrorException subclass to handle generic flow errors.
- __init__(reason: XZCorrectionsGenericErrorReason) None¶
- reason: XZCorrectionsGenericErrorReason¶