1 Introduction
Let denote the finite field of order , where is a prime power. An code over is a
dimensional vector subspace of
. A code over is called binary and a code over is called ternary. The parameters and are called the length and dimension of , respectively. Two codes and over are equivalent, denoted , if there is an monomial matrix over with .The dual code of an code over is defined as where is the standard inner product. A code is called linear complementary dual (or a linear code with complementary dual) if , where denotes the zero vector of length . We say that such a code is LCD for short. LCD codes were introduced by Massey [11] and gave an optimum linear coding solution for the two user binary adder channel. Recently, much work has been done concerning LCD codes for both theoretical and practical reasons (see [3], [4], [5], [8] and the references therein). In particular, we emphasize the recent work by Carlet, Mesnager, Tang, Qi and Pellikaan [4]. It has been shown in [4] that any code over is equivalent to some LCD code for . This motivates us to study binary LCD codes and ternary LCD codes. In addition, recently, Carlet, Mesnager, Tang and Qi [3] have established the mass formulas. This motivates us to start a classification of binary LCD codes and ternary LCD codes. The aim of this note is to give a complete classification of binary linear complementary dual codes of lengths up to and ternary linear complementary dual codes of lengths up to .
The note is organized as follows. In Section 2, definitions, notations and basic results are given. We give some observation on the classification of binary LCD codes and ternary LCD codes with . Section 2 also presents the mass formulas given in [3] for binary LCD codes and ternary LCD codes. The mass formulas are an important role in the classification of binary LCD codes and ternary LCD codes. In Section 3, we give a complete classification of binary LCD codes and ternary LCD codes for . In Section 4, we give a complete classification of binary LCD codes of lengths up to . In Section 5, we give a complete classification of ternary LCD codes of lengths up to .
2 Preliminaries
2.1 Definitions, notations and basic results
Let be an code over . The weight of a vector is the number of nonzero components of . A vector of is called a codeword of . The minimum nonzero weight of all codewords in is called the minimum weight of and an code with minimum weight is called an code. The weight enumerator of is given by , where is the number of codewords of weight in . An automorphism of is an monomial matrix over with . The set consisting of all automorphisms of is called the automorphism group of and it is denoted by . A generator matrix of is a matrix whose rows are a set of basis vectors of . A paritycheck matrix of is a generator matrix of .
Throughout this note, we use the following notations. Let denote the zero vector of length and let denote the allone vector of length . Let
denote the identity matrix of order
and let denote the transpose of a matrix .The following characterization is due to Massey [11].
Proposition 1.
Let be a code over . Let and be a generator matrix and a paritycheck matrix of , respectively. Then the following properties are equivalent:

is LCD,

is LCD,

is nonsingular,

is nonsingular.
The following proposition is trivial.
Proposition 2.
Suppose that is an LCD code over and . If is equivalent to , then is also LCD.
Throughout this note, we use the following notations. Let denote the set of all inequivalent binary LCD codes. Let denote the set of all inequivalent binary LCD codes. Let denote the set of all inequivalent ternary LCD codes. Let denote the set of all inequivalent ternary LCD codes.
2.2 LCD codes with
Let be an code over . Define the following code:
(1) 
Let be an code over with . It is easy to see that there is an code over with . It is trivial that is LCD if and only if is LCD. In this way, every LCD code over with is constructed from some LCD code over . In addition, two LCD codes over with are equivalent if and only if two LCD codes over are equivalent. Hence, all LCD codes over with , which must be checked to achieve a complete classification, can be obtained from all inequivalent LCD codes over . Therefore, we have the following:
Proposition 3.
Let denote the set of all inequivalent binary LCD codes with . Let denote the set of all inequivalent ternary LCD codes with .

There is a set of all inequivalent binary LCD codes such that .

