tqecd.flow.build_flows_from_fragments#
- build_flows_from_fragments(fragments: Sequence[Fragment | FragmentLoop]) list[FragmentFlows | FragmentLoopFlows] [source]#
Compute and return the stabilizer flows of the provided fragments.
This function ensures that the returned list will have the same “shape” as the input one. In more details, that means that the following property should be checked (recursively if there is any FragmentLoop instance in the provided fragments):
fragments: list[Fragment | FragmentLoop] = [] # anything here flows = build_flows_from_fragments(fragments) for frag, flow in zip(fragments, flows): assert (isinstance(frag, Fragment) and isinstance(flow, FragmentFlow)) or ( isinstance(frag, FragmentLoop) and isinstance(flow, FragmentLoopFlow) )
- Parameters:
fragments – the fragments composing the circuit to study and for which this function should compute flows.
- Returns:
the computed flows for each of the provided fragments.