1 Introduction

Nowadays quantum technologies become crucial to develop different areas of real world-life (see [9, 10, 37, 40, 41]). So, quantum codes are a necessary tool in quantum computation and communication to detect and correct the quantum errors while quantum information is transferred via quantum channel. After the pioneering work in [1, 6], the theory of quantum codes has developed rapidly in recent years. As we know, the approach of constructing new quantum codes which have good parameters is an interesting research field, where quantum codes with good parameters mean that their parameters satisfy the quantum Singleton bound. Many quantum codes with good parameters were obtained from dual-containing classical linear codes concerning Euclidean inner product or Hermitian inner product (see [1, 2, 8, 18,19,20, 23]).

The previously mentioned dual-containing conditions prevent the usage of many common classical codes for providing quantum codes. Entanglement is one of quantum phenomena that characterize quantum mechanics rather than classical mechanics [42]. Recently, Zidan’s model for quantum computing was proposed to solve quantum computing problems based on the degree of entanglement (see [3, 43,44,45]). Brun et al. [5] proposed to share entanglement between encoder and decoder to simplify the theory of quantum error correction and increase the communication capacity. With this new formalism, entanglement-assisted quantum stabilizer codes can be constructed from any classical linear code giving rise to entanglement-assisted quantum error-correcting (EAQEC) codes. Fujiwara et al. [11] gave a general method for constructing entanglement-assisted quantum low-density parity check codes. Fan, Chen and Xu [12] provided a construction of entanglement-assisted quantum maximum distance separable (EAQEC MDS) codes with a small number c of pre-shared maximally entangled states. From constacyclic codes, Chen et al. and Lu et al. constructed new EAQEC MDS codes with larger minimum distance and consumed 4 entanglement bits in [7, 28], respectively. Let \(c = 5\) and \(c = 9\), Mustafa and Emre improved the parameters of EAQEC MDS codes with length n further in [33]. Recently, in [29, 30], we construct new EAQEC codes by using s-Galois dual codes and parts of them are EAQEC MDS codes.

Inspired by these works, in this paper, we first give a new formula for calculating the number c of pre-shared maximally entangled states. Then, using this formula, we construct new EAQEC MDS codes.

The paper is organized as follows. In Sect.2, we recall some basic knowledge on linear codes, s-Galois dual codes and EAQEC codes. In Sect.3, we give a formula for calculating the number c of pre-shared maximally entangled states by using generator matrix of one code and parity-check matrix of the other code. And, in Sect.4, using the formula for calculating the number c, we obtain three classes of new EAQEC MDS codes. Finally, some comparisons of EAQEC MDS codes and conclusions are made.

2 Preliminaries

In this section, we recall some basic concepts and results about linear codes, s-Galois dual codes, and entanglement-assisted quantum error-correcting codes, necessary for the development of this work. For more details, we refer to [4, 5, 11, 13, 24, 25, 30, 32, 39].

Throughout this paper, let p be a prime number and \({\mathbb {F}}_{q}\) be the finite field with \(q=p^{e}\) elements, where e is a positive number. Let \({\mathbb {F}}_{q}^{*}\) be the multiplicative group of units of \({\mathbb {F}}_{q}\).

For a positive integer n, let \({\mathbb {F}}_{q}^n=\{{\mathbf {x}}=(x_1,\cdots ,x_n)\,|\,x_j\in {\mathbb {F}}_{q}\}\) which is an n dimensional vector space over \({\mathbb {F}}_{q}\). A linear \([n,k]_{q}\) code C over \({\mathbb {F}}_{q}\) is an k-dimensional subspace of \({\mathbb {F}}_{q}^{n}\). The Hamming weight \(w_H({\mathbf {c}})\) of a codeword \({\mathbf {c}} \in C\) is the number of nonzero components of \({\mathbf {c}}\). The Hamming distance of two codewords \({\mathbf {c}}_1,{\mathbf {c}}_2 \in C\) is \(d_H({\mathbf {c}}_1,{\mathbf {c}}_2) = w_H({\mathbf {c}}_2-{\mathbf {c}}_1)\). The minimum Hamming distance of C is \(d(C)=\mathrm {min}\{w_H({\mathbf {a}}-{\mathbf {b}})|{\mathbf {a}},{\mathbf {b}}\in C\}\). An \([n,k,d]_{q}\) code is an \([n,k]_{q}\) code with the minimum Hamming distance d. A \(k\times n\) matrix G over \({\mathbb {F}}_{q}\) is called a generator matrix of C, if the rows of G generates C and no proper subset of the rows of G generates C.

2.1 s-Galois dual codes

Let s be an integer with \(0\le s< e \). In [13], Fan and Zhang introduced the following form

$$\begin{aligned}{}[\mathbf{x},\mathbf{y}]_{s}=x_1y_1^{p^{s}}+\cdots +x_ny_n^{p^{s}}, \qquad \forall ~ \mathbf{x},\mathbf{y}\in {\mathbb {F}}_{q}^n, \end{aligned}$$

where \(q=p^e\) and n is a positive integer. We call \([\mathbf{x},\mathbf{y}]_{s}\) the s-Galois form on \({\mathbb {F}}_{q}^n\). It is just the usual Euclidean inner product if \(s=0\). And, it is the Hermitian inner product when e is even and \(s=\frac{e}{2}\). For any code C over \({\mathbb {F}}_{q}\) of length n, let

$$\begin{aligned} C^{\bot _{s}}=\big \{\mathbf{x}\in {\mathbb {F}}_{q} ^n\,\big |\, [\mathbf{c},\mathbf{x}]_{s}=0,\, \forall ~\mathbf{c}\in C\big \}, \end{aligned}$$

which is called the s-Galois dual code of C. It is easy to check that \(C^{\bot _{s}}\) is linear. Then \(C^{\bot _{0}}\) (simply, \(C^{\perp }\)) is just the Euclidean dual code of C, and \(C^{\bot _{\frac{e}{2}}}\) (simply, \(C^{\perp _{H}}\)) is just the Hermitian dual code of C. In particular, if \(C \subset C^{\bot _{s}}\), then C is s-Galois self-orthogonal. Furthermore, we call C is s-Galois self-dual if \(C= C^{\bot _{s}}\).

A parity-check matrix H for a linear code C is a generator matrix for the dual code \(C^{\perp }\).

