Generalized Hamming Weights for Linear Codes

Iskra N´u˜nez Estefan Ortiz University of Texas at El Paso St. Mary’s University Alicia Urdapilleta Mills College

July 27, 2001

Abstract Error control codes are widely used to increase the reliability of transmission of information over various forms of communications channels. The Hamming weight of a codeword is the number of nonzero entries in the word; the weights of the words in a linear code determine the error-correcting capacity of the code. th The r generalized Hamming weight for a linear code , denoted by dr(C), is the minimum of the support sizes for r-dimensional subcodes of C. For instance, d1(C) equals the traditional minimum Hamming weight of C. In 1991, Feng, Tzeng, and Wei proved that the second generalized Hamming weight d2(C) = 8 m for all double-error correcting BCH(2 , 5) codes. We study d3(C) and higher Hamming weights for BCH(2m, 5) codes by a close examination of the words of weight 5.

1 Introduction

The generalized Hamming weights of a linear code were introduced by Wei in 1991. The rth generalized Hamming weight is, by definition, the minimum support size of r- dimensional subcodes of C. Soon after, Feng, Tzeng, and Wei studied the generalized Hamming weights for BCH and other cyclic codes. They showed in particular that the second generalized Hamming weight of the double-correcting binary BCH(2m, 5) codes is d2 = 8. They accomplished this by studying the subspaces generated by pairs of words of weight five in the code. Motivated by these findings, in this paper we continue the study of the dr(C) for C = BCH(2m, 5), by considering the cases r ≥ 3. First, we review several basic properties of the generalized weights (Theorems 1,2,3 below) which help us to understand dr(C) for linear codes. Using these theorems, we develop algorithms that allow us to compute the complete weight hierarchies of several classes of codes such as the binary Hamming and Golay codes. We then turn our attention to the BCH(2m, 5) codes and prove a result (Theorem 6) that counts the words of weight 5 with ones in two specified locations in the case of odd m. By considering the possible overlaps of

35 the positions of the 1’s in sets of three words of weight 5, we deduce that d3(C) = 10 for the BCH(2m, 5) codes with r ≥ 4. Finally, we look into the higher generalized Hamming weighs of the BCH(2m, 5) codes and propose questions for further research.

2 Basic Properties

Our focus is linear binary codes. We begin by stating the some fundamental properties and definitions. Definition 1 Let C be an [n, k] code with D ⊂ C a subcode. The support of D, denoted χ(D), is the set of not-always-zero positions of D, i.e.,

χ(D) := {i : ∃(x1, x2, ··· , xn) ∈ D, xi 6= 0} Using this definition, an [n, k] code is a binary linear code of rank k and support size ≤ n. The rank is the number of non-zero linearly independent rows of a matrix.

Example 1. Let C = h10011, 01010, 00101i. The matrix  1 0 0 1 1  G =  0 1 0 1 0  0 0 1 0 1 whose rows are the generators for C is already in row-reduced echelon form, so these vectors are a basis for C. We see that χ(C) = {1, 2, 3, 4, 5}, since there are 1’s in all of those positions in some word in C. Let D be a one-dimensional subcode of C. The size of the support of D equals the Hamming weight of the non-zero codeword in D. Hence, the minimum distance of C is the minimum of |χ(D)| as D ranges over all one-dimensional subcodes of C. Wei generalized this definition.

th Definition 2 The r generalized Hamming weight of C, denoted dr(C), is the smallest support of an r-dimensional subcode of C. That is, dr(C) := min{|χ(D)| : D is a subcode of C with rank r}

To better understand this definition we take the already defined linear code C from the previous example and its generator matrix G.

Example 2. Referring to Example 1, we see that d1(C) = 2 equals the usual min- imum Hamming weight of C. We obtained d2(C) by taking the minimum support size of all two-dimensional subspaces D ⊂ C. The smallest weight is attained for the subspace spanned by the first two rows of G, and d2(C) = minD{|χ(D)|} = 4. There is some codeword in C with a 1 in each of the 5 positions, so d3(C) = 5. We can also assemble all generalized Hamming weights of a code to form the weight hierarchy.

36 Definition 3 The weight hierarchy of a linear code C is defined to be the set of integers {dr(C) : 1 ≤ r ≤ k}.

3 Wei’s Theorems

