qldpc.objects

Instrumental objects used to construct error-correcting codes.

Attributes

PAULIS_XZ

PauliXZ

Classes

CayleyComplex

Left-right Cayley complex, used for constructing quantum Tanner codes.

ChainComplex

Chain complex: a sequence modules with "boundary operators" that map between them.

Node

Node in a Tanner graph.

Pauli

Pauli operators.

QuditPauli

A qudit operator of the form X(val_x)*Z(val_z).

Module Contents

class qldpc.objects.CayleyComplex(subset_a: collections.abc.Collection[qldpc.abstract.GroupMember], subset_b: collections.abc.Collection[qldpc.abstract.GroupMember] | None = None, *, bipartite: bool = False)[source]

Left-right Cayley complex, used for constructing quantum Tanner codes.

A Cayley complex is a geometric structure that is built out of two subsets A and B of a group G. The subsets respectively act on elements of G from the left and right, and must be symmetric, which is to say (for example) that if a ∈ A, then a^-1 ∈ A.

The generating data (A,B) is used to build vertices V, edges E, and faces F as follows:

  • vertices are members of G,

  • edges have the form (g, ag) and (g, gb), and

  • faces f(g,a,b) have the form {g, ab, gb, agb}:

     g  →  gb
     ↓     ↓
    ag  → agb
    

If the complex is disconnected, we keep only the component connected to the identity element.

After constructing the complex (V,E,F), we can define two bipartite directed graphs:

  • subgraph_x with edges ( g, f(g,a,b)), and

  • subgraph_z with edges (ag, f(g,a,b)).

These graphs are used to construct classical Tanner codes that serve as the X and Z sectors of a quantum CSS code known as a quantum Tanner code.

There are, however, two complications to keep in mind. First, in order for the faces to be nondegenerate (that is, for each face to contain four vertices), the generating data (A,B) must satisfy the Total No Conjugacy condition:

[1] ag != gb for all g,a,b in (G,A,B).

Second, in order to construct a valid quantum Tanner code out of subgraph_x and subgraph_z, the graph (V,E) must be bipartite, V = V_0 ∪ V_1, such that (for example) nodes {g, agb} are in one partition, while nodes {ag, gb} are in the other partition. The nodes V_0 and V_1 are then used as the source nodes of subgraph_x and subgraph_z. The graph (V,E) is bipartite if:

[2] The Cayley graphs (G;A) and (G;B) both are bipartite.

The Cayley graphs (G;A) and (G;B) are graphs whose

  • vertices are members of G, and

  • edges are pairs of vertices connected by A or B, as in (g, ag) or (g, gb).

In fact, condition [2] can be enforced at no added cost by taking the double cover of G and modifying members of A and B as:

  • G --> G ⨂ Z_2,

  • a --> (a,1), and

  • b --> (b,1),

where Z_2 ~ {0,1} is the 2-element group (under addition), such that (a,1) * (g,i) = (ag,i+1) and (g,i) * (b,1) = (gb,i+1). The complex generated by A and B after this modification is the “bipartite” Cayley complex constructed in https://arxiv.org/abs/2202.13641.

If requirement [1] is not satisfied, then we can construct a “quadripartite” complex that enforces [1] and [2] by taking the quadruple cover of G and modifying members of A and B as:

  • G --> G ⨂ Z_2 ⨂ Z_2,

  • a --> (a,1,0), and

  • b --> (b,0,1),

where similarly to before (a,1,0) * (g,i,j) = (ag,i+1,j) and (g,i,j) * (b,0,1) = (gb,i,j+1). This modification of A and B corresponds to the “quadripartite” Cayley complex constructed in https://arxiv.org/abs/2206.07571.

References:

static build_cayley_graph(subset_a: collections.abc.Collection[qldpc.abstract.GroupMember], subset_b: collections.abc.Collection[qldpc.abstract.GroupMember] = ()) → qldpc._util.networkx.Graph[source]

Build a left-right Cayley graph generated from the identity element of a group.

cover_subset_a() → set[qldpc.abstract.GroupMember]

Subset induced by taking the double cover(s) of the group for this complex.

cover_subset_b() → set[qldpc.abstract.GroupMember]

Subset induced by taking the double cover(s) of the group for this complex.

graph() → qldpc._util.networkx.Graph

Graph consisting of the nodes and edges of the complex.

static satisfies_total_no_conjugacy(subset_a: collections.abc.Collection[qldpc.abstract.GroupMember], subset_b: collections.abc.Collection[qldpc.abstract.GroupMember]) → bool[source]