In fact, the s-Galois form is non-degenerate, i.e., for any \(\mathbf{0}\ne \mathbf{a}\in {\mathbb {F}}_{q} ^n\), there exists a \(\mathbf{b}\in {\mathbb {F}}_{q}^n\) such that \([\mathbf{a},\mathbf{b}]_{s}\ne 0\) ( [13, Remark 4.2]). This implies that \(\dim _{{\mathbb {F}}_{q}}C+\dim _{{\mathbb {F}}_{q}}C^{\perp _{s}}=n\).

For an \(l\times n\) matrix \(A =(a_{ij})_{l\times n}\) over \({\mathbb {F}}_{q}\), where \(a_{ij}\in {\mathbb {F}}_{q}\), we denote \(A^{(p^{e-s})} = (a_{ij}^{p^{e-s}})_{l\times n}\), and \(A^{T}\) as the transpose matrix of A. Then for vector \({\mathbf {a}}=(a_1,a_2,\ldots ,a_n)\in {\mathbb {F}}_{q} ^n\), we have

$$\begin{aligned} {\mathbf {a}}^{p^{e-s}}=(a_1^{p^{e-s}},a_2^{p^{e-s}},\ldots ,a_n^{p^{e-s}}). \end{aligned}$$

For a linear code C of \({\mathbb {F}} _{q}^n\), we define \(C^{(p^{e-s})}\) to be the set \(\{{\mathbf {a}}^{p^{e-s}}\mid ~{\mathbf {a}}\in C\}\) which is also a linear code.

2.2 Entanglement-assisted quantum error-correcting codes

An \([[n,k,d;c]]_q\) EAQEC code over \({\mathbb {F}}_{q}\) encodes k logical qubits into n physical qubits with the help of c copies of maximally entangled states (c ebits). The performance of an EAQEC code is measured by its rate \(\frac{k}{n}\) and net rate \(\frac{k-c}{n}\).

If \(c=0\), then the EAQEC code is a standard stabilizer code. EAQEC codes can be regarded as generalized quantum codes.

It has been proved that EAQEC codes have some advantages over standard stabilizer codes. In [39], Wilde and Brun proved that EAQEC codes can be constructed by using classical binary linear codes. Recently, Luo et al. [26] gave that EAQEC codes can be constructed using non-binary linear codes, and many authors have applied this result to construct EAQEC codes by non-binary linear codes (see [15, 31]).

Proposition 2.1

( [15, 26, 31, 39]) Let \(H_{1}\) and \(H_{2}\) be parity-check matrices of two linear codes \([n,k_1,d_1]_q\) and \([n,k_2,d_2]_q\) over \({\mathbb {F}}_{q}\), respectively. Then an \([[n,k_1+k_2-n+c,\mathrm {min}\{d_1,d_2\};c]]_q\) EAQEC code can be obtained, where \(c=\mathrm {rank}(H_1H_2^{T})\) is the required number of maximally entangled states.

To see how good an EAQEC code is in terms of its parameters, we extend the binary entanglement-assisted quantum Singleton bound in [5] to any finite field \({\mathbb {F}}_{q}\).

Theorem 2.2

Let Q be an \([[n,k,d;c]]_{q}\) EAQEC code constructed by Proposition 2.1, where \(k=k_1+k_2-n+c\). When \(0\le c\le n-1\), it holds that \(2(d-1)\le n-k+c\).

Proof

Let \(C_i\) be an \([n,k_i]_{q}\) linear code over \({\mathbb {F}}_{q}\) for \(i=1,2\). Then, by Singleton bound of classical linear codes over any finite field \({\mathbb {F}}_{q}\), we have \(d(C_1)\le n-k_1+1\) and \(d(C_2)\le n-k_2+1\). It follows that

$$\begin{aligned} 2(d-1)\le & {} (d(C_1)-1)+(d(C_2)-1)=n-k_1+n-k_2\\= & {} n-(k_1+k_2-n+c)+c=n-k+c. \end{aligned}$$

\(\square \)

If an EAQEC code Q with parameters \([[n,k,d;c]]_{q}\) attains the entanglement-assisted quantum Singleton bound \(2(d-1)= n-k+c\), then it is called the entanglement-assisted quantum maximum-distance-separable (EAQEC MDS) code.

3 A new formula for calculating the number c

We first verify the following lemma.

Lemma 3.1

Let C be an \([n,k]_{q}\) linear code over \({\mathbb {F}}_{q}\) with generator matrix G and parity-check matrix H. Then

$$\begin{aligned} (C^{(p^{e-s})})^{\perp }=(C^{\perp })^{(p^{e-s})}. \end{aligned}$$

Proof

By assumptions, it is easy to prove that the matrix \(G^{(p^{e-s})}\) is a generator matrix of the linear code \(C^{(p^{e-s})}\), and the matrix \(H^{(p^{e-s})}\) is a generator matrix of the linear code \((C^{\perp })^{(p^{e-s})}\).

Let \({\mathbf {g}}_1,\ldots ,{\mathbf {g}}_k\) be rows of the G, and let \({\mathbf {h}}_1,\ldots ,{\mathbf {h}}_{n-k}\) be rows of the H. For any \({\mathbf {x}}\in (C^{\perp })^{(p^{e-s})}\), we can assume that

$$\begin{aligned} {\mathbf {x}}=y_1{\mathbf {h}}_1^{p^{e-s}}+\cdots +y_{n-k}{\mathbf {h}}_{n-k}^{p^{e-s}}. \end{aligned}$$
(3.1)

Then, for any \({\mathbf {g}}_j^{p^{e-s}}\in G^{(p^{e-s})}\), by Eq. (3.1), we have

$$\begin{aligned}{}[{\mathbf {x}},{\mathbf {g}}_j^{p^{e-s}}]=\sum _{i=1}^{n-k}y_i[{\mathbf {h}}_i^{p^{e-s}},{\mathbf {g}}_j^{p^{e-s}}]=\sum _{i=1}^{n-k}y_i[{\mathbf {h}}_i,{\mathbf {g}}_j]^{p^{e-s}}=0. \end{aligned}$$

Therefore, \({\mathbf {x}}\in (C^{(p^{e-s})})^{\perp }\), which implies

$$\begin{aligned} (C^{\perp })^{(p^{e-s})}\subset (C^{(p^{e-s})})^{\perp }. \end{aligned}$$
(3.2)

Clearly,