In this section, we collect several general results from [1] about the generalized Ham- ming weights. Wei’s first theorem gives a generalized Singleton bound for dr(C).

Theorem 1 ([1], Theorem 1 – Monotonicity) For an [n, k] code C with k > 0, we have 1 ≤ d1(C) < d2(C) < ··· < dk(C) ≤ n.

Corollary 1 (Generalized Singleton Bound) For an [n, k] code C, dr(C) ≤ n−k+r. (When r=1, this is the Singleton bound.)

Proof: That dr−1(C) ≤ dr(C) follows directly from the definition; it remains to prove that strict inequalities hold. Let D be a subcode with rank(D) = r and |χ(D)| = dr(C). Let i ∈ χ(D) and Di := {x ∈ D : xi = 0}. Then rank (Di) = r − 1 and dr−1(C) ≤ |χ(Di)| ≤ |χ(D)| − 1 = dr(C) − 1. 4 We will write a parity check matrix of an [n, k] linear code as an (n−k)×n matrix. The codewords are then the column vectors x of length n such that Hx = 0. Theorem 2 gives us an alternative way to compute the generalized Hamming weight. First, we define hHi : i ∈ Ii to be the space generated by the column vectors Hi, 1 ≤ i ≤ n.

Theorem 2 ([1], Theorem 2) For all r ≤ k,

dr(C) = min{|I| : |I| − rank(hHi : i ∈ Ii) ≥ r}

Proof: For any I ⊂ {1, 2, ··· , n}, let S(I) = hHi : i ∈ Ii be the space spanned by the columns of H numbered by elements of I. Let

⊥ X S (I) := {x : xi = 0 for all i ∈ I and xiHi = 0}. i∈l