There is a set of all inequivalent ternary LCD codes such that .
2.3 Mass formulas
It is trivial that and are the unique LCD code over and the unique LCD code over , respectively. From now on, we assume that
for an LCD code over .
Let denote the set of all inequivalent binary LCD codes. Using the Gaussian binomial coefficients, the following values
(2) 
were determined theoretically in [3, Corollary 4.8], without finding the set , as follows:
where
and . The value is the number of the distinct binary LCD codes.
Let denote the set of all inequivalent ternary LCD codes. Similar to the above, the following values
(3) 
were determined theoretically in [3, Corollary 5.9], without finding the set , as follows:
The value is the number of the distinct ternary LCD codes. The equations (2) and (3) are called the mass formulas.
3 Classification for dimensions and
In this section, we give a complete classification of binary LCD codes and ternary LCD codes for .
Proposition 4.
Let denote the set of all inequivalent binary LCD codes. Let denote the set of all inequivalent binary LCD codes.
Proof.
By considering a permutation of the coordinates, we may assume without loss of generality that a binary code has generator matrix of the form , where . We denote the code by . It is trivial that is LCD if and only if is even. If , then it is trivial that and are equivalent. If , then and are inequivalent since has weight enumerator . Hence, and are inequivalent if and only if . The first two parts (i) and (ii) follow.
If is odd, then is the unique binary LCD code. If is even and , then is a binary LCD code. The last part (iii) follows from (ii). ∎
We give a complete classification of ternary LCD codes for .
Proposition 5.
Let denote the set of all inequivalent ternary LCD codes. Let denote the set of all inequivalent ternary LCD codes.
Proof.
By considering equivalent codes, we may assume without loss of generality that a ternary code has generator matrix of the form , where . We denote this code by . It is trivial that is LCD if and only if . If , then it is trivial that and are equivalent. If , then and are inequivalent since has weight enumerator . Hence, and are inequivalent if and only if . The first two parts (i) and (ii) follow.
If , then is the unique ternary LCD code. If and , then is a ternary LCD code. The last part (iii) follows from (ii). ∎
4 Classification of binary LCD codes of lengths up to 13
In this section, we give a complete classification of binary LCD codes of lengths up to . It is sufficient to consider , since the dual code of a binary LCD code is also LCD.
We describe how to complete a classification of binary LCD codes of lengths up to . Every binary LCD code is equivalent to a binary code with generator matrix of the form , where is a matrix. The set of matrices was constructed, row by row. Permuting the rows and columns of gives rise to different generator matrices which generate equivalent binary codes. Here, we consider some natural (lexicographical) order on the set of vectors of length . We consider only matrices , satisfying the condition , where is the th row of . It is obvious that all binary codes, which must be checked to achieve a complete classification, can be obtained. By this method, we found all distinct binary LCD codes, which must be checked to achieve a complete classification for . By determining the equivalence or inequivalence for a given pair of binary codes, we obtained the set of all inequivalent binary LCD codes. The mass formula (2) shows that there is no other binary LCD code. This computation was performed in Magma [2]
. In principle, such a computation can be done by classifying binary LCD codes by the
Magma function IsIsomorphic, then their automorphism groups can be calculated by AutomorphismGroup.For and , the mass formula (2) was used to complete the classification, due to the computational complexity. Let denote the set of all inequivalent binary LCD codes with . By Proposition 3, there is a set of all inequivalent binary LCD codes such that , where the construction of is listed in (1). Note that is constructed by considering the dual codes of the all inequivalent binary LCD codes for the case . Hence, it is sufficient to find all binary LCD codes with , which must be checked further for equivalences. For these lengths, the set of matrices was constructed, column by column. Here, we consider some natural (lexicographical) order on the set of nonzero vectors of length . We consider only matrices , satisfying the condition , where is the th column of . In this way, by adding new binary LCD codes, we continued to construct the set of inequivalent binary LCD codes until reaches the value . When reaches the value , the classification was completed and was obtained.
As a check, in order to verify that contains no pair of equivalent binary LCD codes and that , we employed the package GUAVA [1] of GAP [6]. This calculation was done by using the functions IsEquivalent and AutomorphismGroup.
In order to illustrate our approach, we consider the case as an example. Let be the binary LCD codes with generator matrices , where are listed in Table 1. We verified that these binary codes are inequivalent. Indeed, the binary codes have weight enumerators , where
This shows also that these binary codes are inequivalent. Since
we have
The mass formula (2) shows that there is no other binary LCD code.


