MacWilliams Identity for Codes with the Rank Metric

The MacWilliams identity, which relates the weight distribution of a code to the weight distribution of its dual code, is useful in determining the weight distribution of codes. In this paper, we derive the MacWilliams identity for linear codes with the rank metric, and our identity has a different form than that by Delsarte. Using our MacWilliams identity, we also derive related identities for rank metric codes. These identities parallel the binomial and power moment identities derived for codes with the Hamming metric.


INTRODUCTION
The MacWilliams identity for codes with the Hamming metric [1], which relates the Hamming weight distribution of a code to the weight distribution of its dual code, is useful in determining the Hamming weight distribution of codes. This is because if the dual code has a small number of codewords or equivalence classes of codewords under some known permutation group, its weight distribution can be obtained by exhaustive examination. It also leads to other identities for the weight distribution such as the Pless identities [1,2].
Although the rank has long been known to be a metric implicitly and explicitly (e.g., see [3]), the rank metric was first considered for error-control codes (ECCs) by Delsarte [4]. The potential applications of rank metric codes to wireless communications [5,6], public-key cryptosystems [7], and storage equipments [8,9] have motivated a steady stream of works [8][9][10][11][12][13][14][15][16][17][18][19][20] that focus on their properties. The majority of previous works focus on rank distance properties, code construction, and efficient decoding of rank metric codes, and the seminal works in [4,9,10] have made significant contribution to these topics. Independently in [4,9,10], a Singleton bound (up to some variations) on the minimum rank distance of codes was established, and a class of codes achieving the bound with equality was constructed. We refer to this class of codes as Gabidulin codes henceforth. In [4,10], analytical expressions to compute the weight distribution of linear codes achieving the Singleton bound with equality were also derived. In [8], it was shown that Gabidulin codes are optimal for correcting crisscross errors (referred to as lattice-pattern errors in [8]). In [9], it was shown that Gabidulin codes are also optimal in the sense of a Singleton bound in crisscross weight, a metric considered in [9,12,21] for crisscross errors. Decoding algorithms were introduced for Gabidulin codes in [9,10,22,23].
In [4], the counterpart of the MacWilliams identity, which relates the rank distance enumerator of a code to that of its dual code, was established using association schemes. However, Delsarte's work lacks an expression of the rank weight enumerator of the dual code as a functional transformation of the enumerator of the code. In [24,25], Grant and Varanasi defined a different rank weight enumerator and established a functional transformation between the rank weight enumerator of a code and that of its dual code.
In this paper we show that, similar to the MacWilliams identity for the Hamming metric, the rank weight distribution of any linear code can be expressed as a functional transformation of that of its dual code. It is remarkable that our MacWilliams identity for the rank metric has a similar form to that for the Hamming metric. Similarly, an intermediate result of our proof is that the rank weight enumerator of the dual of any vector depends on only the rank weight of the vector and is related to the rank weight enumerator of a maximum rank distance (MRD) code. We also derive additional identities that relate moments of the rank weight distribution of a linear code to those of its dual code.

EURASIP Journal on Wireless Communications and Networking
Our work in this paper differs from those in [4,24,25] in several aspects.
(i) In this paper, we consider a rank weight enumerator different from that in [24,25], and solve the original problem of determining the functional transformation of rank weight enumerators between dual codes as defined by Delsarte.
(ii) Our proof, based on character theory, does not require the use of association schemes as in [4] or combinatorial arguments as in [24,25].
(iii) In [4], the MacWilliams identity is given between the rank distance enumerator sequences of two dual array codes using the generalized Krawtchouk polynomials. Our identity is equivalent to that in [4] for linear rank metric codes, although our identity is expressed using different parameters which are shown to be the generalized Krawtchouk polynomials as well. We also present this identity in the form of a functional transformation (cf. Theorem 1). In such a form, the MacWilliams identities for both the rank and the Hamming metrics are similar to each other.
(iv) The functional transformation form allows us to derive further identities (cf. Section 4) between the rank weight distribution of linear dual codes. We would like to stress that the identities between the moments of the rank distribution proved in this paper are novel and were not considered in the aforementioned papers.
We remark that both the matrix form [4,9] and the vector form [10] for rank metric codes have been considered in the literature. Following [10], in this paper the vector form over GF(q m ) is used for rank metric codes although their rank weight is defined by their corresponding code matrices over GF(q) [10]. The vector form is chosen in this paper since our results and their derivations for rank metric codes can be readily related to their counterparts for Hamming metric codes.
The rest of the paper is organized as follows. Section 2 reviews some necessary backgrounds. In Section 3, we establish the MacWilliams identity for the rank metric. We finally study the moments of the rank distributions of linear codes in Section 4.

