SOME CLASSES OF LCD CODES AND SELF-ORTHOGONAL CODES OVER FINITE FIELDS

. Due to their important applications in theory and practice, linear complementary dual (LCD) codes and self-orthogonal codes have received much attention in the last decade. The objective of this paper is to extend a recent construction of binary LCD codes and self-orthogonal codes to the general p - ary case, where p is an odd prime. Based on the extended construction, several classes of p -ary linear codes are obtained. The characterizations of these linear codes to be LCD or self-orthogonal are derived. The duals of these linear codes are also studied. It turns out that the proposed linear codes are optimal in many cases in the sense that their parameters meet certain bounds on linear codes. The weight distributions of these linear codes are settled.


Introduction
Let q be a power of a prime and F q be the finite field with q elements. Let F n q denote the vector space over F q with dimension n. In this paper, we always write the elements of F n q as column vectors unless otherwise stated. We use wt(x) to denote the weight of x ∈ F n q , i.e., the number of nonzero coordinates in x = (x 1 , x 2 , · · · , x n ) T , where T denotes the transpose of x. For any x = (x 1 , x 2 , · · · , x n ) T and y = (y 1 , y 2 , · · · , y n ) T in F n q , the Euclidean inner product of x and y is defined by An [n, κ, d] linear code C over F q is a κ-dimensional subspace of F n q with minimum (Hamming) distance d. The dual of C is defined by C ⊥ = {w ∈ F n q : w · c = 0 for all c ∈ C}. A linear code C is called a linear complementary dual (LCD) code [27] if C ∩ C ⊥ = {0}, and is called a self-orthogonal code [17] if C ⊆ C ⊥ .
Let A i denote the number of codewords with Hamming weight i in a code C of length n. The weight enumerator of C is defined by 1 + A 1 z + A 2 z 2 + · · · + A n z n .
Accordingly, the sequence (1, A 1 , · · · , A n ) is called the weight distribution of C. Clearly, the weight distribution gives the minimum distance of the code, and thus the error correcting capability. Moreover, the weight distribution of a code allows the computation of the error probability of error detection and correction with respect to some error detection and error correction algorithms (see [20] for details). Thus the study of the weight distribution of a linear code is important in both theory and applications. A linear code C is said to be a t-weight code if the number of nonzero A i in the sequence (A 1 , A 2 , · · · , A n ) is equal to t.
Linear codes have wide applications in CD players, high speed modems, cellular phones, and data storage devices. In recent years, linear codes with some special properties have received renewed attentions due to their important role in new applications. Carlet and Guilley found that binary LCD codes could be used in cryptography to resist side-channel attacks and fault non-invasive attacks (see [2] and [5] for more details). Self-orthogonal codes can be used to construct quantum error-correcting codes, which can protect quantum information in quantum computations and quantum communications [3,15]. Both algebraic and combinatorial constructions of self-orthogonal codes were reported in the literature (see [4,10,19] and the references therein).
The study of LCD cyclic codes (under the name of reversible cyclic codes) traces back to the seminal work of Massey [26] where LCD cyclic codes were introduced for data storage applications. Massey made a comparison between LCD codes and non-LCD codes [26], and demonstrated that asymptotically good LCD codes exist [27]. In 1970, Tzeng and Hartmann [33] made a subsequent contribution proving that the minimum distance of a class of LCD cyclic codes is greater than the BCH bound. Esmaeili and Yari [14] studied LCD codes that are quasi-cyclic. For a given length and minimum distance, Dougherty et al. [13] established a linear programming bound on the largest possible size of an LCD code. In [21] and [22], Li, Ding and Li gave a well-rounded treatment of LCD cyclic codes and obtained several classes of LCD codes with good parameters. Yan et al. [34] studied LCD BCH codes and presented several classes of LCD BCH codes. LCD MDS codes have been constructed from generalized Reed-Solomon codes in [31]. Mesnager et al. [28] proposed a construction of algebraic geometry Euclidean LCD codes. In addition, linear codes with Hermitian complementary dual were also studied in the literature [23], [8]. In [7], Carlet et al. completely determined all q-ary (q > 3) Euclidean LCD codes and all q 2 -ary (q > 2) Hermitian LCD codes for all possible parameters. In a recent paper [9], Euclidean and Hermitian complementary dual were generalized to σ complementary dual. Accordingly, Euclidean and Hermitian LCD codes were generalized to σ-LCD codes. To the best of our knowledge, it is hard to determine the minimal distances of these known LCD codes, not to mention their weight distribution. Very recently, employing a generic construction of linear codes by Ding [12], Zhou el al. [36] obtained several class of LCD codes and self-orthogonal codes which are optimal in many cases in the sense that their parameters meets certain bounds on linear codes. Notably, the weight distributions of some subclasses of these linear codes were completely settled in [36].
The main objective of this paper is to extend the construction of LCD codes and self-orthogonal codes in [36] from binary case to the general p-ary case, where p is an odd prime. Specifically, we construct four classes of p-ary linear codes using the generic construction in [12]. We give very simple characterizations of these linear codes to be LCD codes or self-orthogonal codes. Using those characterizations, we obtain infinite families of p-ary LCD codes and self-orthogonal codes from the proposed linear codes and their duals. To our best knowledge, the self-orthogonal codes constructed in this paper have different parameters from that of those selforthogonal codes constructed in other literature [30,32,35]. Until now, people can only determine the weight distribution of a few class of self-orthogonal codes. We completely determine the weight distributions of the linear codes constructed in this paper. Many LCD codes and self-orthogonal codes presented in this paper are optimal or almost optimal in the sense that they meet certain bounds on general linear codes.
We will compare some of the codes presented in this paper with the tables of best known linear codes (referred to as the Database later) maintained by Markus Grassl at http://www.codetables.de.