$$\begin{aligned} \mathrm {dim}_{{\mathbb {F}}_q}(C^{\perp })^{(p^{e-s})}=\mathrm {dim}_{{\mathbb {F}}_q}(C^{(p^{e-s})})^{\perp }. \end{aligned}$$
(3.3)

Combining Eqs. (3.2) and (3.3), we have

$$\begin{aligned} (C^{(p^{e-s})})^{\perp }=(C^{\perp })^{(p^{e-s})}. \end{aligned}$$

\(\square \)

Corollary 3.2

Let \(C_i\) be an \([n,k_i,d_i]_q\) linear code over \({\mathbb {F}}_{q}\) with parity-check matrix \(H_i\) for \(i=1,2\). Then an \([[n,k_1+k_2-n+c,\mathrm {min}\{d_1,d_2\};c]]_q\) EAQEC code can be obtained, where \(c=\mathrm {rank}(H_1(H_2^{(p^{e-s})})^{T})\) is the required number of maximally entangled states.

Proof

By Lemma 3.1, \(H_2^{(p^{e-s})}\) is a parity-check matrix of the code \(C_2^{p^{e-s}}\). It is easy to prove that code \(C_2^{p^{e-s}}\) is a linear code with parameters \([n,k_2,d_2]_q\). Then, in light of Proposition 2.1, there exists an EAQEC code with parameters \([[n,k_1+k_2-n+c,\mathrm {min}\{d_1,d_2\};c]]_q\), where \(c=\mathrm {rank}(H_1(H_2^{(p^{e-s})})^{T})\) is the required number of maximally entangled states. \(\square \)

Lemma 3.3

Let \(C_i\) be an \([n,k_i]_{q}\) linear code over \({\mathbb {F}}_{q}\) with generator matrix \(G_i=\begin{pmatrix}{\mathbf {g}}_{i,1}\\ {\mathbf {g}}_{i,2}\\ \vdots \\ {\mathbf {g}}_{i,k_i}\end{pmatrix}\) and parity-check matrix \(H_i=\begin{pmatrix}{\mathbf {h}}_{i,1}\\ {\mathbf {h}}_{i,2}\\ \vdots \\ {\mathbf {h}}_{i,n-k_i}\end{pmatrix}\)for \(i=1,2\). Then

$$\begin{aligned} \mathrm {dim}_{F_q}(C_1\cap C_2^{\perp _s})=k_1+n-k_2-~\mathrm {rank}\begin{pmatrix}G_1\\ H_2^{(p^{e-s})}\end{pmatrix}. \end{aligned}$$
(3.4)

Proof

Let \({\mathbf {a}}\in C_1\cap C_2^{\perp _s}\). Then there exist \(x_1,\ldots ,x_{k_1},y_1,\ldots ,y_{n-k_2}\in {\mathbb {F}}_{q}\) such that

$$\begin{aligned} x_1{\mathbf {g}}_{1,1}+\cdots +x_{k_1} {\mathbf {g}}_{1,k_1}=-y_1{\mathbf {h}}_{2,1}^{p^{e-s}}-\cdots -y_{n-k_2} {\mathbf {h}}_{2,n-k_2}^{p^{e-s}}, \end{aligned}$$

that is, \((x_1,\ldots ,x_{k_1},y_1,\ldots , y_{n-k_2})\) is the solution of a system of linear equations

$$\begin{aligned} x_1{\mathbf {g}}_{1,1}+\cdots +x_{k_1} {\mathbf {g}}_{1,k_1}+y_1{\mathbf {h}}_{2,1}^{p^{e-s}}+\cdots +y_{n-k_2}{\mathbf {h}}_{2,n-k_2}^{p^{e-s}}=0. \end{aligned}$$

Thus,

$$\begin{aligned} \mathrm {dim}_{F_q}(C_1\cap C_2^{\perp _s})= & {} k_1+n-k_2- ~\mathrm {rank}(G_1^T|(H_2^{(p^{e-s})})^T)^T\\= & {} k_1+n-k_2-~\mathrm {rank}\begin{pmatrix}G_1\\ H_2^{(p^{e-s})}\end{pmatrix}. \end{aligned}$$

This proves the Eq. (3.4). \(\square \)

In terms of the generator matrix of one linear code \(C_1\) and the parity-check matrix of the other linear code \(C_2\) over \({\mathbb {F}}_q\), we now give a new formula for computing the number c of pre-shared maximally entangled states.

Theorem 3.4

Let \(C_i\) be an \([n,k_i]_{q}\) linear code over \({\mathbb {F}}_{q}\) with generator matrix \(G_i\) and parity-check matrix \(H_i\) for \(i=1,2\). Then

$$\begin{aligned} c=\mathrm {rank}(H_1(H_2^{(p^{e-s})})^{T})=\mathrm {rank}\begin{pmatrix}G_1\\ H_2^{(p^{e-s})}\end{pmatrix}-k_1. \end{aligned}$$
(3.5)

In particular, taking \(s=0\), we have

$$\begin{aligned} c=\mathrm {rank}(H_1H_2^{T})=\mathrm {rank}\begin{pmatrix}G_1\\ H_2\end{pmatrix}-k_1. \end{aligned}$$
(3.6)

Proof

By Lemma 3.1, we have \(C_2^{\perp _s}=(C_2^{(p^{e-s})})^{\perp }=(C_2^{\perp })^{(p^{e-s})}\). Thus, \(H_2^{(p^{e-k})}\) is a generator matrix of \(C_2^{\perp _s}\), i.e., \(H_2^{(p^{e-k})}\) is a parity-check matrix of \(C_2^{(p^{e-s})}\).

Let \({\mathbf {h}}_{i,1},{\mathbf {h}}_{i,2},\ldots , {\mathbf {h}}_{i,n-k_i}\) be rows of the parity-check matrix \(H_i\) for \(i=1,2\). Then \({\mathbf {h}}_{i,1}^{p^{e-s}}, {\mathbf {h}}_{i,2}^{p^{e-s}},\ldots , {\mathbf {h}}_{i,n-k_i}^{p^{e-s}}\) are rows of the parity-check \(H_i^{(p^{e-s})}\) for \(i=1,2\).