Rank metric, MRD codes, and rank weight enumerator
Consider an n-dimensional vector x = (x 0 , x 1 , . . . , x n−1 ) ∈ GF(q m ) n . The field GF(q m ) may be viewed as an mdimensional vector space over GF(q). The rank weight of x, denoted as rk(x), is defined to be the maximum number of coordinates in x that are linearly independent over GF(q) [10]. Note that all ranks are with respect to GF(q) unless otherwise specified in this paper. The coordinates of x thus span a linear subspace of GF(q m ), denoted as S(x), with dimension equal to rk(x). For all x, y ∈ GF(q m ) n , it is easily verified that d R (x, y) def = rk(x − y) is a metric over GF(q m ) n [10], referred to as the rank metric henceforth. The minimum rank distance of a code C, denoted as d R (C), is simply the minimum rank distance over all possible pairs of distinct codewords. When there is no ambiguity about C, we denote the minimum rank distance as d R .
Combining the bounds in [10,26] and generalizing slightly to account for nonlinear codes, we can show that the cardinality K of a code C over GF(q m ) with length n and minimum rank distance d R satisfies In this paper, we call the bound in (1) the Singleton bound for codes with the rank metric, and refer to codes that attain the Singleton bound as maximum rank distance (MRD) codes. We refer to MRD codes over GF(q m ) with length n ≤ m and with length n > m as Class-I and Class-II MRD codes, respectively. For any given parameter set n, m, and d R , explicit construction for linear or nonlinear MRD codes exists. For n ≤ m and d R ≤ n, generalized Gabidulin codes [16] constitute a subclass of linear Class-I MRD codes. For n > m and d R ≤ m, a Class-II MRD code can be constructed by transposing a generalized Gabidulin code of length m and minimum rank distance d R over GF(q n ), although this code is not necessarily linear over GF(q m ). When n = lm (l ≥ 2), linear Class-II MRD codes of length n and minimum distance d R can be constructed by a Cartesian product G l def = G × · · · × G of an (m, k) linear Class-I MRD code G [26]. For all v ∈ GF(q m ) n with rank weight r, the rank weight function of v is defined as f R (v) = y r x n−r . Let C be a code of length n over GF(q m ). Suppose there are A i codewords in C with rank weight i (0 ≤ i ≤ n). Then the rank weight enumerator of C, denoted as W R C (x, y), is defined to be
Definition 2 (Hadamard transform [1]). For a mapping f from GF(q m ) n to C, the Hadamard transform of f , denoted as f , is defined to be where u · v denotes the inner product of u and v.
M. Gadouleau and Z. Yan

Notations
In order to simplify notations, we will occasionally denote the vector space GF(q m ) n as F. We denote the number of vectors of rank u (0 ≤ u ≤ min{m, n}) in GF(q m ) n as N u (q m , n). It can be shown that N u (q m , n) = [ n u ]α(m, u) [10], where α(m, 0) def = 1 and α(m, u) term is often referred to as a Gaussian polynomial [27], defined as [ n u ] def = α(n, u)/α (u, u). Note that [ n u ] is the number of u-dimensional linear subspaces of GF(q) n . We also define β(m, 0) def = 1 and β(m, u) These terms are closely related to Gaussian polynomials:

q-product, q-transform, and q-derivative
In order to express the MacWilliams identity in polynomial form as well as to derive other identities, we introduce several operations on homogeneous polynomials.
We provide some examples to illustrate the concept. It is easy to verify that x * y = yx, y * x = qyx, yx * x = qyx 2 , and yx * (q m − 1)y = (q m − q)y 2 x. Note that x * y / = y * x. It is easy to verify that the q-product is neither commutative nor distributive in general. However, it is commutative and distributive in some special cases as described below.
Note that a l (x, y; m) is the rank weight enumerator of GF(q m ) l . The proof of Lemma 2, which goes by induction on l, is easy and hence omitted.
Definition 5 (q-derivative [28]). For q ≥ 2, the q-derivative For any real number a, The proof of Lemma 3, which goes by induction on ν, is easy and hence omitted. Lemma 4 (Leibniz rule for the q-derivative). For two homogeneous polynomials f (x, y) and g(x, y) with degrees r and s, respectively, the νth (ν ≥ 0) q-derivative of their q-product is given by The proof of Lemma 4 is given in Appendix A.
The q −1 -derivative is similar to the q-derivative.
Definition 6 (q −1 -derivative). For q ≥ 2, the q −1 -derivative at y / = 0 of a real-valued function g(y) is defined as For any real number a, For ν ≥ 0, we will denote the νth 4 EURASIP Journal on Wireless Communications and Networking The proof of Lemma 5 is similar to that of Lemma 3 and is hence omitted.
Lemma 6 (Leibniz rule for the q −1 -derivative). For two homogeneous polynomials f (x, y; m) and g(x, y; m) with degrees r and s, respectively, the νth (ν ≥ 0) q −1 -derivative of their q-product is given by The proof of Lemma 6 is given in Appendix B.

