1 Introduction
Let denote the finite field of order , where is a prime power. The dual code of an code over is defined as where for . Let
denote the zero vector of length
. A code over is called linear complementary dual (LCD for short) if .LCD codes were introduced by Massey [5] 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. In particular, Carlet, Mesnager, Tang, Qi and Pellikaan [4] showed that any code over is equivalent to some LCD code for . This motivates us to study LCD codes over . Codes over are called ternary. In this note, we study ternary LCD codes. We take the elements of to be .
It is a fundamental problem to determine the largest minimum weight among all ternary LCD codes, and complete the classification of ternary LCD codes for a given pair . The classification of ternary LCD codes for and ternary LCD codes for was done in [1]. Recently, the largest minimum weights have been determined for [6]. In this note, we study the largest minimum weights for , and the largest minimum weights for .
This note is organized as follows. In Section 2, we show that there is no ternary LCD code for . Also, we construct ternary LCD codes for , , , , , , , , , , and . Applying the methods in [6] to the above two results, we determine for
In addition, we give some bounds on for . In Section 3, we determine the largest minimum weights for . As a consequence, we determine , when
for a nonnegative integer . We also give some bounds on for . Finally, in Section 4, we completely determine for .
All computer calculations in this note were done by programs in Magma [2] and programs in the language C.
2 Dimension 4
Recently, the largest minimum weights among all ternary LCD codes have been determined in [6] for . In this section, we determine for .
2.1 Classification method
A shortened code of a ternary code is the set of all codewords in which are in a fixed coordinate with that coordinate deleted. A shortened code of a ternary code with is a ternary code if the deleted coordinate is a zero coordinate and a ternary code with otherwise. A ternary code gives shortened codes, and at least codes among them are ternary codes with . Hence, by considering the inverse operation of shortening, every ternary code with is constructed from some ternary code with . This method is useful for low dimensions.
By the above method, in this section, we give a classification of ternary codes for some . We explicitly describe how our computer calculation for the classification was done. By considering equivalent ternary codes, we may assume that a ternary code has the following generator matrix:
(1) 
where denotes the allone vector of length , and is denoted by . We find all inequivalent ternary codes with , by checking equivalences among obtained codes. For each of the inequivalent ternary codes with generator matrices (1), by considering the inverse operation of shortening, we may assume that a ternary code with has the following generator matrix:
(2) 
where , under the condition that for and . In this way, we find all ternary codes with , which must be checked further for equivalences. By checking equivalences among these codes, we find all inequivalent ternary codes. In addition, for each of the inequivalent ternary codes with generator matrices (2), by considering the inverse operation of shortening, we may assume that a ternary code has the following generator matrix:
where , under the condition that for and . In this way, we find all ternary codes, which must be checked further for equivalences. Finally, by checking equivalences among these codes, we find all inequivalent ternary codes.
2.2 Upper bounds on and results from [6]
Suppose that there is an (unrestricted) ternary code. By the Griesmer bound, we have
Write . Then we have , where are listed in Table 1 for each ( if and if ).