Let \(\sum _{j=1}^{n-k_2} x_j{\mathbf {h}}_{2,j}^{p^{e-s}}\in C_2^{\perp _s}\) , where \(x_j\in {\mathbb {F}}_{q}\) for all \(1\le j\le n-k_2\). Then \(\sum _{j=1}^{n-k_2} x_j{\mathbf {h}}_{2,j}^{p^{e-s}}\in C_1\cap C_2^{\perp _s}\) if and only if for any \(t\in \{1,2,\ldots ,k_1\}\), we have

$$\begin{aligned}{}[\sum _{j=1}^{n-k_2} x_j{\mathbf {h}}_{2,j}^{p^{e-s}},{\mathbf {h}}_{1,t}]=0, \end{aligned}$$

that is

$$\begin{aligned} {\mathbf {x}}H_2^{(p^{e-s})}H_1^{T}=0, \end{aligned}$$

where \({\mathbf {x}}=(x_1,\ldots ,x_{n-k_2})\). Therefore,

$$\begin{aligned} \mathrm {rank}(H_1(H_2^{(p^{e-s})})^{T})=\mathrm {rank}(H_2^{(p^{e-s})}H_1^{T})=n-k_2-\mathrm {dim}_{{\mathbb {F}}_q}(C_1\cap C_2^{\perp _s}). \end{aligned}$$
(3.7)

In light of Lemma 3.3, we have

$$\begin{aligned} \mathrm {dim}_{{\mathbb {F}}_q}(C_1\cap C_2^{\perp _s})=n+k_1-k_2-\mathrm {rank}\begin{pmatrix}G_1\\ H_2^{(p^{e-k})}\end{pmatrix}. \end{aligned}$$

Substituting this value of \(\mathrm {dim}_{{\mathbb {F}}_q}(C_1\cap C_2^{\perp _s})=n+k_1-k_2-\mathrm {rank}\begin{pmatrix}G_1\\ H_2^{(p^{e-k})}\end{pmatrix}\) in Eq. (3.7), we obtain

$$\begin{aligned} c=\mathrm {rank}(H_1(H_2^{(p^{e-s})})^{T})=\mathrm {rank}\begin{pmatrix}G_1\\ H_2^{(p^{e-k})}\end{pmatrix}-k_1. \end{aligned}$$

\(\square \)

Remark 3.5

In the past, the parameter c is computed by using the defining set of constacyclic codes (see [12, 22, 27, 28]). Theorem 3.4 provides a formula for calculating parameter c by using the rank of the matrix formed the generator matrix of one linear code and parity-check matrix of the other linear code over finite field \({\mathbb {F}}_q\).

4 Construction of EAQEC codes

In this section, we give three classes of EAQEC MDS codes.

Combining Corollary 3.2 and Theorem 3.4, we can immediately get the following theorem.

Theorem 4.1

Let \(G_{1}\) be a generator matrix of the linear code \(C_1=[n,k_1,d_1]_q\), and let \(H_2\) be a parity-check matrix of the linear code \(C_2=[n,k_2,d_2]_q\). Then an \([[n,k_1+k_2-n+c,\mathrm {min}\{d_1,d_2\};c]]_q\) EAQEC code can be obtained, where \(c=\mathrm {rank}\begin{pmatrix}G_1\\ H_2\end{pmatrix}-k_1\) is the required number of maximally entangled states.

4.1 The first classes of EAQEC MDS codes

To construct a class of new EAQEC MDS codes by using Theorem 4.1, we consider the Vandermonde matrix.

A Vandermonde \(n\times n\) matrix \(V_n=V(a_1,\ldots ,a_n)\) is defined by

$$\begin{aligned} V_n=V(a_1,\ldots ,a_n)=\begin{pmatrix}1&{}a_1&{}a_1^2&{}\cdots &{}a_1^{n-1}\\ 1&{}a_2&{}a_2^2&{}\cdots &{}a_2^{n-1}\\ \vdots &{}\vdots &{}\vdots &{}\cdots &{}\vdots \\ 1&{}a_n&{}a_n^2&{}\cdots &{}a_n^{n-1}\end{pmatrix}, \end{aligned}$$

where \(a_1,a_2,\ldots ,a_{n}\) are elements of \({\mathbb {F}}_q^{*}\). It is well-known that the determinant of \(V_n\) is non-zero if and only if the \(a_i\) are distinct.

We recall the following fact (see [16]).

Lemma 4.2

([16]) Let C be a code generated by taking k consecutive rows of a Vandermonde \(n\times n\) matrix. Then C is an MDS code with parameters \([n,k,n-k+ 1]_q\).

Theorem 4.3

Let \(n\le q-1\), \(1\le t\le k+1\) and \(k+1\le t+j\le n \). Then

  1. (1)

    there is an EAQEC code with parameters \([[n,t-1,\mathrm {min}\{n-k+1,j+2\};j-k+t]]_q\).

  2. (2)

    when \(n-k=1+j\), there is an EAQEC MDS code with parameters \([[n,t-1,n-k+1;j-k+t]]_q\).

Proof

(1) For \(0<k<n\), take

$$\begin{aligned} G_{1}=\begin{pmatrix}1&{}a_1&{}a_1^2&{}\cdots &{}a_1^{n-1}\\ 1&{}a_2&{}a_2^2&{}\cdots &{}a_2^{n-1}\\ \vdots &{}\vdots &{}\vdots &{}\cdots &{}\vdots \\ 1&{}a_k&{}a_k^2&{}\cdots &{}a_k^{n-1}\end{pmatrix}. \end{aligned}$$

Let \(C_1\) be a linear code with the generator matrix \(G_{1}\). Then, by Lemma 4.2, \(C_1\) is an MDS code with parameters \([n,k,n-k+ 1]_q\).

Take

$$\begin{aligned} H_{2}=\begin{pmatrix}1&{}a_t&{}a_t^2&{}\cdots &{}a_t^{n-1}\\ 1&{}a_{t+1}&{}a_{t+1}^2&{}\cdots &{}a_{t+1}^{n-1}\\ \vdots &{}\vdots &{}\vdots &{}\cdots &{}\vdots \\ 1&{}a_{t+j}&{}a_{t+j}^2&{}\cdots &{}a_{t+j}^{n-1}\end{pmatrix}. \end{aligned}$$

where \(1\le t\le k+1\) and \(k+1\le t+j\le n \). Let \(C_2\) be a linear code with the parity-check matrix \(H_{2}\). Then, again by Lemma 4.2, \(C_2\) is an MDS code with parameters \([n,n-j-1,j+2]_q\).