1  2  3  4  
5  6  7  8  

For and , we list in Table 6 the numbers of all inequivalent binary LCD codes and and the numbers of all inequivalent binary LCD codes. We also list the numbers of the dual codes of the inequivalent binary LCD codes. All binary codes in the table can be obtained electronically from http://www.math.is.tohoku.ac.jp/~mharada/LCD2/.


1  144  8  24  
2  12  4  4  
6  4  14400  2  
4  720  288  2880  
12  24  16  48  
4  8  4  4  
36  4  2  2  
8  2880  86400  1  
4  72  864  

The smallest possible automorphism group of a binary LCD code is the trivial group (of order ). It is obvious that the unique binary LCD code has trivial automorphism group. We list in Table 2 the smallest value among the orders of the automorphism groups of binary LCD codes of lengths up to . From the table, we have the following:
Proposition 6.
The smallest length for which there is a binary LCD code of length with trivial automorphism group is .
We remark that the total number of inequivalent binary LCD codes for and is , of which have trivial automorphism groups. The codes have parameters . As an example, we give a binary LCD code with trivial automorphism group. The code has generator matrix , where
Since the smallest possible automorphism group of a binary LCD code is the group of order , there are at least inequivalent binary LCD codes. From
we have
Hence, there are at least inequivalent binary LCD codes of length . Of course, many binary LCD codes have substantial automorphism groups. Thus, the above might be a poor lower bound. Indeed, there are inequivalent binary LCD codes of length , although we have
We continued the above process and completed a classification of binary LCD codes for small dimensions. More precisely, we give a classification of binary LCD codes for and binary LCD codes for . In order to save space, we only list in Table 3 the numbers of all inequivalent binary LCD codes for and , respectively.


66  136  270  431  
73  166  286  495  
93  178  335  
101  214  354  
126  228  410  
380  1120  2648  6074  
576  1468  3608  7580  
772  2058  4568  9870  

We end this section with giving the following remark.
5 Classification of ternary LCD codes of lengths up to 10
By an approach is similar to that used in the previous section, we completed a classification of ternary LCD codes for . For , we found all distinct ternary LCD codes, which must be checked to achieve a complete classification. By determining the equivalence or inequivalence for a given pair of ternary codes, we obtained the set . The mass formula (3) shows that there is no other ternary LCD code. For and , the mass formula (3) was used to complete the classification, due to the computational complexity. For ternary LCD codes, the following method was employed. To test equivalence of ternary codes by a program in the language C, we used the algorithm given in [9, Section 7.3.3] as follows. For a ternary code , define the digraph with vertex set and arc set . Then, two ternary codes and are equivalent if and only if and are isomorphic. We used nauty [12] for digraph isomorphism testing. The automorphism group is isomorphic to the automorphism group of . This calculation was also done by using nauty [12].
As a check, in order to verify that contains no pair of equivalent ternary LCD codes and that , we employed the following method obtained by applying the method given in [10, Section 2]. Let be a ternary code. We expand each codeword of into a binary vector of length by mapping the elements and of to the binary vectors and , respectively. If there is a positive integer such that the codewords of weight generate , then we have an binary matrix composed of the binary vectors obtained from the codewords of weight in . If there is no positive integer such that the codewords of weight generate , then by considering all codewords of , we have a binary matrix . Then, from , we have an incidence structure having points. This calculation was done by using the Magma function IncidenceStructure. If and are equivalent ternary codes, then and are isomorphic. By the Magma function IsIsomorphic, we verified that all incidence structures are nonisomorphic. The automorphism group is isomorphic to the stabilizer of inside of the automorphism group of the incidence structure . This calculation was done by using the Magma functions AutomorphismGroup and Stabilizer.
We list in Table 4 the numbers of the inequivalent ternary LCD codes and the numbers of the inequivalent ternary LCD codes for and . We also list the numbers of the dual codes of the inequivalent ternary LCD codes. All ternary codes in the table can be obtained electronically from http://www.math.is.tohoku.ac.jp/~mharada/LCD3/.