Check the Total No-Conjugacy condition: aa gg != gg bb for all gg, aa, bb.

bipartite: bool
subset_a: set[qldpc.abstract.GroupMember]
subset_b: set[qldpc.abstract.GroupMember]
class qldpc.objects.ChainComplex(ops: collections.abc.Sequence[numpy.typing.NDArray[numpy.int_] | qldpc.abstract.RingArray], field: int | type[galois.FieldArray] | None = None, *, skip_validation: bool = False)[source]

Chain complex: a sequence modules with “boundary operators” that map between them.

An n-chain complex with modules (A_0, A_1, …, A_n) can be written as

{} <--[d_0] A_0 <--[d_1] A_1 <-- ... <--[d_n] A_n <--[d_{n+1}] {}

Here j is called the “degree” of A_j, and d_j : A_j --> A_{j-1} is a “boundary operator” or “differential”. Neighboring boundary operators annihilate, in the sense that d_{j-1} d_j = 0.

In practice, we represent a chain complex by the boundary operators (d_1, d_2, …, d_n), which are in turn represented by matrices over (i) a finite field, or (ii) a group algebra. The boundary operators d_0 and d_{n+1} are formally treated as 0 × dim(A_0) and dim(A_n) × 0 matrices.

References:

dim(degree: int) → int[source]

The dimension of the module of the given degree.

op(degree: int) → numpy.typing.NDArray[numpy.int_] | qldpc.abstract.RingArray[source]

The boundary operator of this chain complex that acts on the module of a given degree.

static tensor_product(chain_a: ChainComplex | numpy.typing.NDArray[numpy.int_] | qldpc.abstract.RingArray, chain_b: ChainComplex | numpy.typing.NDArray[numpy.int_] | qldpc.abstract.RingArray, field: int | type[galois.FieldArray] | None = None) → ChainComplex[source]

Tensor product of two chain complexes.

The tensor product of chain complexes C_A and C_B, respectively with modules (A_0, A_1, …) and (B_0, B_1, …), is a new chain complex C_P with modules (P_0, P_1, …). The module P_k of degree k can be written as a direct sum of tensor products A_i ⨂ B_j for which i+j=k, that is:

[1] P_k = ⨁_{i+j=k} A_i ⨂ B_j.

Elements of P_2, for example, can be written as vectors [a_2 ⨂ b_0, a_1 ⨂ b_1, a_0 ⨂ b_2], that concatenate different a_i ⨂ b_j ∈ A_i ⨂ B_j.

The boundary operator d_k in C_P is defined by its action on each “sector” (i, j), namely

[2] d_{i+j}(a_i ⨂ b_j) = d_i^A(a_i) ⨂ b_j + (-1)^i a_i ⨂ d_j^B(b_j),

where d_i^A and d_j^B are boundary operators of C_A and C_B.

In practice, to construct a boundary operator d_k we build a block matrix whose rows and columns correspond, respectively, to sectors of P_{k-1} and P_k. We then populate this block matrix by the maps between sectors of P_k and P_{k-1} that are induced by the definition of d_{i+j}.

property T: ChainComplex

Transpose and reverse the order of the boundary operators in this chain complex.

property field: type[galois.FieldArray]

The base field of this chain complex.

The number of “internal” links in this chain complex.

property ops: tuple[numpy.typing.NDArray[numpy.int_] | qldpc.abstract.RingArray, ...]

The boundary operators of this chain complex.

property ring: qldpc.abstract.GroupRing | None

The base ring of this chain complex.

class qldpc.objects.Node[source]

Node in a Tanner graph.

A node is essentially an integer index, together with a boolean flag to distinguish “data” node from a “check” node in an error-correcting code.

index: int
is_data: bool = True
class qldpc.objects.Pauli(*args, **kwds)[source]

Bases: enum.Enum

Pauli operators.

static from_string(string: str) → Pauli[source]

Build a Pauli operator from a string.

swap_xz() → PauliXZ[source]

Convert between Pauli.X and Pauli.Z, promising a PauliXZ return type (or an error).

I = (0, 0)
X = (1, 0)
Y = (1, 1)
Z = (0, 1)
property index: int

Numerical index for Pauli operators.

class qldpc.objects.QuditPauli[source]

A qudit operator of the form X(val_x)*Z(val_z).

static from_string(string: str) → QuditPauli[source]

Build a qudit operator from its string representation.

value: tuple[int, int] = (0, 0)
qldpc.objects.PAULIS_XZ: list[PauliXZ]
qldpc.objects.PauliXZ