Since \(1\le t\le k+1\) and \(k+1\le t+j\le n \), we have

$$\begin{aligned} c=\mathrm {rank}\begin{pmatrix}G_1\\ H_2\end{pmatrix}-k=j-k+t. \end{aligned}$$
(4.1)

Thus, by Theorem 4.1 and Eq. (4.1), there exists an EAQEC code with parameters \([[n,t-1,\mathrm {min}\{n-k+1,j+2\};j-k+t]]_q\).

(2) When \(n-k=1+j\), according to (1), there is an EAQEC code with parameters \([[n,t-1,d;j-k+t]]_q\), where \(d=\mathrm {min}\{n-k+1,j+2\}=n-k+1\).

Since \(2(d-1)=2(n-k)=n-(t-1)+(j-k+t)\), there is an EAQEC MDS code with parameters \([[n,t-1,n-k+1;j-k+t]]_q\). \(\square \)

Example 1

By Theorem 4.3, taking some special q, we obtain new EAQEC MDS codes in Table 1. Compared to the EAQEC MDS codes in [31], when lengths and dimensions of the EAQEC MDS codes are same, we have that the distance of our EAQEC MDS codes obtained in Table 1 are larger than all of them. For example, the distance 9 of our EAQEC MDS code with parameters \([[12,4,9;8]]_{13}\) in Table  1 is greater than the distance 7 of EAQEC MDS code with parameters \([[12,4,7;4]]_{13}\) in [31].

Table 1 MDS EAQEC codes comparison

Remark 4.4

In [34], Corollary 3 proved the EAQEC MDS codes with parameters \([[n,2b-1,n-k+1;n+2b-2k-1]]_q\), where \(0<b\le \frac{k+1}{2}\) and \(0<k<n\le q\). From this to see, they gave that the dimensions of EAQEC MDS codes are odd. In the above Theorem 4.3, we provide that the dimensions of EAQEC MDS codes can be either odd or even. Therefore, Theorem 4.3 yields new EAQEC MDS codes ( see Table 1).

4.2 The second classes of EAQEC MDS codes

We now recall some basic results of Generalized Reed-Solomon codes (see [17]). For k between 1 and n, let \({\mathbf {a}}=(\alpha _1,\ldots ,\alpha _n)\) and \({\mathbf {v}}=(v_1,\ldots ,v_n)\) be vectors in \({\mathbb {F}}_{q}^n\) such that \(\alpha _1,\ldots ,\alpha _n\) are distinct and \(v_1,\ldots ,v_n\) are non-zero. The Generalized Reed-Solomon code \(GRS_k({\mathbf {a}},{\mathbf {v}})\) is defined by

$$\begin{aligned}&GRS_k({\mathbf {a}},{\mathbf {v}})=\{(v_1f(\alpha _1),\ldots ,v_nf(\alpha _n))|~f(x)\in {\mathbb {F}}_{q}[x],\\&deg(f(x))\le k-1\}, \end{aligned}$$

where f(x) is polynomial in \({\mathbb {F}}_{q}[x]\), and deg(f(x)) denotes the degree of the polynomial f(x).

Furthermore, we consider the extended code of the Generalized Reed-Solomon code \(GRS_k({\mathbf {a}}, {\mathbf {v}})\) given by

$$\begin{aligned} GRS_k({\mathbf {a}},{\mathbf {v}},\infty )= & {} \{(v_1f(\alpha _1), v_2f(\alpha _2),\ldots , v_nf(\alpha _n), f_{k-1}) |~ f(x) \in {\mathbb {F}}_q[x],\\&\mathrm {deg}(f(x)) \le k-1\}, \end{aligned}$$

where \(f_{k-1}\) stands for the coefficient of \(x^{k-1}\). The following two results can be found in [17].

Lemma 4.5

([17]) The code \(GRS_k({\mathbf {a}},{\mathbf {v}},\infty )\) is an MDS code with parameters \([n + 1, k, n-k+2]_q\).

Lemma 4.6

([17]) Let \({\mathbf {1}}\) be all-one word of length n. If \(1 \le k \le q-1\), then the dual code of \(GRS_k({\mathbf {a}},{\mathbf {1}},\infty )\) is \(GRS_{q-k+1}({\mathbf {a}},{\mathbf {1}},\infty )\).

Theorem 4.7

Let \(1\le k< \lceil \frac{q+1}{2}\rceil \). Then there is an EAQEC MDS code with parameters \([[q+1,1,q-k+2;q-2k+2]]_q\).

Proof

Taking

$$\begin{aligned} G_1=\begin{pmatrix}1&{}1&{}\cdots &{}1&{}0&{}\\ \alpha _1&{}\alpha _2&{}\cdots &{}\alpha _q&{}0\\ \alpha _1^2&{}\alpha _2^2&{}\cdots &{}\alpha _q^2&{}0\\ \vdots &{} \vdots &{}\ddots &{}\vdots &{}\vdots \\ \alpha _1^{k-1}&{}\alpha _2^{k-1}&{}\cdots &{}\alpha _q^{k-1}&{}1\end{pmatrix}. \end{aligned}$$

Then, \(G_1\) is a generator matrix of \(GRS_k({\mathbf {a}},{\mathbf {1}},\infty )\).

Set,

$$\begin{aligned} H_2=\begin{pmatrix}1&{}1&{}\cdots &{}1&{}0&{}\\ \alpha _1&{}\alpha _2&{}\cdots &{}\alpha _q&{}0\\ \alpha _1^2&{}\alpha _2^2&{}\cdots &{}\alpha _q^2&{}0\\ \vdots &{} \vdots &{}\ddots &{}\vdots &{}\vdots \\ \alpha _1^{q-k}&{}\alpha _2^{q-k}&{}\cdots &{}\alpha _q^{q-k}&{}1\end{pmatrix}. \end{aligned}$$

Then, by Lemma 4.6, \(H_2\) is a parity-check matrix of \(GRS_k({\mathbf {a}},{\mathbf {1}},\infty )\).

Since \(1\le k< \lceil \frac{q+1}{2}\rceil \), we have

$$\begin{aligned} c=\mathrm {rank}\begin{pmatrix}G_1\\ H_2\end{pmatrix}-k=q-2k+2. \end{aligned}$$
(4.2)

Thus, by Theorem 4.1 and Eq. (4.2), there exists an EAQEC code with parameters \([[q+1,1,q-k+2;q-2k+2]]_q\).

