Weight Distribution and Minimum Weight

The weight distribution of a quantum code Q consists of three separate distributions:

The weight distribution of the stabilizer code S.

The weight distribution of the symplectic dual Sperp of S.

The weight distribution of the codewords in Sperp \ S. Note that this set is not a linear space.

For a quantum code Q with stabilizer code S, the weights of the undetectable errors are the weights of the codewords in Sperp \ S.

For a quantum code to be considered pure, its minimum weight must be less than or equal to the weight of its stabilizer code.

WeightDistribution(Q) : CodeQuantum -> SeqEnum, SeqEnum, SeqEnum
Given a quantum code Q with stabiliser code S, return its weight distribution. Recall that the quantum weight distribution comprises the weight distributions of S, Sperp and Sperp \ S. The function returns each distribution as a separate value. Each weight distribution is returned in the form of a sequence of tuples consisting of a weight and the number of code words of that weight.

Example QECC_QuantWeightDist (H167E19)

Looking at a small quantum code from the database of best known codes. Its first weight distribution is of its stabilizer code S, the second of its normalizer code Sperp, and the final weight distribution is of those non-zero codewords in Sperp \ S.
> F<w> := GF(4);
> Q := QECC(GF(4),6,3);
> Q;
[[6, 3, 2]] Quantum code over GF(2^2), stabilised by:
[  1   0   1   1   1   0]
[  w   w   w   w   w   w]
[  0   1   0   0   0   1]
> WD_S, WD_N, WD := WeightDistribution(Q);
> WD_S eq WeightDistribution(StabiliserCode(Q));
true
> WD_N eq WeightDistribution(NormaliserCode(Q));
true
> WD;
[ <2, 28>, <3, 56>, <4, 154>, <5, 168>, <6, 98> ]
MinimumWeight(Q) : CodeQuantum -> RngIntElt
    Method: MonStgElt                   Default: "Auto"
    RankLowerBound: RngIntElt           Default: 0
    MaximumTime: RngReSubElt            Default: ∞
For the quantum code Q with stabilizer code S, return the minimum weight of Q, which is the minimum weight of the codewords in Sperp \ S. For self-dual quantum codes (those of dimension 0), the minimum weight is defined to be the minimum weight of S. The default algorithm is based on the minimum weight algorithm for classical linear codes which is described in detail in section The Minimum Weight. For a description of the algorithm and its variable argument parameters please consult the full description provided there. The minimum weight may alternatively be calculated by finding the complete weight distribution. This algorithm may be selected by setting the value of the variable argument Method to "Distribution".

Example QECC_QuantMinWeight (H167E20)

The verbose output can be used in long minimum weight calculations to estimate the remaining running time. The algorithm terminates once the lower bound reaches the upper bound. The example below finishes in a very short period of time.
> F<w> := GF(4);
> V5 := VectorSpace(F, 5);
> gens := [V5| [0,0,1,w,w], [0,1,1,w,1], [0,0,1,0,w^2],
>              [0,0,1,w,1], [0,0,1,0,1], [1,w,1,w,w^2],
>              [1,1,1,w^2,w], [0,1,w,1,w^2] ];
> Q := QuantumQuasiCyclicCode(gens : LinearSpan := true);
> Q:Minimal;
[[40, 30]] Quantum code over GF(2^2)
> SetVerbose("Code",true);
> MinimumWeight(Q);
Quantum GF(2)-Additive code over GF(4) of length 40 with 70 generators.
Lower Bound: 1, Upper Bound: 40
Constructed 2 distinct generator matrices
Total Ranks:     35  35
Relative Ranks:  35   5
Time Taken: 0.14
Starting search for low weight codewords... (reset timings)
Enumerating using 1 generator at a time:
     New codeword identified of weight 6, time 0.00
     New codeword identified of weight 4, time 0.00
     Discarding non-contributing rank 5 matrix
     New Total Ranks:     35
     New Relative Ranks:  35
   Completed Matrix  1:  lower =  2, upper =  4. Elapsed: 0.00s
Termination predicted with 3 generators at matrix 1
Enumerating using 2 generators at a time:
   Completed Matrix  1:  lower =  3, upper =  4. Elapsed: 0.00s
Termination predicted with 3 generators at matrix 1
predicting enumerating (1820) 60725 vectors (0.000000
Enumerating using 3 generators at a time:
   Completed Matrix  1:  lower =  4, upper =  4. Elapsed: 0.03s
Final Results: lower = 4, upper = 4, Total time: 0.03
4
IsPure(Q) : CodeQuantum -> BoolElt
Return true if Q is a pure quantum code. That is, if the minimum weight of Q is less than or equal to the minimum weight of its stabiliser code.

Example QECC_QECC-IsPure (H167E21)

Many good codes are impure, the purity of best known quantum codes of length 15 are investigated.
> F<w> := GF(4);
> n := 15;
> time {* IsPure(QECC(F, n, k)) : k in [1..n] *};
{* false^^10, true^^5 *}
Time: 0.410
V2.28, 13 July 2023