1. Introduction
Let be a finite field with q elements and be the n-dimensional vector space over . The (Hamming) distance between two vectors , is the number of coordinate positions in which they differ, and the (Hamming) weight wt of a vector is the number of its non-zero coordinates. A linear q-ary code C is a k-dimensional subspace of the vector space , and d is the smallest weight among all non-zero codewords of C, called the minimum weight (or minimum distance) of the code. By , we denote the maximum value of the minimum distance d such that there exists a linear code. Linear codes are called d-optimal (or simply optimal, if it is clear that optimality is considered with respect to the minimum distance). In this research, we study and classify d-optimal linear codes over and .
If is equipped with an inner product, the orthogonal complement for all of the linear code C is its dual (or orthogonal) code. In this paper, we use only the standard Euclidean inner product for any two vectors , . The intersection is called the hull of C and is denoted by . Since , the dimension of the hull can be at least 0 and at most . If , the code is called self-orthogonal, and then . If , the code is called a linear complementary dual (LCD) code.
The main goal of this work is to investigate the dimensions of the hulls of optimal linear codes over fields with 2 and 3 elements. The papers [
1,
2,
3] are the basis of our interest in this problem. In [
1], the authors study some properties of binary linear codes with various hull dimensions and prove a new mass formula for the number of these codes. They introduce the function
, which gives the maximum possible minimum distance for which there exists a binary linear
code
C with
, and present some classification results for binary linear codes with various hull dimensions. The paper [
2] is a continuation of the one already described, in which the authors continue their research, but on linear codes over larger finite fields. In addition, they present some classification results on ternary linear codes with various hull dimensions. These two papers investigate the following problem: To determine the value of the function
and to construct and classify
codes for given values of length
n, dimension
k and hull dimension
ℓ over
. We consider a slightly different problem, namely: To determine the hull dimensions of
d-optimal linear
codes over
and
.
The authors in [
3] analyze the sequence of numbers of linear codes with increasing hull dimension but the same length
n and dimension
k. They prove that the number of all
q-ary linear codes of a given length
n and dimension
k decreases when the hull dimension increases, for all values of
n,
and
q. Furthermore, they present the conjecture that the same is true if we consider not the number of all codes, but only the inequivalent ones among them (with the only restriction that, in some cases, the number of inequivalent LCD codes may be less than the number of inequivalent codes with a one-dimensional hull). In addition, the authors classify all linear, self-orthogonal and LCD codes for various values of
n and
k over
and
. They pay special attention to the fact that such inequalities will not hold when only optimal codes are considered. This motivates us to study the optimal codes and see what happens to their hulls and whether their hull dimensions depend in any way on the other parameters.
The obtained results can be applied to the construction of entanglement-assisted quantum error-correcting codes (EAQECCs) [
4,
5,
6]. An EAQECC with parameters
encodes
k logical qubits into
n physical qubits with the help of
c pre-shared entangled pairs. A useful relation between the parameters of a linear
q-ary code with a given hull dimension and the parameters of an EAQECC is provided in ([
5], Proposition 8). Specifically, if
C is an
linear code with dual distance
and hull dimension
ℓ, then there exist EAQECCs with parameters
and
. We do not examine these EAQECCs further here, but checking their parameters could be an interesting direction for future work.
The paper is organized as follows. In
Section 2, we present the necessary definitions and theorems.
Section 3 and
Section 4 are devoted to linear codes with dimensions 2 and 3, respectively. In
Section 5, we study
d-optimal binary linear codes and their hulls for
. Further, in
Section 6, we consider optimal ternary linear codes. In the tables in
Appendix A and
Appendix B, we present our computational results with enumerations of optimal binary and ternary linear codes according to their hull dimensions.
2. Preliminaries
At the beginning, we give a simple proposition that allows us to consider only linear codes without zero coordinates. The dual distance of these codes is at least 2, where the dual distance of a code C is the minimum distance of its dual code .
Proposition 1. If is a linear code, such that , where C has effective length , then .
Let C be a linear code. A matrix whose rows form a basis of C is called its generator matrix. The weight enumerator of C is the polynomial where is the number of codewords of weight i in the code. We also use the following types of binary linear codes defined using the weight enumerator: (1) if for all odd values of i, the code is even-like, and (2) if , the code is said to be self-complementary. The binary self-orthogonal codes are even-like, but there are even-like codes which are not self-orthogonal.
We also need the well-known Griesmer bound [
7].
Theorem 1. If C is a linear code then The codes that meet the Griesmer bound are called Griesmer codes. Obviously, Griesmer codes are d-optimal.
As we present some classification results, we need a definition for the equivalence of codes. Two linear q-ary codes and are equivalent if the codewords of can be obtained from the codewords of via a sequence of transformations of the following types:
- (1)
Permutation on the set of coordinate positions;
- (2)
Multiplication of the elements in a given position by a non-zero element of ;
- (3)
Application of a field automorphism to the elements in all coordinate positions.
An automorphism of a linear code C is a sequence of transformations (1)–(3) that map each codeword of C onto a codeword of the same code. The set of all automorphisms of C forms a group called the automorphism group of the code.
For the considered Euclidean inner product, the dimension of the hull is an invariant of equivalent codes in the cases
and
, but if
, any linear code over
is equivalent to a Euclidean LCD code [
8].
In this work, we use two classes of linear codes that are known to be unique up to equivalence for the given parameters. These are the simplex codes and the MacDonald codes. The
q-ary simplex code
is a linear code over
generated by a
matrix
having as columns a maximal set of nonproportional vectors from the vector space
,
[
9]. It is a one-weight code which means that all its non-zero codewords have the same weight
. In the binary case,
has parameters
, and for
, the code is doubly even. Note that all weights in a doubly even binary code are divisible by 4, and such code is self-orthogonal. The ternary simplex code
has length
and minimum weight
. In our work, we need the following lemmas.
Lemma 1 ([
10], Theorem 1).
Let C be an code over , p a prime, meeting the Griesmer bound. If , then is a divisor of C. Lemma 2 ([
9], Theorem 1.4.10).
A ternary linear code C is self-orthogonal if, and only if, all its weights are divisible by 3. Lemma 3 ([
9], Theorem 1.4.8).
If every codeword of a binary linear code C has weight divisible by four, then C is self-orthogonal. According to these lemmas, the binary simplex codes for , as well as the ternary simplex codes, are self-orthogonal.
Let be the subcode of C consisting of all codewords in C that have zeros on T, where is a set of coordinate positions. is called the shortened subcode of C on the set T. Puncturing C on the set T gives the punctured code , which is a linear code of length .
Theorem 2 ([
9], Theorem 1.5.7).
Let C be an code, and T a set of t coordinate positions. Then: (i) and , and (ii) if , then and have dimensions k and , respectively. MacDonald codes are punctured simplex codes of length
for any
k and
. They have parameters
and are two-weight codes with non-zero weights
and
. Adding
times the simplex code of dimension
k, we obtain the generalized
MacDonald code. Generalized MacDonald codes were introduced by Dodunekov and Simonis in [
11]. They proved that these codes are unique for their parameters. The same holds for
(the simplex code
taken
t times). The replicated simplex codes and the MacDonald codes are Griesmer codes.
For the computations, we have used the program
Generation in the Software Package
QextNewEdition v1.1 [
12]. The classification algorithm implemented in this package is based on isomorph-free generation via canonical augmentation and it is described in detail in [
13].
To compute the hull dimension
ℓ of a linear binary or ternary code
C of length
n, we use the following formula
If
is a generator matrix of
C in systematic form, the matrix
generates the dual code
and
where
is the identity matrix of order
s. To calculate the rank of a matrix, we use Gaussian elimination.
3. Optimal Binary and Ternary Linear Codes of Dimension 2
For dimension 1, it is trivial that the only optimal binary SO codes are the even length repetition codes, i.e., codes for . Similarly, the only optimal LCD codes are the odd length repetition codes, i.e., codes for .
In the ternary case, the optimal code of length n and dimension 1 is the repetition code. It is self-orthogonal, when , and LCD otherwise.
For
, the optimal binary codes have minimum distance
[
14]. A 2-dimensional binary code
C with effective length
n has a generator matrix in the form
where
a,
b and
c are nonnegative integers such that
. The possibilities for
are as follows:
If , C is a self-orthogonal code and so .
If one of the integers a, b or c is odd, and the other two are even, . If we take , then .
In all other cases, C is an LCD code, so .
The hull dimension and the minimum distance of the optimal codes of dimension 2 with effective length
n are presented in
Table 1. Their parameters
d and
h depend on the residue of
n modulo 6. It is worth mentioning that in the case
, there are two inequivalent optimal binary
codes, one of which is self-orthogonal and the other is an LCD code. These codes have generator matrices
and
, respectively, where
There are three inequivalent binary codes with the three possible values of the hull dimension, but the self-orthogonal code with these parameters actually has an effective length .
Consider now the ternary codes of dimension 2 with
. The ternary simplex code of dimension 2 has a generator matrix (up to equivalence)
. Let
C be a ternary
code without zero columns. According to the Griesmer bound,
, where
,
. It follows that
In fact, to prove the above equality, we need examples of codes with the corresponding parameters. Without loss of generality, we can take a generator matrix for the ternary
code
C in the form
The only optimal ternary code is the simplex code, repeated m times, and it is self-orthogonal, . Now, let and , . Without loss of generality, we can take and . Then, . Using the presented equalities and inequalities for , and , we obtain the following possibilities for the code C:
and . In this case, C has a weight enumerator , which shows that it is a self-orthogonal code.
, and . Now, C is an LCD ternary code with weight enumerator .
and . The parameters of C are the same as in the previous two cases, but its hull has dimension 1, and its weight enumerator is .
and . In this case, C has a weight enumerator , which shows that it is a ternary optimal code. Now .
and . In this case, C is an LCD code.
and
, so
C has parameters
. Then, the weight enumerator of
C is
, and its hull has dimension 1. We summarize these results in
Table 2.
4. Optimal Binary Linear Codes of Dimension 3
The optimal self-orthogonal binary codes of dimension 3 are classified in [
15]. We use a similar technique to obtain all inequivalent codes of this dimension and to compute their hulls.
Let
be a generator matrix of the simplex code
. To construct a binary linear
code
C without zero coordinates, we use
copies of the
i-th column of
M. We say that the code
C is defined by the sequence
. Then, the length of
C is
and its non-zero weights are
,
,
,
,
,
, and
. Since
and is 2-transitive, we can take
, and
[
16]. As in [
15], denote
.
In our proofs, we also use the following lemma.
Lemma 4. If the binary code is obtained as a concatenation of the 3-dimensional code and t copies of the simplex code , , then .
Proof. The code
is doubly even and self-orthogonal. Therefore, if
,
,
,
, then
Hence,
if, and only if,
. Since
, we have
Since , the only codeword of C with zeros in the last coordinates is the zero codeword. This gives us that . □
Let , where , . Then, ; hence, , and if . We consider , where if , and if .
Using the Griesmer bound
, we obtain
when
,
when
,
when
, and
when
. Let
C be a binary
, where
Using that
and
, we obtain
Further, we consider the individual cases depending on the value of the parameter r:
() In this case, and so there is a unique binary code which is the repeated simplex code. This code is self-orthogonal.
() Now, and . Using that for , and for , we obtain three possibilities for the sequence , namely:
- –
The hull of the corresponding optimal code has dimension 2.
- –
The corresponding optimal code in this case is a self-orthogonal code with a weight enumerator .
- –
The corresponding optimal code has hull dimension 1.
(
) According to (
2),
or 2. Since
and
, we obtain
, which gives us that
,
. It follows that
. Similarly,
for all
. Therefore, if
, we can consider the code
C as a concatenation of a linear
code
with
copies of the simplex code
. Therefore, it is enough to see what happens when
, 2 and 3.
- –
There are 8 inequivalent
codes without zero columns. The distribution of the dimensions of their hulls is presented in
Table A1.
- –
The inequivalent
codes (with
) are 12. There is only one LCD code with these parameters. The enumeration of codes with these parameters and the possible dimensions of their hulls is given in
Table A1.
- –
The enumeration of the linear codes according to the dimensions of their hulls is the same as the codes. Furthermore, the above reasoning and Lemma 4 prove that the enumeration of the linear codes for is the same.
(
) According to (
2), in this case,
. Since
for
, and
for
, we have
. Using similar considerations as in the second case, we obtain two possibilities for the code
C, namely: (1)
,
, so
C has a weight enumerator
and it is an LCD code, and (2)
,
,
. The corresponding code has a weight enumerator
and
, as the hull consists of the only doubly even codeword and the zero vector.
() There is a unique code. It is obtained from the sequence and has a weight enumerator . Its hull contains only one non-zero vector and this is the codeword of weight .
() In this case, the inequivalent codes are six and correspond to the sequences , , , , , and . The fourth code is LCD, and the last one is self-orthogonal. The other four codes have hulls with dimension 1.
() By similar considerations, we obtain only one possibility for a code up to equivalence, corresponding to the sequence , and it has a weight enumerator . The doubly even codewords form the hull of this code, and hence its hull dimension is .
This completes the classification of the optimal binary codes of dimension 3 according to their hull dimensions.
5. Optimal Binary Codes
In this section, we present and analyze classifications of optimal binary linear codes with
and
. The results are presented in the tables given in
Appendix A. We took the values of
from the Markus Grassl’s code tables [
17].
Our enumerations are compared to the enumeration results for self-orthogonal codes in [
15], for LCD codes in [
18,
19], and for codes with different hulls in [
1]. Furthermore, we compared the classification results of the considered optimal codes with older classification results obtained with different software (see, for example, [
14,
20,
21]). We give three examples.
The optimal
binary codes were first classified in [
20] using two different software systems, namely,
QExtension and
Split. In the same paper, the authors presented classification results for optimal binary codes with dimensions up to 7. For example, the number of
codes is 172, the same that we get.
The classification results for binary self-orthogonal codes in [
15] were obtained by two different methods and two independent algorithms. For example, the number of inequivalent self-orthogonal
codes is 117, the same as in
Appendix A.
Let us look at the LCD
codes. According to [
19], the inequivalent LCD codes with these parameters are 60, but two of them have dual distance 1. This means that they are obtained from
by adding a zero column.
First, we consider simplex, repeated simplex and MacDonald binary codes with dimension
. Binary codes with parameters
for
and
are unique linear codes with these parameters. They are optimal Griesmer self-orthogonal codes. Binary MacDonald codes and generalized MacDonald codes have parameters
. If
, they are self-orthogonal. The corresponding codes, listed in
Appendix A, have parameters
,
,
,
,
, and
.
If , the corresponding code has parameters . It is a punctured code of the repeated simplex code with respect to one coordinate position i; its hull is the shortened code with respect to i and has dimension . In the case , the parameters are . Again, a code with these parameters can be obtained by puncturing the repeated simplex code but with respect to a set of two coordinate positions. Its hull is the shortened code and has dimension . In the tables, these are the codes with parameters , , , , , .
The results listed in the tables show some regularities, which we summarize in the following.
If , and , then all optimal codes are self-orthogonal. Unfortunately, this is not true in the general case. It turns out that, although and , there exists a unique code , but it is not self-orthogonal. The same applies to the unique code . Actually, the hull of is the repeated code of this length and .
If , and , then all optimal codes have hulls with dimension . Although , there is no optimal code with hull dimension 12. In fact, there are three inequivalent codes, two of which are LCD, and the third has a hull of dimension 1.
Although the above observations on codes with an optimal minimum distance multiple of 4 in the presented classification results turn out to be incomplete, if we add more restrictions, we can prove the following theorem.
Theorem 3. If , , , and all optimal binary codes are self-orthogonal, then (1) all codes are self-orthogonal, and (2) the hull of an code has dimension .
Proof. As proven in
Section 3,
when
or
, but in the second case,
, and therefore, we consider only
. The only binary
code is self-orthogonal. Moreover, there is a unique
binary code and its hull has dimension 1.
If
,
and
only if
(see
Section 4). There is a unique
code and it is self-orthogonal. If
, there is only one
binary code (up to equivalence) and its hull has dimension 2.
Let
C be an optimal
code with
. Without loss of generality, we can take a generator matrix of
C in the form
where
generates an
code
.
The matrix
generates a binary
code
,
. According to the requirements in the condition of the theorem,
must be a self-orthogonal code,
. Hence,
for
, and
for
. Moreover,
,
and
are vectors of odd weight. This proves that
C is a self-orthogonal code. □
Next, we continue with our observations on the results presented in the tables.
The only optimal code is the parity-check code of length n. If n is odd, then it is an LCD code, but if n is even, its hull has dimension 1 and contains the all-ones vector.
The optimal binary , and codes are unique for their parameters and all are LCD codes.
Let and . If C is a binary code, then . For example, there exists a unique code and its hull has dimension 2, the two inequivalent codes have hull dimension 4, and the six codes have hulls with dimension 1 (3 codes), 3 (2 codes) and 5 (1 code). The LCD codes in this case (presented in the tables) have parameters , , , , , , and . None of the codes is self-orthogonal.
Proposition 2. Let C be an code with . If , then C is not self-orthogonal.
Proof. Obviously, if , the code is not self-orthogonal. Suppose that and C is a self-orthogonal code. If is the doubly even subcode of C, then is a code that contradicts . Therefore, C cannot be a self-orthogonal code. □
6. Optimal Ternary Codes
We classified ternary linear codes for most integers and . It is worth mentioning that a ternary linear code is self-orthogonal if, and only if, all its weights are divisible by 3 (see Lemma 3). Moreover, the simplex code, repeated m times, , is the only optimal code of the corresponding length and dimension, and it is also self-orthogonal. This means that the only optimal code is self-orthogonal. These are the codes with parameters , , and , which are presented in the tables in the appendix. The codes with parameters , and are MacDonald codes, while the linear and are generalized MacDonald codes, and therefore, they are self-orthogonal.
In the ternary case, we prove a theorem, similar to Theorem 3.
Theorem 4. If , , , and all optimal ternary codes are self-orthogonal, then (1) all codes are self-orthogonal, and (2) the hull of an code has dimension .
Proof. As in the proof of Theorem 3, we consider three cases with respect to the dimension of the codes. If
and
, the length
n must be equal to
. The only
code is self-orthogonal (
Section 3).
Let and , , . According to the Griesmer bound, . Lemma 3 and Lemma 1 give us that all Griesmer codes are self-orthogonal. There is only one code, namely, the ternary simplex code, repeated m times. For and , the corresponding Griesmer codes have parameters and . Such codes exist and they are self-orthogonal.
Let
C be an optimal
code with
. We take a generator matrix of
C in systematic form:
where
generates an
code
.
The matrix
generates a ternary
code
,
. According to the requirements in the condition of the theorem,
must be a self-orthogonal code. Hence,
and
for
, and
for
. This proves that
C is a self-orthogonal code. □
Remark 1. In the tables in Appendix B, there are cases for which and , but nevertheless there are ternary codes that are not self-orthogonal. This is because in these cases, not all optimal ternary codes are self-orthogonal. A more detailed look at these cases, presented in the tables, shows the following: If and for , all optimal codes are self-orthogonal. In all cases except and 7, these codes are unique. There are two inequivalent and again two inequivalent ternary codes. In the case , there are four ternary codes and none of them is self-orthogonal.
If and for , all optimal codes are self-orthogonal except in the case , when there are codes with all possible hull dimensions.
For all parameters for which we were able to classify the optimal codes, we observe the following regularity: If for , then there exists a self-orthogonal code with the exception of one case, namely, , when there is only one code up to equivalence and it is LCD.
7. Conclusions
In this work, we have investigated optimal linear codes over the finite fields and , focusing on the dimension of their hulls. To this end, we performed an extensive classification of binary linear codes with the largest possible minimum distance for lengths and dimensions , with the exception of certain parameter sets where the number of inequivalent codes is prohibitively large. Additionally, we classified ternary linear codes for a substantial range of parameters with and . For all classified codes, we computed the dimension of their hulls.
The results are organized and presented in tabular form in
Appendix A and
Appendix B, providing a comprehensive overview of the data. Several patterns and regularities emerge from the analysis. In some cases, we were able to rigorously describe and prove these regularities. In others, the observations suggest deeper structural properties that merit further investigation.
Finally, we would like to point out several interesting problems for future research.
For which values of k are the optimal binary codes not self-dual?
For which values of n and k, such that , and , do there exist optimal binary codes that are not self-orthogonal?
For which values of are the optimal ternary codes not self-dual?
For which values of n, k and do there exist optimal LCD codes?
It would be of interest to check the parameters of the corresponding EAQECCs in future research.