Since \(2(d-1)=2(q-k+1)=q+1-1+(q-2k+2)\), the EAQEC code with parameters \([[q+1,1,q-k+2;q-2k+2]]_q\) is an EAQEC MDS code. \(\square \)

Example 2

By Theorem 4.7, taking some special q, we obtain new EAQEC MDS codes whose parameters are \([[10,1,7;3]]_{9}\),\([[12,1,10;7]]_{11}\), \([[14,1,9;3]]_{13}\),\([[18,1,8;1]]_{17}\).

Theorem 4.8

Let q be an odd prime power, \(1\le k< \frac{q+1}{2}\), and \(0< l\le \frac{q+1}{2}-1\).

  1. (1)

    If \(l< k\), then there exists an EAQEC code with parameters \([[q+1,2l-1,q-2k+3;q-2k+2]]_q\).

  2. (2)

    If \(l\ge k\), then there is an EAQEC code with parameters \([[q+1,2k-1,q-2l+3;q-2l+2]]_q\). In particular, when \(l=k\), there is an EAQEC MDS code with parameters \([[q+1,2l-1,q-2l+3;q-2l+2]]_q\).

Proof

(1) Let \(\omega \) be denote a primitive element of the finite field \({\mathbb {F}}_{q^2}\). Taking \(\alpha = \omega ^{q-1}\), then \(\alpha \) is a primitive \((q + 1)\)-th root of unity. So,

$$\begin{aligned} x^{q+1}-1=(x+1)(x-1)\Pi _{j=1}^{\frac{q+1}{2}-1}(x-\alpha ^j)(x-\alpha ^{-j}). \end{aligned}$$

For \(1\le k\le \frac{q+1}{2}\), we define the following polynomial of degree \(2k - 1\)

$$\begin{aligned} f(x)=(x-1)\Pi _{j=1}^{k-1}(x-\alpha ^{j})(x-\alpha ^{-j}). \end{aligned}$$

Its zeros \(\alpha ^j\) and \(\alpha ^{-j}\) are conjugates of each other since \(\alpha ^q = \alpha ^{-1}\). Hence f(x) is a polynomial over \({\mathbb {F}}_q\). The resulting cyclic code \(C_1^{\perp }=\langle f(x)\rangle \) has length \(q + 1\) and dimension \(q-2k+2\). The generator polynomial f(x) has \(2k-1\) consecutive zeros, so the BCH bound yields \(d(C_1^{\perp })\ge 2k\). Therefore, \(C_1^{\perp }\) is an MDS code with parameters \([q+1,q-2k+2,2k]_q\). So, \(C_1\) is an MDS code with parameters \([q+1,2k-1,q-2k+3]_q\).

Let \(g(x)=(x+1)\Pi _{j=l}^{\frac{q+1}{2}-1}(x-\alpha ^{j})(x-\alpha ^{-j})\), where \(0<l\le \frac{q+1}{2}-1\). Obviously, g(x) is also a polynomial over \({\mathbb {F}}_q\). The resulting cyclic code \(C_2=\langle g(x)\rangle \) is also an MDS code with parameters \([q+1,2l-1,q-2l+3]_q\).

Set

$$\begin{aligned} G_{1}=\begin{pmatrix}1&{}1&{}1&{}\cdots &{}1\\ 1&{}\alpha ^{1}&{}\alpha ^{2}&{}\cdots &{}\alpha ^{q}\\ 1&{}\alpha ^{-1}&{}\alpha ^{-2}&{}\cdots &{}\alpha ^{-q}\\ \vdots &{}\vdots &{}\vdots &{}\cdots &{}\vdots \\ 1&{}\alpha ^{k-1}&{}\alpha ^{2(k-1)}&{}\cdots &{}\alpha ^{q(k-1)}\\ 1&{}\alpha ^{-(k-1)}&{}\alpha ^{-2(k-1)}&{}\cdots &{}\alpha ^{-q(k-1)}\end{pmatrix}. \end{aligned}$$

Then \(G_1\) is the generator matrix of \(C_{1}\). Take

$$\begin{aligned} H_{2}=\begin{pmatrix}1&{}-1&{}(-1)^2&{}\cdots &{}(-1)^q\\ 1&{}\alpha ^{l}&{}\alpha ^{2l}&{}\cdots &{}\alpha ^{ql}\\ 1&{}\alpha ^{-l}&{}\alpha ^{-2l}&{}\cdots &{}\alpha ^{-ql}\\ \vdots &{}\vdots &{}\vdots &{}\cdots &{}\vdots \\ 1&{}\alpha ^{(\frac{q+1}{2}-1)}&{}\alpha ^{2(\frac{q+1}{2}-1)}&{}\cdots &{}\alpha ^{q(\frac{q+1}{2}-1)}\\ 1&{}\alpha ^{-(\frac{q+1}{2}-1)}&{}\alpha ^{-2(\frac{q+1}{2}-1)}&{}\cdots &{}\alpha ^{-q(\frac{q+1}{2}-1)}\end{pmatrix}. \end{aligned}$$

Then \(H_{2}\) is the parity-check matrix of \(C_2\).

By Theorem 3.4, we have