The following results in [6] are an important tool for the determination of , especially .
Lemma 1 (Saito [6]).
Let be a positive integer. If there is a ternary LCD code, then there is a ternary LCD code.
Lemma 2 (Saito [6]).
Suppose that
If there is no ternary LCD code with , then there is no ternary LCD code with for a positive integer .
2.3 Results on
By the method given in Section 2.1, our computer search found ternary LCD codes for
Throughout this section, to save space, using vectors of length in Table 2, we give construction of as follows. For a generator matrix of , let be the number of the columns of , which are equal to , where
denotes the identity matrix of order
and denotes the transpose of . It is trivial that the numbers construct , up to equivalence. The numbers are listed in Table 4 for (. By Lemma 1 and Table 1, we have the following:Theorem 3.
Suppose that
Then there is a ternary LCD code, and for a nonnegative integer .



1  2  3  4  5  
6  7  8  9  10  
11  12  13  14  15  
16  17  18  19  20  
21  22  23  24  25  
26  27  28  29  30  
31  32  33  34  35  
36  37  38  39  40  

By the method given in Section 2.1, our exhaustive computer search completes the classification of (unrestricted) ternary codes for
The results are as follows:
Lemma 4.

There is a unique ternary code, up to equivalence. The unique code is not LCD.

There is a unique ternary code, up to equivalence. The unique code is not LCD.

There is a unique ternary code, up to equivalence. The unique code is not LCD.

There are two inequivalent ternary codes. None of the two codes and is LCD.
In order to give and , the numbers are listed in Table 4.
For the above classification, we used a computer with CPU Intel(R) Core(TM) i9 9900K, 8 Cores. The next case is to complete a classification of ternary codes. Our computer search found that there are inequivalent ternary codes. We tried to find all ternary codes for some codes as the first step. The computer calculation to find all ternary codes did not end even after one month. Our feeling is that the computation for the complete classification is beyond our current computer resources.
In addition, our computer search found a ternary LCD code for
In order to give (), the numbers are listed in Table 4. By Lemma 1, we have the following:
Lemma 5.
Suppose that . Then there is a ternary LCD code for a nonnegative integer .
Theorem 6.

Suppose that
Then there is no ternary LCD code for a nonnegative integer .

Let be a nonnegative integer. Then
Proof.
The largest minimum weight among (unrestricted) ternary code is (see [3]). By Lemma 5 and Table 1, and if .
Now, suppose that . By Lemma 4, there is no ternary LCD code. Hence, by Lemma 2, there is no ternary LCD code with for . It is easy to see that if there is a ternary LCD code with , then there is a ternary LCD code. Since
there is no ternary LCD code with for . This completes the proof of the assertion (1). The assertion (2) follows from (1) along with Lemma 5. ∎
3 Lengths up to 20
In this section, we determine the largest minimum weights among all ternary LCD codes for . We also give some bounds on for .
We describe how our computer calculation determined the minimum weights . Let denote the largest minimum weight among all (unrestricted) ternary codes. For a fixed parameters , we checked whether there is a ternary LCD code or not, by using either the inverse operation of shortening given in the previous section, or the following method. If there is no ternary LCD code, then we checked whether there is a ternary LCD code or not. By continuing this process, we determined the minimum weights .
Every ternary code is equivalent to a code with generator matrix of the form , where is a matrix. Let be the th row of . Here, we may assume that satisfies the following conditions:

,

the weight of is at least ,

the first nonzero element of is ,

if and if ,
where we consider some order on the set of vectors of length . The set of matrices is constructed, row by row, under the condition that the minimum weight of the ternary code with generator matrix:
is at least for each . It is obvious that the set of the ternary codes obtained in this approach contains a set of all inequivalent ternary codes.
In this way, the largest minimum weights are determined for . For and , we give some bounds on . The largest minimum weights are known for . Also, are determined in the next section for . In Table 3, we only list for . For the parameters in the table, a ternary LCD code can be obtained electronically from http://www.math.is.tohoku.ac.jp/~mharada/Paper/LCD3.txt.



4  5  6  7  8  9  10  11  12  13  14  15  
11  6  5  4  
12  6  5  5  4  
13  7  6  6  5  4  
14  8  7  6  6  5  4  
15  8  8  7  6  5  4  4  
16  9  8  7  6  6  5  4  4  
17  10  9  8  7  6  6  5  4  4  
18  10  9  9  8  7  6  6  5  4  4  
19  11  10  9  8, 9  8  7  6  6  5  4  4  
20  12  11  10  8, 9  8, 9  7, 8  7  6  5, 6  5  4  3, 4 

Now, we emphasize that there is a ternary LCD code meeting the Griesmer bound for , , and (see Table 3). We denote these codes by , respectively. For a generator matrix of , the matrices are listed in Figure 1. By the Griesmer bound and Lemma 1, we have the following:
Theorem 7.
Let be a nonnegative integer. Suppose that
Then there is a ternary LCD code, and .
4 Dimensions
As described in the end of the previous section, in this section, we determine for .
The following lemma is a key idea for the determination of for .
Lemma 8.
Let be an integer with . If , then .
Proof.
Let be a ternary code with generator matrix of the form:
The code is LCD, since . By the construction, it is trivial that has minimum weight .
Suppose that there is a ternary code. By the spherepacking bound, if , then . The result follows. ∎
Proposition 9.
Proposition 10.
Proof.
By [1, Proposition 5], . From [1, Table 4], it is known that for . If , then by Lemma 8. It is known that the largest minimum weight among (unrestricted) ternary code is if (see [3]). Our exhaustive computer search verified that no ternary code is LCD for , using the method in Section 3. As described in the proof of Lemma 8, it is easy to construct a ternary LCD code for . The result follows. ∎
Proposition 11.
Proof.
It is known that the largest minimum weight among (unrestricted) ternary code is if . Let be the ternary code with generator matrix where
We define the matrices () by deleting the last rows of . Then let () be the ternary code with generator matrix We verified that is a ternary LCD code for . In addition, our exhaustive computer search verified that no ternary code is LCD for , using the method in Section 3. The result follows. ∎
Acknowledgment. This work was supported by JSPS KAKENHI Grant Numbers 15H03633 and 19H01802.
References
 [1] M. Araya and M. Harada, On the classification of linear complementary dual codes, Discrete Math. 342 (2019), 270–278.
 [2] W. Bosma, J. Cannon and C. Playoust, The Magma algebra system I: The user language, J. Symbolic Comput. 24 (1997), 235–265.
 [3] A.E. Brouwer, Bounds on the size of linear codes, Handbook of Coding Theory, pp. 295–461, NorthHolland, Amsterdam, 1998.
 [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] J.L. Massey, Linear codes with complementary duals, Discrete Math. 106/107 (1992), 337–342.
 [6] K. Saito, Nonexistence of certain binary and ternary linear complementary dual codes, (submitted), arXiv:1908.03294.