The dual of a vector
As an important step toward our main result, we derive the rank weight enumerator of v ⊥ , where v ∈ GF(q m ) n is an arbitrary vector and v def = {av : a ∈ GF(q m )}. Note that v can be viewed as an (n, 1) linear code over GF(q m ) with a generator matrix v. It is remarkable that the rank weight enumerator of v ⊥ depends on only the rank of v.
Berger [14] has determined that linear isometries for the rank distance are given by the scalar multiplication by a nonzero element of GF(q m ), and multiplication on the right by a nonsingular matrix B ∈ GF(q) n×n . We say that two codes C and C are rank-equivalent if there exists a linear isometry f for the rank distance such that f (C) = C .
We hence derive the rank weight enumerator of an (r, r − 1, 2) MRD code. Note that the rank weight distribution of linear Class-I MRD codes has been derived in [4,10]. However, we will not use the result in [4,10], and instead derive the rank weight enumerator of an (r, r − 1, 2) MRD code directly.
The rank weight enumerator of L r = v ⊥ depends on only r and is given by Proof. We first prove that the number of vectors with rank r in L r , denoted as A r,r , depends only on r and is given by by induction on r (r ≥ 1). Equation (13) clearly holds for r = 1. Suppose (13) holds for r = r − 1.
We consider all the vectors u = (u 0 , . . . , u r−1 ) ∈ L r such that the first r − 1 coordinates of u are linearly independent.
such vectors u. Among these vectors, we will enumerate the vectors t whose last coordinate is a linear combination of the first r −1 coordinates, that is, Remark that t ∈ L r if and only if (t 0 , . .
We conclude that there are q r−1 A r−1,r−1 vectors t. Therefore, A r,r = α(m, Denote the number of vectors with rank p in L r as A r,p . We have A r,p = [ r p ]A p,p [10], and hence A r,p = [ We comment that Proposition 1 in fact provides the rank weight distribution of any (r, r − 1, 2) MRD code.
Proof. For s ≥ 0, denote W R Cs (x, y) = r+s u=0 B s,u y u x r+s−u . We will prove that by induction on s. Equation (15) . Combining Lemma 7, Proposition 1, and Lemma 8, the rank weight enumerator of v ⊥ can be determined at last.

Proposition 2.
For v ∈ GF(q m ) n with rank r ≥ 0, the rank weight enumerator of L = v ⊥ depends on only r, and is given by

MacWilliams identity for the rank metric
Using the results in Section 3.2, we now derive the MacWilliams identity for rank metric codes. Let C be an (n, k) linear code over GF(q m ), let W R C (x, y) = n i=0 A i y i x n−i be its rank weight enumerator, and let W R C ⊥ (x, y) = n j=0 B j y j x n− j be the rank weight enumerator of its dual code C ⊥ . Theorem 1. For any (n, k) linear code C and its dual code C ⊥ over GF(q m ), where Proof. We have rk(λu) = rk(u) for all λ ∈ GF(q m ) * and all u ∈ GF(q m ) n . We want to determine f R (v) for all v ∈ GF(q m ) n . By Definition 2, we can split the summation in (3) into two parts: where L = v ⊥ . If u ∈ L, then χ(u · v) = 1 by Definition 1, and the first summation is equal to W R L (x, y). For the second summation, we divide vectors into groups of the form {λu 1 }, where λ ∈ GF(q m ) * and u 1 · v = 1. We remark that for u ∈ F \ L (see [1, Chapter 5, Lemma 9]): Hence the second summation is equal to (−1/(q m −1))W R F\L (x, y). This leads to f R  By [1, Chapter 5, Lemma 11], any mapping f from F to C satisfies v∈C ⊥ f (v) = (1/|C|) v∈C f (v). Applying this result to f R (v) and using Definition 4, we obtain (17) and (18).
Also, B j 's can be explicitly expressed in terms of A i 's.

Corollary 1. It holds that
where Proof. We have (x − y) [ Note that although the analytical expression in (21) is similar to that in [4, (3.14)], P j (i; m, n) in (22) are different from P j (i) in [4, (A10)] and their alternative forms in [29]. We can show the following: The proof is given in Appendix C. Proposition 3 shows that P j (x; m, n) in (22) are an alternative form for P j (i) in [4, (A10)], and hence our results in Corollary 1 are equivalent to those in [4, Theorem 3.3]. Also, it was pointed out in [29] that P j (x; m, n)/P j (0; m, n) is actually a basic hypergeometric function.

Binomial moments of the rank distribution
In this section, we investigate the relationship between moments of the rank distribution of a linear code and those of its dual code. Our results parallel those in [1, page 131].

Proposition 4. For
Proof. First, applying Theorem 1 to C ⊥ , we obtain n i=0 A i y i x n−i = q m(k−n) n j=0 B j b j (x, y; m) * a n− j (x, y; m). (24) Next, we apply the q-derivative with respect to x to (24) ν times. By Lemma 3 the left-hand side (LHS) 6 EURASIP Journal on Wireless Communications and Networking becomes n−ν i=0 β(n − i, ν)A i y i x n−i−ν , while the RHS reduces to q m(k−n) n j=0 B j ψ j (x, y) by Lemma 4, where ψ j (x, y) def = b j (x, y; m) * a n− j (x, y; m) and a (ν−l) n− j (x, y; m) = β(n − j, ν − l)a n− j−ν+l (x, y; m). It can be verified that for any homogeneous polynomial b(x, y; m) and for any s ≥ 0, (b * a s )(1, 1; m) = q ms b (1, 1; m). Also, for . Applying x = y = 1 to the LHS and rearranging both sides (23).
Proposition 4 can be simplified if ν is less than the minimum distance of the dual code.
Using the q −1 -derivative, we obtain another identity.
The proof of Proposition 5 is similar to that of Proposition 4, and is given in Appendix D. Following [1], we refer to the LHS of (23) and (27) as binomial moments of the rank distribution of C. Similarly, when either ν is less than the minimum distance d R of the dual code, or ν is greater than the diameter (maximum distance between any two codewords) δ R of the dual code, Proposition 5 can be simplified.

Pless identities for the rank distribution
In this section, we consider the analogues of the Pless identities [1,2], in terms of Stirling numbers. The q-Stirling numbers of the second kind S q (ν, l) are defined [30] to be and they satisfy The following proposition can be viewed as a q-analogue of the Pless identity with respect to x [2, P 2 ]. (32) where (33) follows (31) and (34) is due to Proposition 4.
Proposition 6 can be simplified when ν is less than the minimum distance of the dual code.
Unfortunately, a q-analogue of the Pless identity with respect to y [2, P 1 ] cannot be obtained due to the presence of the q ν(n−i) term in the LHS of (27). Instead, we derive its q −1 -analogue. We denote p def = q −1 and define the functions α p (m, u), [ n u ] p , β p (m, u) similarly to the functions introduced in Section 2.3, only replacing q by p. It is easy to relate these q −1 -functions to their counterparts: The proof of Proposition 7 is given in Appendix E.

Further results on the rank distribution
For nonnegative integers λ, μ, and ν, and a linear code C with rank weight distribution {A i }, we define whose properties are studied below. We refer to as the νth q-moment of the rank distribution of C. We remark that for any code C, the 0th order q-moment of its rank distribution is equal to 1. We first relate T λ,1,ν (C) and T 1,μ,ν (C) to T 0,0,ν (C).

Lemma 9.
For nonnegative integers λ, μ, and ν, The proof of Lemma 9 is given in Appendix F. We now consider the case where ν is less than the minimum distance of the dual code.
The proof of Proposition 8 is given in Appendix G. Proposition 8 hence shows that the νth q-moment of the rank distribution of a code is transparent to the code when ν < d R . As a corollary, we show that T λ,1,ν (C) and T 1,μ,ν (C) are also transparent to the code when 0 ≤ λ, μ ≤ ν < d R .

Rank weight distribution of MRD codes
The rank weight distribution of linear Class-I MRD codes was given in [4,10]. Based on our results in Section 4.1, we provide an alternative derivation of the rank distribution of linear Class-I MRD codes, which can also be used to determine the rank weight distribution of Class-II MRD codes.
Proposition 9 (rank distribution of linear Class-I MRD codes). Let C be an (n, k, d R ) linear Class-I MRD code over GF(q m )(n ≤ m), and let W R C (x, y) = n i=0 A i y i x n−i be its rank weight enumerator. We then have A 0 = 1 and for Proof. It can be shown that for two sequences of real numbers We remark that the above rank distribution is consistent with that derived in [4,10]. Since Class-II MRD codes can be constructed by transposing linear Class-I MRD codes and the transposition operation preserves the rank weight, the weight distributions Class-II MRD codes can be obtained accordingly.

APPENDICES
The proofs in this section use some well-known properties of Gaussian polynomials [27]:

A. PROOF OF LEMMA 4
We consider homogeneous polynomials f (x, y; m) = r i=0 f i y i x r−i and u(x, y; m) = r i=0 u i y i x r−i of degree r as well as g(x, y; m) = s j=0 g j y j x s− j and v(x, y; m) = s j=0 v j y j x s− j of degree s. First, we need a technical lemma. Proof. In order to simplify notations, we omit the dependence of the polynomials f and g on the parameter m. The proof goes by induction on ν. For ν = 0, the result is trivial.

B. PROOF OF LEMMA 6
We consider homogeneous polynomials f (x, y; m) = r i=0 f i y i x r−i and u(x, y; m) = r i=0 u i y i x r−i of degree r as well as g(x, y; m) = s j=0 g j y j x s− j and v(x, y; m) = s j=0 v j y j x s− j of degree s. First, we need a technical lemma.

(B.4)
We now give a proof of Lemma 6.
Proof. The proof goes by induction on ν, and is similar to that of Lemma 4. For ν = 0, the result is trivial. It is thus easy to verify the claim by induction on ν.
We now give a proof of Proposition 5.
Proof. We apply the q −1 -derivative with respect to y to (24) ν times, and we apply x = y = 1. By Lemma 5, the LHS becomes