Some classes of p-ary LCD codes and self-orthogonal codes and their duals
Based on a generic construction of linear codes by Ding [12], several classes of binary LCD codes and self-orthogonal codes were constructed in [36]. In this section, we shall extend the results in [36] from the binary case to the general p-ary case, where p is an odd prime. Before doing this, we first recall the generic construction of linear codes in [12] from the view point of vector space.
Let D = {g 1 , g 2 , · · · , g n } ⊆ F m p and let G be the m × n matrix formed by the column vectors g 1 , g 2 , · · · , g n : Using D, one can obtain a linear code of length n over F p : The set D is called the defining set of the code C D . Clearly, C D is the linear code generated by the row vectors of the matrix G. Therefore C D is an [n, k] linear code with k = Rank(G), where Rank(G) denotes the rank of the matrix G. In particular, if k = m, G is exactly a generator matrix of C D . The following result can be used to determine whether C D is LCD or self-orthogonal in terms of the ranks of G and GG T . Proof. It is clear that the dimension of C D is equal to the rank of the row vectors of G. Therefore C D is an [n, κ] linear code with κ = Rank(G). We denote by that is . This completes the proof.
From Proposition 1, we immediately get the condition on the code C D to be LCD or self-orthogonal. Corollary 1. Let C D be the linear code of (2). Then C D is LCD (resp. selforthogonal) if and only if Rank(GG T ) = Rank(G) (resp. GG T = 0).
Note that the matrix G of (1) is formed by all elements in the set D. Therefore, in order to construct LCD or self-orthogonal codes using the generic method introduced above, the key point is to choose an appropriate defining set D. This will be the focus of the next sections.

p-ary LCD codes and self-orthogonal codes from the generic construction
In this section, we shall construct four classes of linear codes from the generic construction mentioned above using the following four types of defining sets. It will be shown that the proposed linear codes contain infinite families of LCD codes and self-orthogonal codes. We follow the notation in Section 2.
For any positive integers Let D ≤t be the set of nonzero vectors in F m p with weight no more than t, that is and 3.1. LCD and self-orthogonal codes from D t and their duals. From now on, we always suppose that n t = #D t . Then, Proof. The conclusion of the case t = 1 follows directly from the definition of G t . We now prove the case t ≥ 2. Let c i be the i-th row vector of G t . Then, for i ∈ {1, 2, · · · , m}, and for i = j. This completes the proof.
The proof is divided into the following two cases.
The conclusion directly follows from Lemmas 3.2 and 3.3.
Proposition 2. Let t be a positive integer with 1 ≤ t ≤ m. Then, • when p = 3, The conclusion then follows from Lemmas 3.1 and 3.4.  Then C Dt is a ternary self-orthogonal code with parameters [24,4,12]. The dual of C Dt is a ternary linear code with parameters [24,20,2], which is almost optimal according to the Database. Example 2. Let p = 3, m = 5 and t = 2. Then C Dt is a ternary LCD code with parameters [40, 5,16]. The dual of C Dt is a ternary LCD code with parameters [40, 35,2], which is almost optimal according to the Database. Example 3. Let p = 5, m = 3 and t = 2. Then C Dt is a 5-ary self-orthogonal code with parameters [48, 3,32]. The dual of C Dt is a 5-ary linear code with parameters [48, 45, 2], which is optimal according to the Database.