$$\begin{aligned} c=\mathrm {rank}\begin{pmatrix}G_1\\ H_2\end{pmatrix}-2k+1=\left\{ \begin{array}{ll} q-2k+2, &{} \hbox {if}\quad l<k; \\ q-2l+2, &{} \hbox {if}\quad l\ge k. \end{array} \right. \end{aligned}$$
(4.3)

(1) If \(l<k\), then, by Theorem 4.1 and Eq. (4.3), there exists an EAQEC code with parameters \([[q+1,2l-1,q-2k+3;q-2k+2]]_q\).

(2) If \(l\ge k\), then, by Theorem 4.1 and Eq. (4.3), there exists an EAQEC code with parameters \([[q+1,2k-1,d;q-2l+2]]_q\), where \(d=q-2l+3\).

When \(k=l\), since \(2(d-1)=2(q-2l+2)=q+1-(2k-1)+(q-2l+2)\), there is an EAQEC MDS code with parameters \([[q+1,2l-1,q-2l+3;q-2l+2]]_q\). \(\square \)

Remark 4.9

Theorem 4.8 does not include Theorem 4.7. In fact, the EAQEC MDS code Q with parameters \([[10,1,7;3]]_{9}\) is constructed by Theorem 4.7.

4.3 The third classes of EAQEC MDS codes

In this subsection, we assume that \(q=l^m\) with l prime power.

For brevity, we will use notion \([i]=l^{i~\mathrm {mod}~m}\), \(a^{[i]}=a^{l^{i~\mathrm {mod}~m}}\), for \(a\in {\mathbb {F}}_{q}\) and integer i, where mod operation returns non negative value.

Given a vector \((g_1,g_2,\ldots ,g_n)\in {\mathbb {F}}_{q}^n\), we denote by \(M_k(g_1,g_2,\ldots ,g_n)\in {\mathbb {F}}_{q}^{k\times n}\) the matrix

$$\begin{aligned} M_k(g_1,g_2,\ldots ,g_n)=\begin{pmatrix}g_1 &{} g_2 &{} \ldots &{}g_n \\ g_1^{[1]} &{} g_2^{[1]} &{} \ldots &{}g_n^{[1]}\\ g_1^{[2]} &{} g_2^{[2]} &{} \ldots &{}g_n^{[2]}\\ \vdots &{} \vdots &{} \ddots &{} \vdots \\ g_{1}^{[(k-1)]} &{} g_2^{[(k-1)]} &{} \ldots &{}g_n^{[(k-1)]}\\ \end{pmatrix}. \end{aligned}$$

A definition of rank-metric code, proposed by Gabidulin, is the following.

Definition 4.10

( [14]) The rank of a vector \({\mathbf {g}}=(g_1,g_2,\ldots ,g_n),g_i\in {\mathbb {F}}_{q}\), denoted by \(\mathrm {rank}({\mathbf {g}})\), is defined as the maximal number of linearly independent coordinates \(g_i\) over \({\mathbb {F}}_{l}\), i.e., \(\mathrm {rank}({\mathbf {g}}):=\mathrm {dim}_{{\mathbb {F}}_l}\langle g_1,g_2,\ldots ,g_n\rangle \). Then we have a metric rank distance given by \(d_{\mathrm {r}}({\mathbf {a}}-{\mathbf {b}})=\mathrm {rank}({\mathbf {a}}-{\mathbf {b}})\) for \({\mathbf {a}},{\mathbf {b}}\in {\mathbb {F}}_{q}^n \). An \([n,k]_q\) Gabidulin (rank-metric) code of length n with dimension k over \({\mathbb {F}}_{q}\) is an \({\mathbb {F}}_{q}\)-linear subspace \(C\subset {\mathbb {F}}_{q}^n\). The minimum rank distance of a Gabidulin code \(C\ne 0\) is

$$\begin{aligned} d_{\mathrm {r}}(C):=\mathrm {min}\{d_{\mathrm {r}}({\mathbf {a}}-{\mathbf {b}}):~{\mathbf {a}},{\mathbf {b}}\in C,~{\mathbf {a}}\ne {\mathbf {b}}\}. \end{aligned}$$

An \([n,k,d_r(C)]_q\) Gabidulin (rank-metric) code is an \([n,k]_q\) Gabidulin (rank-metric) code with the minimum rank distance \(d_r(C)\).

The Singleton bound for codes in the Hamming metric implies also an upper bound for Gabidulin codes.

Theorem 4.11

( [14]) Let \(C\subset {\mathbb {F}}_{q}^n\) be a Gabidulin code with minimum rank distance \(d_r(C)\) of dimension k. Then \(d_r(C)\le n-k+1.\)

A Gabidulin code attaining the Singleton bound is called a Gabidulin maximum rank distance (MRD) code.

In paper [21], Kshevetskiy and Gabidulin showed the following result on MRD codes:

Theorem 4.12

Let \(g_1,g_2,\ldots ,g_n\in {\mathbb {F}}_{q}\) be linearly independent over \({\mathbb {F}}_{l}\), and let C be a Gabidulin code generated by matrix \(M_k(g_1,g_2,\ldots ,g_n)\). Then Gabidulin code C is an MRD code with parameters \([n,k,n-k+1]\).

When \(n\le m\), \(d_r(C)\le d(C)\), where d(C) is the minimum Hamming distance of C. Therefore, we have the following corollary.

Corollary 4.13

Let \(n\le m\). If C is an MRD code with parameters \([n,k,n-k+1]\) over \({\mathbb {F}}_{q}\), then C is also an MDS code with parameters \([n,k,n-k+1]\) over \({\mathbb {F}}_{q}\).

Corollary 4.14

Let \(n\le m\). Let \(g_1,g_2,\ldots ,g_n\in {\mathbb {F}}_{q}\) be linearly independent over \({\mathbb {F}}_{l}\), and let C be a Gabidulin code generated by matrix \(M_k(g_1^{l^t},g_2^{l^t},\ldots ,g_n^{l^t})\), where \(1\le t\le m-1\). Then Gabidulin code C is an MRD code with parameters \([n,k,n-k+1]\). Furthermore, C is also an MDS code with parameters \([n,k,n-k+1]\) over \({\mathbb {F}}_{q}\).

Proof

We first verify that if \(g_{1},g_{2}, \ldots , g_{n}\) are linearly independent over \({\mathbb {F}}_{l}\) then \(g_{1}^{l^t},g_{2}^{l^t}, \ldots , g_{n}^{l^t}\) are also linearly independent over \({\mathbb {F}}_{l}\). We prove it by contradiction. Suppose that there is not all zero \(a_{1},a_2,\cdots ,a_n\in {\mathbb {F}}_{l}\) such that

$$\begin{aligned} a_{1}g_{1}^{l^t}+g_2v_{2}^{l^t}+\cdots +a_ng_{n}^{l^t}=0. \end{aligned}$$

Then

$$\begin{aligned} a_{1}^{l^{m-t}}g_{1}+a_2^{l^{m-t}}g_{2}+\cdots +a_n^{l^{m-t}}g_{n}=0. \end{aligned}$$

Since \(g_{1},g_{2}, \ldots , g_{n}\) are linearly independent over \({\mathbb {F}}_{l}\), \(a_{1}^{l^{m-t}}=a_2^{l^{m-t}}=\cdots =a_n^{l^{m-t}}=0\). Hence \(a_{1}=a_2=\cdots =a_n=0\). This is a contradiction. Thus, \(g_{1}^{l^t},g_{2}^{l^t}, \ldots , g_{n}^{l^t}\) are linearly independent over \({\mathbb {F}}_{l}\).

Next, let \(g_1'=g_{1}^{l^t},g_2'=g_{2}^{l^t},\ldots ,g_n'=g_{n}^{l^t}\). Then \(g_1',g_2',\ldots ,g_n'\in {\mathbb {F}}_{q}\) and \(g_1',g_2',\ldots ,g_n'\) are linearly independent over \({\mathbb {F}}_l\). According to Theorem 4.12, the Gabidulin code generated by matrix \(M_k(g_1',\ldots ,g_n')\) is an MRD code with parameters \([n,k,n-k+1]\). Since \(M_k(g_1',\ldots ,g_n')=M_k(g_1^{l^t},g_2^{l^t},\ldots ,g_n^{l^t})\), the Gabidulin code C is an MRD code with parameters \([n,k,n-k+1]\).

By Corollary 4.13, C is also an MDS code with parameters \([n,k,n-k+1]\) over \({\mathbb {F}}_{q}\). \(\square \)

Theorem 4.15

Let \(n\le m\). If \(0\le t<m\) and \(0\le k_1-t+1\le k_2\le m-t\), then

  1. (1)

    there exists an EAQEC code with parameters \([[n,t,\mathrm {min}\{n-k_1+1,k_2+1\};k_2-k_1+t]]_{q}\).

  2. (2)

    when \(n-k_1=k_2\), there exists an EAQEC MDS code with parameters \([[n,t,n-k_1+1;k_2-k_1+t]]_{q}\).

Proof

Taking

$$\begin{aligned} G_1=M_{k_1}(g_1,g_2,\ldots ,g_n)=\begin{pmatrix}g_1 &{} g_2 &{} \ldots &{}g_n \\ g_1^{[1]} &{} g_2^{[1]} &{} \ldots &{}g_n^{[1]}\\ g_1^{[2]} &{} g_2^{[2]} &{} \ldots &{}g_n^{[2]}\\ \vdots &{} \vdots &{} \ddots &{} \vdots \\ g_{1}^{[(k_1-1)]} &{} g_2^{[(k_1-1)]} &{} \ldots &{}g_n^{[(k_1-1)]}\\ \end{pmatrix}. \end{aligned}$$

Let \(C_1\) be a linear code with the generator matrix \(G_1\). Then, by Theorem 4.12 and Corollary 4.13, \(C_1\) is an MDS code with parameters \([n,k_1,n-k_1+1]\) over \({\mathbb {F}}_{q}\).

Let \(\tilde{g_1}=g_1^{l^t},\tilde{g_2}=g_2^{l^t},\ldots ,\tilde{g_n}=g_n^{l^t}\). Set

$$\begin{aligned} H_2=M_{k_2}(\tilde{g_1},\tilde{g_2},\ldots ,\tilde{g_n})=\begin{pmatrix}\tilde{g_1}&{} \tilde{g_2}&{} \ldots &{}\tilde{g_n} \\ \tilde{g_1}^{[1]} &{} \tilde{g_2}^{[1]} &{} \ldots &{}\tilde{g_n}^{[1]}\\ \tilde{g_1}^{[2]} &{} \tilde{g_2}^{[2]} &{} \ldots &{}\tilde{g_n}^{[2]}\\ \vdots &{} \vdots &{} \ddots &{} \vdots \\ \tilde{g_{1}}^{[(k_2-1)]} &{} \tilde{g_2}^{[(k_2-1)]} &{} \ldots &{}\tilde{g_n}^{[(k_2-1)]}\\ \end{pmatrix}. \end{aligned}$$

Suppose that \(C_2\) is a linear code with the parity-check matrix \(H_2\) . Then, by Corollary 4.14, \(C_2\) is an MDS code with parameters \([n,n-k_2,k_2+1]\) over \({\mathbb {F}}_{q}\).

Table 2 MDS EAQEC codes comparison
Table 3 comparisons of EAQEC MDS codes

Since \(0\le t\le k_1-1\) and \(k_1-t+1\le k_2\le m-t\), we have

$$\begin{aligned} c=\mathrm {rank}\begin{pmatrix}G_1\\ H_2\end{pmatrix}-k_1=k_2-k_1+t. \end{aligned}$$
(4.4)

Thus, by Theorem 4.1 and Eq. (4.4), there exists an EAQEC code with parameters \([[n,t,\mathrm {min}\{n-k_1+1,k_2+1\};k_2-k_1+t]]_{q}\).

(2) When \(n-k_1=k_2\), according to (1), there is an EAQEC code with parameters \([[n,t,d;k_2-k_1+t]]_q\), where \(d=\mathrm {min}\{n-k_1+1,k_2+1\}=n-k_1+1\).

Since \(2(d-1)=2(n-k_1)=n-t+(k_2-k_1+t)\), there is an EAQEC MDS code with parameters \([[n,t,n-k+1;k_2-k_1+t]]_{q}\). \(\square \)

Example 3

By Theorem 4.15, taking some special q, we obtain new EAQEC MDS codes in Table 2. Compared to the EAQEC MDS codes in [30, 34], we have that the number c of entanglement bits of our EAQEC MDS codes obtained in Table 2 are smaller than all of them.

In Table 3, we give our general conclusions to make comparisons with those known results in Refs. [7, 12, 22, 27, 30, 33, 35, 36, 38]. The results show that the lengths and entanglement bits of those known conclusions above EAQEC MDS codes studied in the literatures are fixed. However, the lengths of two classes of EAQEC MDS codes derived from our construction are very flexible: the lengths of the first classes of EAQEC MDS codes can be arbitrary between 1 and \(q-1\); the lengths of the third classes of EAQEC MDS codes can be arbitrary between 1 and m. The entanglement bits of three classes of EAQEC MDS codes derived from our construction are very flexible: the entanglement bits of the first classes of EAQEC MDS codes can be arbitrary between 1 and \(n-1\); the entanglement bits of the second classes of EAQEC MDS codes can be arbitrary between 3 and 9; the entanglement bits of the third classes of EAQEC MDS codes can be arbitrary between 1 and m.

5 Conclusions

In this paper, we have developed a new method for constructing EAQEC codes by using generator matrix of one code and parity-check matrix of the other code over finite field \({\mathbb {F}}_{q}\). Using this method, we have constructed three clasess of EAQEC MDS codes. Notably, the parameters of our EAQEC MDS codes are new and flexible.