Infleqtion / qLDPC

Tools for constructing and analyzing quantum low density parity check (qLDPC) codes.
Apache License 2.0
74 stars 8 forks source link

Generalize calculation of logical qubit operators to the qudit case #12

Closed perlinm closed 8 months ago

perlinm commented 8 months ago

More or less the same algorithm as before works, but now rather than looking for anti-commutation between X-type and Z-type logical operators, we look for the condition that X(1)*Z(1) = w*Z(1)*X(1), where w = exp(2 pi i / q) for a q-dimensional qudit.

If we consider the generalized n-qudit Pauli strings X(a) and Z(b), where now a and b are vectors in F_q^n and (say) X(a) = \bigotimes_j X^{a_j}, then the requirement X(a)*Z(b) = w*Z(b)*X(a) implies a @ b = 1.

Once we can construct logical operators, we can also compute exact code distance with an integer linear program (in the case of prime number fields).

perlinm commented 8 months ago

~TODO: fix failing flake8 complexity check~

After playing around with various ways to fix the failing complexity check on CSSCode.get_logical_ops, I decided that fixes to this failing check largely have the effect of making the method less human-readable and more difficult to understand. I therefore opted to simply ignore the complexity check for this method.

mittaltushant commented 8 months ago

More or less the same algorithm as before works, but now rather than looking for anti-commutation between X-type and Z-type logical operators, we look for the condition that X(1)*Z(1) = w*Z(1)*X(1), where w = exp(2 pi i / q) for a q-dimensional qudit.

If we consider the generalized n-qudit Pauli strings X(a) and Z(b), where now a and b are vectors in F_q^n and (say) X(a) = \bigotimes_j X^{a_j}, then the requirement X(a)*Z(b) = w*Z(b)*X(a) implies a @ b = 1.

Once we can construct logical operators, we can also compute exact code distance with an integer linear program (in the case of prime number fields).

Can it not be that we have 'X(1)Z(1) = w^cZ(1)*X(1)' for 0 < c < q? and thus we should actually check for a @ b \neq 0 ?

perlinm commented 8 months ago

From their definition, X(r)*Z(s) = w^{r*s}*Z(s)*X(r) for r,s\in F_q. We only need to find the case of r == s == 1 because as long as we know (say) X(1), then we can find all X(r) = X(1)^r.

Having said that, I realize now that that a @ b == 1 is necessary but not sufficient for X(a) and Z(b) to be logical X_L(1) and Z_L(1) operators, because it only implies that these operators are some X_L(r) and Z_L(s) with r * s == 1, but when (say) q == 3 that also occurs for (r, s) == (2, 2). So we need some other condition to isolate (r, s) == (1, 1)...

perlinm commented 8 months ago

Ah: I am confusing how addition and multiplication work in Z_p vs GF(p^m), which made me concerned about finding an operator that "looks like" X_L(2); in turn, I was worried that X_L(2) would not generate all X-type operators for a (logical) qudit. In fact any X-type logical operator will generate all other X-type logical operators (for a single logical qudit), so as long as I find one such operator I am free to call it "X_L(1)".

So in total I think that the current method of operator construction in this PR is correct.

I think it is sill important that a @ b == 1 and not some other value, though, because X_L(1) still needs to be "paired up" with Z_L(1). In other words, once I pick an operator to call X_L(1), there is a meaningful distinction between Z_L(1) and Z_L(2), which have different commutation relationships with X_L(1) (even though either Z-type operator will generate all Z-type operators).

perlinm commented 8 months ago

Leaving this image here (below) to document the rationale behind this code

image

Here x and z are op_x and op_z, i.e. the support of logical X(1) and Z(1) operators for one of the logical qudits