LCD and self-orthogonal codes from D t and their duals.
Recall that D t = D t ∪ D m . Let G t = [g 1 , · · · , g nt , G m ] be the matrix formed by all the elements of D t . Note that This together with Proposition 1 yields Let p > 3, by Lemma 3.3, one has Rank(G t G T t ) = 0 . Combining this and Proposition 1 gives dim Fp (C Dt ∩ C ⊥ Dt ) = dim Fp (C Dt ). Thus, we obtain the following.   [20,3,12] which is almost optimal according to the Database. The dual of C Dt is a ternary LCD code with parameters [20,17,2], which is almost optimal according to the Database.  3.3. LCD and self-orthogonal codes from D ≤t and their duals. In this subsection, we study the linear codes from the defining set D ≤t , where 1 ≤ t ≤ m.
Let G ≤t = [G 1 |G 2 | · · · |G t ] be the matrix formed by the elements of D ≤t . By Lemma 3.1, Rank(G ≤t ) = m.
Let p > 3, by Lemma 3.3, one has Rank(G ≤t G T ≤t ) = 0 . Therefore, we arrive at the following. (2) C D ≤t is LCD, if and only if Then C D ≤t is a ternary LCD code with parameters [18,3,10]. The dual of C D ≤t is a ternary LCD code with parameters [18,15,2], which is almost optimal according to the Database.
Example 8. Let p = 3, m = 5 and t = 2. Then C D ≤t is a ternary self-orthogonal code with parameters [50, 5,18]. The dual of C D ≤t is a ternary linear code with parameters [50, 45, 2], which is almost optimal according to the Database.
Example 9. Let p = 5, m = 3 and t = 2. Then C D ≤t is a 5-ary self-orthogonal code with parameters [60, 3,36]. The dual of C D ≤t is a 5-ary linear code with parameters [60, 57, 2], which is optimal according to the Database.
3.4. LCD and self-orthogonal codes from D ≤t and their duals. Note that D ≤t = D ≤t ∪ D m . We state the following results on C D ≤t without proof since the proofs are similar to the case of C D ≤t .  Example 11. Let p = 3, m = 3 and t = 2. Then C D ≤ t is a ternary self-orthogonal code with parameters [26,3,18] which is optimal according to the Database. The dual of C D ≤ t is a ternary linear code with parameters [26,23,2], which is optimal according to the Database.
Example 12. Let p = 5, m = 3 and t = 2. Then C D ≤ t is a 5-ary self-orthogonal code with parameters [124, 3,100] which is optimal according to the Database. The dual of C D ≤ t is a 5-ary linear code with parameters [124, 121, 2], which is optimal according to the Database.

The weight distributions of these linear codes
In this section we follow the notation in Section 3. In general it is difficult to determine the minimal distance of the aforementioned four classes of linear codes although we determined the minimal distance of their duals. However, this can be done in some special cases. Actually, we can establish the weight distribution of these linear codes we have constructed. Our main mathematical tool is the Krawtchouk polynomials which are closely related to coding theory [16] and cryptography.

Krawtchouck polynomials.
For any prime power q and positive integers x, m, the Krawtchouk polynomial K q,i (x, m) of degree i is defined as In 1957, Lloyd [24], in his work on perfect codes, was the first to use the Krawtchouk polynomial in connection with coding theory. Krawtchouk polynomials have applications in computing the weight distribution of codes. Let C be an [n, k] code over F q with weight distribution {1, A 1 , · · · , A n }, and let the weight distribution of the dual code C ⊥ be {1, A ⊥ 1 , · · · , A ⊥ n }. Then we have the following set of equations involving Krawtchouk polynomials, which is equivalent to the MacWilliams equations. Now let us focus on the case of q = p. We write The following properties of the Krawtchouk polynomial will be needed later.  Lemma 1, [6]). Let m, k, r be integers such that m, k ≥ 1 and 0 ≤ r ≤ m. Then we have Lemma 4.2 (Lemma 2.6.2, [17]). For any fixed vector w ∈ F m p with wt(w) = k, we have ) is the primitive p-th root of unity in the field of complex numbes.

4.2.
The weight distribution of C Dt . Theorem 4.3. Let C Dt be the linear codes in Theorem 3.5 with 1 ≤ t ≤ m, and n = (p − 1) t m t . Then C Dt is an [n, m] linear code with the weight distribution given in Table 1.
Proof. The length and dimension of C Dt follow from Theorem 3.5. Therefore, we only need to calculate its weight distribution. Let c a = (a · g 1 , a · g 2 , · · · , a · g n ) be any codeword in C Dt , where a ∈ F m p . Then the weight of c a is equal to n − N a , where N a = |{x ∈ F m p : wt(x) = t and a · x = 0}|. Let wt(a) = k, where k is an integer with 0 ≤ k ≤ m. Clearly there are (p − 1) k m k vectors a in F m p with wt(a) = k. In terms of exponential sums, the weight of c a can be calculated as follows: Example 13. Let p = 3, m = 3. Then the weight enumerator of C D2 is 1 + 8z 6 + 6z 8 + 12z 10 .
4.3. The weight distribution of C D ≤t . In this subsection, we establish the weight distribution of the linear codes C D ≤t . We have the following results.  Table 2.    Table 4.

Conclusion
In this paper, several classes of p-ary linear codes were constructed by generalizing a previous construction of binary ones. Their parameters were studied and their properties to be LCD or self-orthognal were also characterized. The duals of these codes were also given. Some of these codes are optimal or almost optimal. The weight distributions of these linear codes were established as well.