Then rank(S(I)) + rank(S⊥(I)) = |I|. Let d equal the quantity on the right-hand side of the equality in the statement of Theorem 2. Let I ⊂ {1, 2, ··· , n} be such that |I| − rank(S(I)) = r and |I| = d. ⊥ ⊥ ⊥ Then rank(S (I)) = r, S (I) is a subcode of C, and dr(C) ≤ |χ(S (I))| ≤ |I| = d. So dr(C) ≤ d. It remains to establish the inequality in the other direction. Let D be a subcode of C with rank(D) = r and |χ(D)| = dr(C). Let I = |χ(D)|, then D ⊂ S⊥(I). But rank (S(I)) = |I| − rank(S⊥(I)) ≤ |I| − r, so |I| − rank(S(I)) ≥ r. 0 ⊥ ⊥ Suppose |I| − rank(S(I)) = r > r. Then D 6= S (I), and dr(C) ≤ |χ(S (I)| ≥ |I|, a contradiction. Hence |I| − rank(S(I)) = r, and d ≤ dr(C). 4

37 Example 3 We consider the generator matrix G from the previous examples, and construct a parity check matrix H by the usual algorithm.  1 0 0 1 1  G =  0 1 0 1 0  0 0 1 0 1 so  1 1 0 1 0  H = . 1 0 1 0 1 Let I be any subset of {1, 2 ··· , n}. Consider the vector subspace generated by the columns Hi for i ∈ I. We seek the I that satisfy the given condition |I| − rank(hHi : i ∈ Ii) ≥ r and for which |I| is minimized. For instance with r = 1, we see that the smallest sets of columns satisfying |I| − rank(hHi : i ∈ Ii) ≥ 1 are I = {2, 4} or I = {3, 5}. Hence d1(C) = 2. Similarly, the smallest sets of columns for which |I| − rank(hHi : i ∈ Ii) ≥ 2 have size |I| = 4 (I = {1, 2, 3, 4} is one such set). So d2(C) = 4. Finally, d3(C) = 5.

Theorem 3 gives a relation between the generalized weights of C and the general- ized weights of the dual code C⊥.

Theorem 3 ([1], Theorem 3 – Duality) Let C be an [n, k] code, then

⊥ {dr(C) : 1 ≤ r ≤ k} = {1, 2, ··· , n}\{n + 1 − dr(C ) : 1 ≤ r ≤ n − k}

⊥ Proof: It suffices to prove that for any r with 1 ≤ r < n−k, n+1−dr(C ) ∈/ {di(C): ⊥ ⊥ 1 ≤ i ≤ k}. First we prove that dr(C) ≤ n − dr(C ), where t = k + r − dr(C ). ⊥ ⊥ Let D be a subcode of C with rank(D) = r and |χ(D)| = dr(C ). There exists a parity-check matrix H for C where first r row are vectors in D and the last n − k − r T rows are not. The column vectors {Hi : i∈ / χ(D) have their first r coordinates T T zero. Hence rank (hHi : i∈ / χ(D)i) =column rank (hHi : i∈ / χ(D)i) ≤ row th rank (hRi : r + 1 ≤ i ≤ n − ki) = n − k − r. (Ri is the i row-vector of H.) ⊥ By Theorem 2, letting I = {1, 2, ··· , n}\χ(D), we obtain, I = n − dr(C ), with ⊥ t = |I| − (n − k − r) = k + r − dr(C ). ⊥ Next we show dt+∆(C) 6= n − dr(C ) + 1. for any ∆ ≥ 1. Suppose duality holds for some ∆ ≥ 1, hence there exist a generator matrix G for C (equivalently, a ⊥ ⊥ parity-check matrix G for C ) such that the last dr(C ) − 1 of the first t + ∆ ⊥ rows are all zero. Let I = {n − dr(C ) + 2, ··· , n} then the last |I| column vectors ⊥ span a space whose rank≤ k − t − ∆ = dr(C ) − r − ∆. By Theorem 2, this implies ⊥ ⊥ ⊥ ds(C ) ≤ dr(C ) − 1, where s = |I| − (dr(C ) − r − ∆) = r + ∆ − 1, contradicting ⊥ Theorem 1. Therefore, n + 1 − dr(C ) is not generalized weight for C. 4

Example 4 We consider H as a generator matrix and find its parity check matrix :  1 1 0 0 0  HC⊥ =  0 1 0 1 0  . 1 1 0 0 1

38 Using Theorem 2 we calculate generalized Hamming weights:

⊥ ⊥ d1(C ) = 3, d2(C ) = 5.

⊥ We then construct the set {n + 1 − dr(C ) : 1 ≤ r ≤ n − k} = {1, 3}. Taking its complement with respect to {1, 2, 3, 4, 5} yields

{1, 2, 3, 4, 5}\{1, 3} = {2, 4, 5}, which agrees with the previous example.

m 4 Results on d2(C) for C = BCH(2 , 5) Our main focus for the remainder of this report will be the generalized Hamming weights for the double error-correcting BCH(2m, 5) codes. We begin by reviewing the proof that d2(C) = 8 for these codes from [2]. The following theorems and lemmas are used as key references there and many of the same ideas and techniques will also be used to prove our results.

Lemma 1 (Griesmer bound) For any [n, k] linear code,

k−1 X i n ≥ dd1/2 e i=0

Applying this to all r-dimensional subcodes we obtain a bound on the generalized Hamming weights: r−1 X i dr(C) ≥ dd1/2 e. i=0

Theorem 4 ([2], Theorem 5) Let C be the double error-correcting BCH code C = m BCH(2 , 5). Then d2(C) = 8.

In order to prove the Theorem, we introduce two lemmas. For z ∈ GF (2m), the trace of z is defined as m−1 X i tr(z) = z2 i=0 It follows that tr(z) ∈ {0, 1} for all z. For more properties of the trace function, consult any standard textbook in .

Lemma 2 For any integer m ≥ 4, there is at least one w ∈ GF (2m), w 6= 0, 1 such that tr(w + w−1) = 0.

Lemma 3 For any integer m ≥ 4, there are always u,v 6= 0, 1, such that tr(u) = 1, tr(u−1) = 1 and tr(v) = 0, tr(v−1) = 0.

39 We will also need to use the following fact about quadratic equations over finite fields.

Theorem 5 ([3], page 15) The quadratic equation x2 + αx + β = 0, α, β ∈ GF (2m), has two distinct roots in GF (2m) if and only if tr(βα−2) = 0 and has no roots in GF (2m) if and only if tr(βα−2) = 1.

Proof of Theorem 4: Since C is a cyclic code, it is enough to prove that there is a codeword of weight five −→c with distinct locators 1, x, xαi, y, and yαj. The locators of a word in a BCH code are the positions of the 1’s, identified with nonzero elements of GF (2m). So αj is a locator if and only if the jth bit of −→c is nonzero. It suffices to show that the following two equations can be solved for (x, y, i) where x, y ∈ GF (2m), l ≤ i ≤ 2m − 1, while keeping all locators distinct:

x + x · αi + y + y · αj + 1 = 0

x3 + (x · αi)3 + y3 + (y · αj)3 + 13 = 0 (1) Let αi = a. Then from the previous two equations we have 1 x + y = , 1 + a and 1 x3 + y3 = , 1 + a3 provided a3 6= 1. Since x · y · (x + y) = (x + y)3 − (x3 + y3), we have 1 + a 1 x · y = + (2) 1 + a3 (1 + a)2

Therefore, x and y are solutions of the quadratic equation Z2 + A · Z + B = 0, where B = (1 + a)/(1 + a3) + 1/(1 + a)2 and A = 1/(1 + a). By Theorem 5, the quadratic has two solutions x and y, if and only if  1  tr(BA−2) = tr = 0. (3) 1 + a + a−1

Let 1 + a + a−1 = D−1, then tr(D) = 0 and a2 + (1 + D−1)a + 1 = 0. A solution exists if and only if tr(1/(1 + D−1)) = 0. Since tr(u2) = tr(u), we have

 1   1  tr = tr 1 + = tr(1). (4) 1 + D 1 + D−1

From tr(D) = 0, we know tr(1 + D) = tr(1). (5) From Lemma 2, we know there exist D 6= 0, 1, such that (4) and (5) hold. Thus, there exists a 6= 0, 1, such that (2) holds. 4

40 5 The UNO Proof

In this section we will prove the following theorem extending Feng, Tzeng, and Wei’s m results to determine d3(C) for the double error-correcting BCH(2 , 5) codes.

Theorem 6 Let C be the binary double error-correcting BCH(2m, 5) code, and let m ≥ 4. Then d3(C) = 10.

The proof will proceed in several steps. First, we will show that d3(C) = 10 for all the cases m ≥ 5 and odd. Next, we will show that the result holds in the cases m = 4, 6 by exhibiting explicit 3-dimensional subspaces with |χ(D)| = 10. Finally, the cases m ≥ 8 and even will be deduced from the following standard result about the structure of finite fields.

Theorem 7 ([3], page 102) GF (pr) contains a subfield (isomorphic to) GF (ps) if and only if s divides r.

Proof: We consider the cases m ≥ 5 and odd first. By the Griesmer bound d3(C) ≥ 10 for any code with d = 5 and k ≥ 3, so it is enough to find a D ⊂ C, with dim(D) = 3, with |χ(D)| = 10. We will use codewords of weight 5 to construct such a D. The first step is to study words of weight 5 with 1’s in two given positions. Let H be the parity-check matrix

 β0 β0   β β3     β2 β6  H =    . .   . .  β2m−2 β3(2m−2) for BCH(2m, 5). Given a word w, wH = 0 if and only if w is a codeword in C. Let w be a word of weight 5 with locators βi, βj, βk, βl, βq, then wH = 0 if and only if

βi + βj + βk + βl + βq = 0,

β3i + β3j + β3k + β3l + β3q = 0. (6) We fix βl = s and βq = t and do a change of variables

βi = βi + s + t βj = βj + s + t βk = βk + s + t, then (6) can be rewritten as: βi + βj + βk = 0 (7)

41 β3i + β3j + β3k = st(s + t) (8) By (7) we know: βk = βi +βj and substituting into (8) we get, β2iβj +βiβ2j = st(s+t) Letting Z = βi we get, Z2 + a · Z + b = 0, (9)

j st(s+t) where a = β and b = βj . By Theorem 5 this quadratic equation has two solutions in GF (2m) if and only if:

st(s + t) tr(ba−2) = tr = 0. β3j

Let βj = a, then the previous equation is equivalent to st(s + t) tr = 0. a3 From the definition of the trace,

m−1 X i m−1 m−1 tr(x) = x2 = x + x2 + x4 + ··· + x2 = x(1 + x + x3 + ··· + x2 −1) = 0. i=0 For any odd integer m ≥ 5, there are 2m−1 − 1 different x 6= 0 that satisfy this equation, say x = a1, a2, ··· , a2m−1−1. We claim that for s and t fixed, if ap = s (respectively t) for some p, then t 2 st(s+t) (respectively s) is a solution to the quadratic Z + a · Z + a = 0. To see this, suppose ap = s. Then st(s + t) Z2 + s · Z + = 0 ⇔ Z2 + s · Z + t(s + t) = 0 s ⇔ Z2 + s · Z + s · t + t2 = 0 ⇔ Z ∈ {t, s + t}

st(s+t) Let x = a3 . Then by Theorem 5, we get words of weight 5 from each solution of the equation tr(x) = 0 other than x = 0, s, t, s + t. Counting the remaining possibilities, we have 2m−1 − 4 solutions that give words of weight 5. For every x that satisfies the trace equation, there are two roots of the quadratic equation (9), so we obtain 2(2m−1 −4) = 2m −8 solutions of the equations (7) and (8). But the symmetry 2m−8 2m−1−4 of those equations shows that there are only 6 = 3 distinct words of weight 5 with 1’s in the two specified locations s, t. Now we will show by contradiction that d3(C) = 10. Assume on the contrary that d3(C) > 10 and let w be any word of weight 5 in the code. We will denote the positions of the 1’s in w by A, B, X, Y, Z. Let WA,B denote the set of words of weight 5 that have 1’s in positions A and B, let WA,X denote the set of words of weight 5 that have 1’s in positions A and X and let WA,Y denote the set of words of weight 5 that contain 1’s in positions A and Y . We know that there

42 (2m−1−4) (2m−1−4) are 3 codewords in WA,B, (including the word w). Similarly, there are 3 (2m−1−4) codewords in WA,X , and 3 codewords in WA,Y (both also including w). Since (2m−1−7) w already has 1’s in postions A, B, X, Y there are 3 words other than w in each of the sets WA,B, WA,X , and WA,Y . Two words of weight 5 in C have at most two non-zero locations in common, since otherwise the sum would be a word of weight 4. So the codewords in each of the sets (2m−1−7) m−1 WA,B, WA,X , and WA,Y have 1’s in 3· 3 = 2 −7 distinct positions other than the two points fixed in the definition of the sets. Call the set of positions other than A, B where the words in WA,B have 1’s UA,B, and define UA,X and UA,Y similarly. So m−1 |UA,B| = |UA,X | = |UA,Y | = 2 − 7. Under our assumption that d3(C) > 10, it is easy to see that UA,B, UA,X , and UA,Y must be pairwise disjoint. Otherwise we can find a three-dimensional subspace spanned by w and words from two of the sets with support size 10. But the blocklength m m−1 of C is n = 2 − 1. UA,B, UA,X , UA,Y each contain 2 − 7 distinct elements disjoint from the 1’s positions of w. Hence we must have have 3 · (2m−1 − 7) + 5 ≤ 2m − 1. But it is easy to check that 3 · (2m−1 − 7) + 5 > 2m − 1 whenever m ≥ 5. Thus, we have a contradiction and hence d3(C) = 10 for m ≥ 5 and odd. Next, we consider the cases m = 4, 6. In these cases, it is not difficult to find all the words of weight 5 in the code C using Maple. With n = 4, for instance, using the irreducible polynomial h(x) = x4 + x + 1 to construct GF (24), and letting β be a root of h, we found one codeword of weight 5 with 1’s in locations 2, 3, 4, 6, 10, another with 1’s in locations 0, 3, 6, 9, 12, and a third with 1’s in locations 1, 8, 9, 10, 12 (where the locations are indexed by 0 ≤ i ≤ 14). These three codewords span a 3- dimensional subcode D with χ(D) = {0, 1, 2, 3, 4, 6, 8, 9, 10, 12}. So d3(C) = 10 for C = BCH(24, 5) also. Similarly for GF (26), an explicit 3-dimensional subcode D with χ(D) = {4, 13, 16, 18, 22, 38, 39, 42, 45, 56} exists. m 0 Finally, we note that if d3(C) = 10 for C = BCH(2 , 5), then d3(C ) = 10 for C0 = BCH(22m, 5) as well. By Theorem 7, we know that GF (22m) contains a subfield isomorphic to GF (2m). The codewords of weight 5 that we use in our proof are found as solutions of the algebraic equations (8). If these have solutions corresponding to a subcode of support size 10 in GF (2m), then they also have “the same” solutions in GF (22m). This concludes our proof. 4

6 Conclusions, Open Problems and Future Work

As we have previously stated, Feng, Tzeng, and Wei proved that d2(C) = 8 for all double-error correcting BCH(2m, 5) codes. After considering the possible overlaps of the positions of the 1’s in sets of three words of weight 5, we have shown that m d3(C) = 10 for the BCH(2 , 5) codes with m ≥ 4. This is shown in the UNO proof through a series of mathematical substitutions to construct a set of algebraic equations whose solutions are the words of weight 5 with 1’s in two specified locations. We develop a counting argument to show that there is sufficient overlap in the positions of the 1’s in words of weight 5 to allow us to produce triples of words with only 10

43 distinct 1’s positions. Finally, the open question is to look into the higher generalized Hamming weights m dr(C) for r ≥ 4 of C = BCH(2 , 5) codes as a subject for further research.

7 Appendix

7.1 Maple Procedures Used in Our Work Programs Description of Algorithms Efficiency GenHamWeight The purpose of this program is to Not very efficient generate the weight for a code of a because it calculates given dimension using the restriction all combinations from Theorems 1 and 2 of codewords GenHamWeight2 It uses Theorems 1 and 2 Somewhat efficient the Griesmer and Singleton Bounds due to a slow to calculate the weight of a built-in codeword for a given dimension maple funcion LGHW The program generates all of the Efficient when weight hierchies using the calculating the ends Griesmer and Singleton Bounds of the hierchy list and GenHamWeight2 otherwise, slow Magic Fixes any two positions and runs Very though all possible solutions efficient of the quadratic equation

Magic2 Fixes any three positions and runs Very though all possible solutions efficient of the quadratic equation

Help Fixes any two positions and finds Very all possible solutions of the efficient trace definition and its restrictions

The Maple source code for these follows in the next subsection.

7.2 Maple Source Code

GenHamWeight:=proc(G::array,p::integer,r::integer) local pcm,n,c,c1,v,t,s,r1,D,j,i,finished;

44 pcm:=CheckMat(G,p); n:=rowdim(pcm); c:=convert(pcm,listlist); finished:=false; for i from 9 to n do c1:=choose(c,i); v:=vectdim(c1); for j from 1 to v do t:=convert(c1[j],matrix); s:=transpose(t); r1:=rank(s); if (i-r1) >= r then D:=i; finished:=true; break; end if; end do; if finished then break end if; end do; RETURN(D) end:

GenHamWeight2:=proc(G::array,p::integer,r::integer,x::integer) local H,n,C,s,R,j,i,k,finished,M,a,o,sn,e,sne,Od,sno,ii,q,DD;

H:=CheckMat(G,p); n:=rowdim(H); C:=convert(H,listlist); lprint(C); finished:=false; for i from x to n do lprint("starting loop pass",i); if i=n then

o:=choose(n,0); sn:=[]; for ii to nops(o) do sn:=[op(sn),convert(convert([seq(ii,ii=1..n)],set) minus convert(o[ii],set),list)]; end do: for j from 1 to nops(sn) do a:=sn[j]; M:=stackmatrix(seq(C[a[k]],k=1..i));

45 R:=rank(M); if (i-R) >= r then DD:=i; finished:=true; break; end if; end do; else if n mod p=0 and i> (n/2) then e:=choose(n,(n-i)); sne:=[]; for ii to nops(e) do sne:=[op(sne), convert(convert([seq(q,q=1..n)],set) minus convert(e[ii],set),list)]; end do:

for j from 1 to nops(sne) do a:=sne[j]; M:=stackmatrix(seq(C[a[k]],k=1..i)); R:=rank(M); if (i-R) >= r then DD:=i; finished:=true; break; end if; end do; else if i>((n+1)/2) then Od:=choose(n,(n-i)); sno:=[]; for ii to nops(Od) do sno:=[op(sno), convert(convert([seq(q,q=1..n)],set) minus convert(Od[ii],set),list)]; end do:

for j from 1 to nops(sno) do a:=sno[j]; M:=stackmatrix(seq(C[a[k]],k=1..i)); R:=rank(M); if (i-R) >= r then DD:=i; finished:=true; break; end if; end do; else do

s:=choose(n,i); for j from 1 to nops(s) do

46 a:=s[j]; M:=stackmatrix(seq(C[a[k]],k=1..i)); R:=rank(M); if (i-R) >= r then DD:=i; finished:=true; break; end if; end do; lprint("Final Loop"); break; end do; end if; end if; end if;

if finished then break end if; end do; RETURN(eval(DD)) end:

LGHW:=proc(G::array,p::integer) local n,k,Q,R,L,i,j,BS,BG,m,v,l,finished; finished:=false; Q:=GenMat(G,p); n:=coldim(Q); k:=rowdim(Q); R:=MinWeight(Q,p); L:=[R]; lprint("Minweight check",R); for i from 1 to k-1 do if k-i=n-L[i] then for j from L[i]+1 to n do L:=[op(L),j]; end do; finished:=true; break; end if;

BS:=n-k+(i+1);

47 BG:=sum(’ceil(R/2^l)’,’l’=0..i); if BS=BG then L:=[op(L),BS]; else m:=max(BG,L[i]+1); lprint("starting loop pass GG"); v:=GenHamWeight2(G,p,(i+1),m); L:=[op(L),v]; end if; if finished then break end if; end do; RETURN(L) end:

Magic:=proc(h::polynom,p::integer,s::integer,t::integer) local list,d,i,j,r,beta,l; list:=[]; r:=degree(h); beta:=RootOf(h); d:=2^r-2; for i from 0 to d do for j from 0 to d do l:=Normal(beta^i+beta^j+beta^s+beta^t) mod p;

if Normal(beta^(3*i)+beta^(3*j)+(beta^i+beta^j+beta^s+beta^t)^3 +beta^(3*s)+beta^(3*t)) mod p=0

then list:=[op(list),[beta^i,beta^j,l,beta^s,beta^t]]; end if; end do; end do; RETURN(list) end:

Magic2:=proc(h::polynom,p::integer,s::integer,t::integer,a::integer) local list,d,i,j,r,beta,l; list:=[];

48 r:=degree(h); beta:=RootOf(h); d:=2^r-2; for i from 0 to d do l:=Normal(beta^i+beta^a+beta^s+beta^t) mod p;

if Normal(beta^(3*i)+beta^(3*a)+(beta^i+beta^a+beta^s+beta^t)^3 +beta^(3*s)+beta^(3*t)) mod p=0

then list:=[op(list),[beta^a,beta^s,beta^t,l,beta^i]]; end if; end do; RETURN(list) end:

HELP:=proc(h::polynom,p::integer,s::integer,t::integer) local list,d,r,beta,i,sublist,a,q,e,j; list:=[]; r:=degree(h); beta:=RootOf(h); d:=2^r-1; alias(beta=RootOf(h)); for i from 0 to d-1 do Normal(beta^i) mod p end do; sublist:={seq(Normal(beta^i) mod p = beta^i,i=0..2^degree(h)-2)}; for a from 1 to d do

if (Normal(beta^a+beta^s+beta^t) mod p <>0) then if (beta^a<>beta^s) then if (beta^a<>beta^t) then

q:=(((beta^a+beta^s)*(beta^a+beta^t)*(beta^s+beta^t))/ (beta^a+beta^s+beta^t)^3) mod p; e:=Normal(sum(’q^(2^j)’,’j’=0..(r-1))) mod p; #lprint("OOOps", list); list:=[op(list),e]; end if; end if; end if; end do;

49 RETURN(list) end:

References

[1] Victor K. Wei, Generalized Hamming Weights for Linear Codes, Transactions on , Vol. 37, NO. 5, 1412-1413, September, 1991.

[2] G. L. Feig, K.K. Tzeng & V.K. Wei , On the Generalized Hamming Weights of Several Classes of Cyclic Codes, Transactions on Information Theory, Vol. 38, NO. 3, 1125-1126, May, 1992.

[3] F.J. Macwilliams & N.J.A. Sloane , The Theory of Error-Correcting Codes, North-Holland Mathematical Library, Vol. 16, Nineth Impression 1996.

[4] D.R. Hankerson, D,G, HOffman, D.A. Leonard, C.C. Lindner, K.T. Phelpes,C.A. Rodger, & J.R. Wall , Coding Theory and : The Essentials, Marcel Dekkel, Inc., New York, 1991.

50