4  2  2  2  2  
7  3  3  1  4  3  
11  4  4  2  1  7  4  
17  7  8  2  7  8  2  
16  4  6  3  3  11  5  
36  11  17  7  1  17  17  2  
24  5  7  4  6  2  16  8  
74  16  31  19  8  36  37  1  
121  36  64  19  2  36  64  19  2  
33  6  8  5  9  4  1  24  9  
149  24  51  40  31  3  74  74  1  
379  74  178  105  22  121  218  40  
45  6  10  6  11  8  3  1  33  12  
290  33  80  70  84  22  1  149  140  1  
1293  149  458  431  249  6  379  821  93  
2318  379  1209  665  65  379  1209  665  65  



4  96  8  11520  
8  16  1920  96  
32  384  48  8  
8  24  8  2  

The smallest possible automorphism group of a ternary LCD code is the group of order . We list in Table 5 the smallest value among the orders of the automorphism groups of ternary LCD codes for . From the table, we have the following:
Proposition 8.
The smallest length for which there is a ternary LCD code of length with automorphism group of order is .
We remark that the total number of inequivalent ternary LCD codes for and is , one of which has automorphism group of order . The code has parameters . As an example, we give a ternary LCD code with automorphism group of order . The code has generator matrix , where
Since the smallest possible automorphism group of a ternary LCD code is the group of order , there are at least inequivalent ternary LCD codes. From
we have
Hence, there are at least inequivalent ternary LCD codes of length . Of course, many ternary LCD codes have substantial automorphism groups. Thus, the above might be a poor lower bound. Indeed, there are inequivalent ternary LCD codes of length , although we have
Similar to Remark 7, we end this section with giving the following remark.
Remark 9.
Acknowledgment. This work was supported by JSPS KAKENHI Grant Number 15H03633.
References
 [1] R. Baart, T. Boothby, J. Cramwinckel, J. Fields, D. Joyner, R. Miller, E. Minkes, E. Roijackers, L. Ruscio and C. Tjhai, GAP package GUAVA, Version 3.1.3; 2016, Available online at http://www.gapsystem.org/Packages/guava.html.
 [2] W. Bosma, J. Cannon and C. Playoust, The Magma algebra system I: The user language, J. Symbolic Comput. 24 (1997), 235–265.
 [3] C. Carlet, S. Mesnager, C. Tang and Y. Qi, New characterization and parametrization of LCD codes, arXiv:1709.03217.
 [4] C. Carlet, S. Mesnager, C. Tang, Y. Qi and R. Pellikaan, Linear codes over are equivalent to LCD codes for , IEEE Trans. Inform. Theory 64 (2018), 3010–3017.
 [5] L. Galvez, J.L. Kim, N. Lee, Y.G. Roe and B.S. Won, Some bounds on binary LCD codes, Cryptogr. Commun. 10 (2018), 719–728.
 [6] The GAP Group, GAP–Groups, Algorithms, and Programming, Version 4.8.10; 2018, Available online at http://www.gapsystem.org.
 [7] M. Grassl, Code tables: Bounds on the parameters of various types of codes, Available online at http://www.codetables.de/, Accessed on 20180330.
 [8] M. Harada and K. Saito, Binary linear complementary dual codes, arXiv: 1802.06985.
 [9] P. Kaski and P.R.J. Östergård, Classification Algorithms for Codes and Designs, Springer, Berlin, 2006.
 [10] C.W.H. Lam, L. Thiel and A. Pautasso, On ternary codes generated by Hadamard matrices of order , Congr. Numer. 89 (1992), 7–14.
 [11] J.L. Massey, Linear codes with complementary duals, Discrete Math. 106/107 (1992), 337–342.
 [12] B.D. McKay and A. Piperno, nauty and Traces User’s Guide (Version 2.6), Available online at http://users.cecs.anu.edu.au/~bdm/nauty/nug26.pdf.