loom.eka.circuit_algorithms
Copyright (c) Entropica Labs Pte Ltd 2025.
Use, distribution and reproduction of this program in its source or compiled form is prohibited without the express written consent of Entropica Labs Pte Ltd.
- loom.eka.circuit_algorithms.cardinal_circuit(t_graph)[source]
Computes the entangling layer order for a HGP code specified through a Tanner graph with cardinal edge labelling. This layering is obtained by the cardinal circuit algorithm described in arXiv:2109.14609. Importantly, the ordering over which the cardinalities are examined is CRUCIAL for commutation relations. Here it has been fixed to [“E”, “N”, “S”, “W”]. Only a subset of permutations from this order will ensure proper commutation of stabilizers.
The function returns a dictionary, where the keys correspond to each check nodes associated with a Stabilizer, and the values are the lists of data qubit channels in the precise order in which the entangling gates should be applied. Idling steps are added when ancillas do not participate in a given time step.
- Parameters:
t_graph (TannerGraph) – Tanner graph associated with the corresponding HGP code.
- Returns:
check_to_data – Dictionary mapping check nodes to lists of data nodes, properly ordered for entangling operations.
- Return type:
dict[tuple[int,int],list[tuple[int,int]]]
- loom.eka.circuit_algorithms.coloration_circuit(t_graph)[source]
Computes the entangling layer order for a CSS code specified through a Tanner graph. This layering is obtained by the coloration circuit algorithm described in arXiv:2109.14609. In summary, the algorithm measures X and Z stabilizers in sequence, but optimizes the circuit depth for each type. This is done by extracting the X and Z subcomponents of the Tanner graph, and by obtaining a minimum edge coloring for each one. The sequence of entangling gates then corresponds to all the edges in each coloring layer, and then switching to the stabilizer type once the first component has been exhausted. Since the Tanner Graph is bipartite, this approach results in an upper bound of of max(deg(t_graph_x)) + max(deg(t_graph_z)) for the total number of entangling layers, where t_graph_x and t_graph_z are the X and Z tanner subcomponents, respectively.
The function returns a dictionary, where the keys correspond to each check nodes associated with a Stabilizer, and the values are the lists of data qubit channels in the precise order in which the entangling gates should be applied. Idling steps are added for Z(X) checks when the entangling gates between X(Z) ancillas and datas take place.
- Parameters:
t_graph (TannerGraph) – Tanner graph associated with a CSS code.
- Returns:
check_to_data – Dictionary mapping check nodes to lists of data nodes, properly ordered for entangling operations.
- Return type:
dict[tuple[int,…],list[tuple[int,…]]]
- loom.eka.circuit_algorithms.extract_syndrome_circuit(pauli, entangling_order)[source]
Generate the syndrome extraction circuit for a given stabilizer.
- Parameters:
pauli (str) – The Pauli string defining the stabilizer.
entangling_order (list[tuple[int,...]]) – The order in which data qubits are entangled with the ancilla qubit.
- Returns:
The syndrome extraction circuit for the given stabilizer.
- Return type:
- loom.eka.circuit_algorithms.generate_stabilizer_and_syndrome_circuits_from_algorithm(t_graph, algorithm)[source]
Generates stabilizers and syndrome circuits for a Tanner graph t_graph using the a supported circuit algorithm such as the cardinal or the coloration algorithms.
- Parameters:
t_graph (TannerGraph) – Tanner graph associated with the code.
algorithm (str) – Algorithm to be used to find the entangling schedule.
- Returns:
A list of Stabilizer objects describing the code and alist of associated SyndromeCircuit objects.
- Return type:
tuple[list[Stabilizer], list[SyndromeCircuit]]