1 Introduction

Quantum error correcting codes(QECC) are useful tool in quantum computation and communication to detect and correct the quantum errors while quantum information is transferred via quantum channel. While it is initially supposed that there is no way to quantum computation and communication due to the difficulties such as decoherence destroying the information of qubits having a superposition, encoding one qubit to nine qubits, the first quantum code called Shor code [16] encourages the researchers in overcoming this problem and deriving a systematic construction for QECC. In [3] and [17], respectively, Shor et al. and Steane, as independence of each other, discover a systematic way to construct QECC which are called CSS code. It is no longer enough to consider two classical linear codes over GF(2) which are nested for constructing binary QECC. Gottesman [6] comes up with an outstanding notion that aims to detect and correct the quantum errors for QECC by considering their stabilizer groups that are subgroups of Pauli matrices group on binary qubits. In [4], it is shown that it is equivalent finding additive codes over GF(4) which are self-orthogonal with respect to certain trace inner product to finding binary stabilizer QECC. By redefining the Pauli matrices on qubits over higher alphabets, the results given in [4] are generalized to stabilizer QECC over \({\mathbb {F}}_q\) in [2, 10]. In [10], the finding stabilizer codes of length n over \({\mathbb {F}}_q\) is transformed into at first the finding additive codes of length 2n over \({\mathbb {F}}_q\) which are self-orthogonal with respect to trace-alternating form and then the finding additive codes of length n over \({\mathbb {F}}_{q^2}\) which are self-orthogonal with respect to trace-symplectic form. It is also shown that for a linear code over \({\mathbb {F}}_{q^2}\), its dual with respect to trace-alternating form is equal to its dual with respect to Hermitian inner product, whence paves the way for many further researches, some of which are [1, 5, 9, 18]. Next, Kai et al. [9] consider the quantum codes constructed via the Hermitian dual containing negacyclic codes which are a class of constacyclic codes. The study [5] also provides the construction of quantum codes via a certain class of constacyclic codes containing Hermitian duals. In this study, instead of the classical linear codes over \({\mathbb {F}}_{q^2}\) including their Hermitian duals, we consider the linear codes over \({\mathbb {F}}_q\) containing their Euclidean and trace-symplectic duals as the Gray images of certain codes over a nonlocal ring \(R_q\)(will be defined later).

This paper includes six sections organized as follows: Section 2 gives to the readers some basic definitions and notations which they need in next sections. Section 3 introduces a Gray map \(\varphi : R_q^n \rightarrow {\mathbb {F}}_q^{2n}\) which preserves both Euclidean and trace-symplectic orthogonality in \({\mathbb {F}}_q^{2n}\). Section 4 studies the cyclic codes and their Hermitian duals (defined in Sect. 2). It also illustrates some quantum codes obtained from cyclic codes over \(R_5\) of length 9 and 11. Section 5 aims to find a condition for additive cyclic codes over \(R_q\), \(q=p^2\), to contain their Hermitian duals. Introducing a map \(\delta : R_{p^2}^n \rightarrow {\mathbb {F}}_p^{4n}\) preserving the orthogonality, it also gives some quantum code examples obtained from additive cyclic codes over \(R_5\) of length 11. Section 6 concludes the paper.

2 Preliminaries

Let \({\mathbb {F}}_q\) be a finite field having q elements, where q is a prime power. A code of length n over \({\mathbb {F}}_q\) is a nonempty subset of \({\mathbb {F}}_q^n\). A subspace of \({\mathbb {F}}_q^n\) is a linear code of length n over \({\mathbb {F}}_q\) and so a linear code has a dimension k. The Hamming weight \({w_H}\left( x \right) \) of a vector \(x = \left( {{x_0},{x_1}, \ldots ,{x_{n - 1}}} \right) \) is the number of nonzero coordinates of the vector x. The Hamming distance \({d_H}\left( {x,y} \right) \) between two vectors \(x = \left( {{x_0},{x_1}, \ldots ,{x_{n - 1}}} \right) \) and \(y = \left( {{y_0},{y_1}, \ldots ,{y_{n - 1}}} \right) \) is the Hamming weight of the vector \(x - y\). For \(u = \left( {\begin{array}{*{20}{c}} {{\beta _1}}&{{\beta _2}}&\cdots&{{\beta _n}} \end{array}} \right) ,\,\,v = \left( {\begin{array}{*{20}{c}} {{\gamma _1}}&{{\gamma _2}}&\cdots&{{\gamma _n}} \end{array}} \right) \in R_q^n\), consider \({x_t} + i{y_t}\) with \(\left| {{x_t}} \right| + \left| {{y_t}} \right| \) minimum. Then, the Mannheim distance between these word u and v is defined as

$$\begin{aligned} {d_M}\left( {u,\,\,v} \right) = \sum \limits _{t = 1}^n {\left( {\left| {{x_t}} \right| + \left| {{y_t}} \right| } \right) }. \end{aligned}$$

An element of a code is called codeword. The (minimum) Hamming distance \(d_H\left( C \right) \) of a code C is defined as the minimum Hamming distance between two distinct codewords in the code C. Also, the Mannheim distance \(d_M\left( C \right) \) of a code C can be defined in the similar way. \({\left[ {n,k,d} \right] _q}\) and \({\left[ {n,k,d_M} \right] _q}\) codes refer to linear codes of length n over \({\mathbb {F}}_q\) and \(R_q\) having dimension k and Hamming distance d and Mannheim distance \(d_M\), respectively. Recall that the Euclidean inner product \(\left\langle {x,y} \right\rangle \) of two vectors \(x = \left( {{x_0},{x_1}, \ldots ,{x_{n - 1}}} \right) \) and \(y = \left( {{y_0},{y_1}, \ldots ,{y_{n - 1}}} \right) \) is \(\left\langle {x,y} \right\rangle = \sum \nolimits _{i = 0}^{n - 1} {{x_i}{y_i}} \). The set \({C^ \bot } = \{ {y \in {\mathbb {F}}_q^n:\langle {x,y} \rangle = 0,\,\forall x \in C} \}\) is called the Euclidean dual of the code C.

Define \({\mathbb {C}}^{q^n} = {{\mathbb {C}}^q} \otimes {{\mathbb {C}}^q} \cdots \otimes {{\mathbb {C}}^q}\), where \({\mathbb {C}}^q\) is q-dimensional complex vector space. An \({\left( {\left( {n,M,d} \right) } \right) _q}\) quantum code is defined as a subspace with M generators of \({\mathbb {C}}_q^n\) such that it can detect \(d-1\) errors but not some d errors. If specially \(M = {q^k}\), such a quantum code is denoted by \({\left[ \left[ {n,k,d}\right] \right] _q}\). The following two theorems show that there is a strong relation between codes over \({\mathbb {F}}_q\) and quantum error correcting codes.

Theorem 1

([10] CSS Code Construction) Suppose that C and \(C_1\) are two \({\left[ {n,k,d} \right] _q}\) and \({\left[ {n,{k_1},{d_1}} \right] _q}\) codes, respectively, such that \({C_1} \subseteq C\). Then, there exists a \({[[ {n,k - {k_1},d'}]]_q}\) quantum error correcting code, where

$$\begin{aligned} d' = \min \left\{ {{w_H}\left( x \right) :x \in \left( {C - {C_1}} \right) \cup \left( {C_1^ \bot - C^ \bot } \right) } \right\} \ge \min \left\{ {d,d_1^ \bot } \right\} \end{aligned}$$
(1)

and \(d_1^ \bot = {d_H}( {C_1^ \bot })\). If, particularly, the code C contains its Euclidean dual, then there exists a \({[[ {n,2k - n,d^\prime }]] }_q\) quantum error correcting code, where

$$\begin{aligned} d' = \min \{ {{w_H}( x ):x \in C - {C^ \bot }}\} \ge d. \end{aligned}$$
(2)

Define the trace \(tr:{{\mathbb {F}}_q} \rightarrow {{\mathbb {F}}_p}\), \(tr\left( x \right) = x + {x^p} + \cdots + {x^{{p^{m - 1}}}}\), where \(q = {p^m}\). The trace-symplectic inner product of two vectors \(\left( {x,y} \right) \) and \(( {x',y'})\) of \({\mathbb {F}}_q^{2n}\) is given in [10] as follows:

$$\begin{aligned} {\left\langle {\left( {x,y} \right) ,\left( {x',y'} \right) } \right\rangle _s}: = tr\left( {\left\langle {x',y} \right\rangle - \left\langle {x,y'} \right\rangle } \right) . \end{aligned}$$
(3)

The set \(C^{\bot _s} = \{ {y \in {\mathbb {F}}_q^{2n} : \langle {x,y} \rangle _s = 0,\,\, \forall x \in C} \}\) is called the trace-symplectic dual of the code C. Recall that the symplectic weight of a vector \(\left( {x,y} \right) \) in \({\mathbb {F}}_q^{2n}\) is \({w_s}\left( {x,y} \right) = n - \left| {\left\{ {i:{x_i} = 0\,\,and\,\,{y_i} = 0} \right\} } \right| \).

Theorem 2

[10] Suppose that C is an additive code over \({\mathbb {F}}_q\) of length 2n such that \(\left| C \right| = {q^{n-k}}\), \(C \subseteq {C^{{ \bot _s}}}\) and \({w_s}\left( {{C^{{ \bot _s}}} - C} \right) = d\). Then, there exists a \({\left[ \left[ {n,k,d}\right] \right] _q}\) quantum error correcting code.

Theorem 2 says that it is necessary to find an additive code over \({\mathbb {F}}_q\) containing its trace-symplectic dual to construct a quantum code.

For an \({\left[ \left[ {n,k,d}\right] \right] _q}\) quantum code, the relation \(n + 2 \ge k + 2d\), called quantum Singleton bound, is an analog to the Singleton bound for classical linear codes over finite fields [11, 15]. An \({[[ {n,k,d}]]_q}\) quantum code is called a quantum MDS(QMDS) code if it holds the Singleton bound for quantum codes.

Let p be a prime such that \(p = {a^2} + {b^2}\) for some positive integers a and b and let \({\mathbb {F}}_q\) be a finite field having q elements, where q is a positive power of p. We denote \(R_q\) to be \({R_q} = {{\mathbb {F}}_q} + \alpha {{\mathbb {F}}_q}\), where \(\alpha = a + bi\). Then, \(R_q\) is a nonlocal commutative ring with identity and its nontrivial ideals are \(\left\langle \alpha \right\rangle \) and \(\left\langle {{\alpha ^*}} \right\rangle \), where \({\alpha ^*} = a - bi\). It is easily seen that \({R_q} = \left\langle \alpha \right\rangle \oplus \left\langle {{\alpha ^*}} \right\rangle \) and \(\left| {\left\langle \alpha \right\rangle } \right| = \left| {\left\langle {{\alpha ^*}} \right\rangle } \right| = q\). Thus, since \(\left\langle \alpha \right\rangle = \{ {k\alpha :k \in {{\mathbb {F}}_q}} \}\) and \(\left\langle {{\alpha ^*}} \right\rangle = \{ {k{\alpha ^*}:k \in {{\mathbb {F}}_q}} \}\), every element r of the ring \(R_q\) is written uniquely as

$$\begin{aligned} {k_1}\alpha + {k_2}{\alpha ^*} \end{aligned}$$
(4)

for some \({k_1},{k_2} \in {{\mathbb {F}}_q}\).

A code C of length n over \(R_q\) is a nonempty subset of \(R_q^n\). A linear code C of length n over \(R_q\) is a submodule of \(R_q\)-module \(R_q^n\). Any linear code over \(R_q\) is a permutation-equivalent to a code having the following generator matrix:

$$\begin{aligned} {G_{\left( {{k_1} + {k_2} + {k_3}} \right) \times n}} = \left( {\begin{array}{lllll} {{I_{{k_1}}}}&{}\quad {{\alpha ^*}{B_1}}&{}\quad {\alpha {A_1}}&{}\quad {\alpha {A_1} + {\alpha ^*}{B_2}}&{}\quad {\alpha {A_3} + {\alpha ^*}{B_3}}\\ 0&{}\quad {\alpha {I_{{k_2}}}}&{}\quad 0&{}\quad {\alpha {A_4}}&{}\quad 0\\ 0&{}\quad 0&{}\quad {{\alpha ^*}{I_{{k_3}}}}&{}\quad 0&{}\quad {{\alpha ^*}{B_4}} \end{array}} \right) , \end{aligned}$$
(5)

where \({{I_{{k_i}}}}\) is a \({k_i} \times {k_i}\) identity matrix and the matrices \(A_i\) and \(B_i\) are over \({\mathbb {F}}_q\). Note that for a code C with the generator matrix \(G_{\left( {{k_1} + {k_2} + {k_3}} \right) \times n}\), the size \(\left| C \right| \) of C is equal to \({q^{2{k_1} + {k_2} + {k_3}}}\).

For an element \(r = x + y\alpha \) in R, \({r^*} = x + y{\alpha ^*}\). Let \(x = \left( {{x_0},{x_1}, \ldots ,{x_{n - 1}}} \right) \) and \(y = \left( {{y_0},{y_1}, \ldots ,{y_{n - 1}}} \right) \) be two vectors in \(R_q^n\). Define Hermitian inner product \({\left\langle {x,y} \right\rangle _h}\) of the vectors x and y as \({\left\langle {x,y} \right\rangle _h}: = {x_0}y_0^* + {x_1}y_1^* + \cdots + {x_{n - 1}}y_{n - 1}^*\). Hermitian dual \({C^{{ \bot _h}}}\) of a code C over \(R_q\) of length n is the set

$$\begin{aligned} {C^{{ \bot _h}}} = \{ {y \in R_q^n:{{\left\langle {x,y} \right\rangle }_h} = 0,\,\,\forall x \in C}\}. \end{aligned}$$
(6)

Note that \({C^{{ \bot _h}}}\) is also linear if C is linear, and \(| C || {{C^{{ \bot _h}}}}| = | {R_q^n}|\). A code C is called Hermitian self-orthogonal code if \(C \subseteq {C^{{ \bot _h}}}\).

3 A gray map from \(R_q^n\) to \({\mathbb {F}}_q^{2n}\)

We define the Gray map \(\varphi :R_q^n \rightarrow {\mathbb {F}}_q^{2n}\) as

$$\begin{aligned} \varphi \left( {{r_0},{r_1}, \ldots ,{r_{n - 1}}} \right) = \left( { - {y_0}b, \ldots , - {y_{n - 1}}b,{x_0} + {y_0}a, \ldots ,{x_{n - 1}} + {y_{n - 1}}a} \right) , \end{aligned}$$
(7)

where \({r_i} = {x_i} + {y_i}\alpha \) for all \(i \in \left\{ {0,1, \ldots ,n - 1} \right\} \).

The Lee weight \({w_L}\left( r \right) \) of an element \(r \in R_{q}\) is \({w_H}\left( {\varphi \left( r \right) } \right) \). The Lee weight \({w_L}\left( x \right) \) of a vector \(x = \left( {{x_0},{x_1}, \ldots ,{x_{n - 1}}} \right) \in R_q^n\) is \({w_L}\left( x \right) = \sum \nolimits _{i = 0}^{n - 1} {{w_L}\left( {{x_i}} \right) } \). The Lee distance \({d_L}\left( {x,y} \right) \) between two vectors x and y in \(R_q^n\) is defined to be \({d_L}\left( {x,y} \right) = {w_L}\left( {x - y} \right) \). The following theorem is direct.

Theorem 3

The Gray map \(\varphi \) is an \({\mathbb {F}}_q\)-linear and distance-preserving map from \(( {R_q^n,{d_L}})\) to \(( {{\mathbb {F}}_q^{2n},{d_H}})\).

For two elements \({r_1} = {x_1} + {y_1}\alpha \) and \({r_2} = {x_2} + {y_2}\alpha \) of the ring \(R_q\), suppose that \({r_1}{ \bot _h}{r_2}\). This implies that

$$\begin{aligned} {x_1}{x_2} + \left( {{x_1}{y_2} + {x_2}{y_1}} \right) a = 0 \end{aligned}$$
(8)

and

$$\begin{aligned} \left( {{x_2}{y_1} - {x_1}{y_2}} \right) b = 0 \end{aligned}$$
(9)

We have the following theorem:

Theorem 4

Let C be a code of length n over \(R_q\). If C contains its Hermitian dual, \(\psi \left( C \right) \) contains its dual with respect to both usual inner product and trace-symplectic inner product.

Proof

It is sufficient to prove only for \(n=1\). Assume that \({r_1}{ \bot _h}{r_2}\). See that

$$\begin{aligned} \left\langle {\psi \left( {{r_1}} \right) ,\psi \left( {{r_2}} \right) } \right\rangle= & {} {y_1}{y_2}{b^2} + \left( {{x_1}{y_2} + {x_2}{y_1}} \right) a + {x_1}{x_2} + {y_1}{y_2}{a^2}\\= & {} \left( {{x_1}{y_2} + {x_2}{y_1}} \right) a + {x_1}{x_2}. \end{aligned}$$

Equation 8 implies that \(\left\langle {\psi \left( {{r_1}} \right) ,\psi \left( {{r_2}} \right) } \right\rangle = 0\). For the second,

$$\begin{aligned} {\left\langle {\psi \left( {{r_1}} \right) ,\psi \left( {{r_2}} \right) } \right\rangle _s}= & {} \mathrm{tr}\left( { - \left( {{x_1} + {y_1}a} \right) {y_2}b + \left( {{x_2} + {y_2}a} \right) {y_1}b} \right) \\= & {} \mathrm{tr}\left( {\left( {{x_2}{y_1} - {x_1}{y_2}} \right) b} \right) . \end{aligned}$$

By Equation 9, \(\mathrm{tr}\left( {\left( {{x_2}{y_1} - {x_1}{y_2}} \right) b} \right) = 0\) and so proof is completed. \(\square \)

Combining Theorems 1, 3 and 4, we give:

Corollary 1

If C is a linear code over \(R_q\) having the generator matrix \({G_{( {{k_1} + {k_2} + {k_3}} ) \times n}}\) and containing its Hermitian dual, then there exists an \([[ 2n,2( {2{k_1} + {k_2} + {k_3} - n} ),d \ge {d_L}]]_q\) quantum error correcting code, where \(d_L\) is the minimum Lee distance of the code C.

It is worth to note that for a vector \(x \in R_q^n\), \({w_H}\left( x \right) = {w_s}\left( {\varphi \left( x \right) } \right) \) and so the (minimum) Hamming weight of the nonzero codewords in a code C over \(R_q\) is equal to the minimum symplectic weight of the nonzero codewords in \({\varphi \left( C \right) }\). We also have the following from Theorems 1 and 4.

Corollary 2

If C is a linear code over \(R_q\) having the generator matrix \({G_{\left( {{k_1} + {k_2} + {k_3}} \right) \times n}}\) and containing its Hermitian dual, then there exists a \({[[ {n,2{k_1} + {k_2} + {k_3} - n,d \ge {d_H}}]]_q}\) quantum error correcting code, where \(d_H\) is the minimum Hamming distance of the code C.

4 Quantum codes from cyclic codes over \(R_q\)

A linear code C over \({\mathbb {F}}_q\)(resp. \(R_q\)) is called cyclic if its right cyclic shift of every codeword is also a codeword. Recall that there is a one-to-one correspondence between cyclic codes of length n over \({\mathbb {F}}_q\) and the ideals of the quotient ring \(\frac{{{{\mathbb {F}}_q}\left[ x \right] }}{{\left\langle {{x^n} - 1} \right\rangle }}\). Since every ideal of \(\frac{{{{\mathbb {F}}_q}\left[ x \right] }}{{\left\langle {{x^n} - 1} \right\rangle }}\) is principal, \(C = \left\langle {g\left( x \right) } \right\rangle \) for some monic polynomial \(g\left( x \right) \in \frac{{{F_q}\left[ x \right] }}{{\left\langle {{x^n} - 1} \right\rangle }}\), where \(g\left( x \right) \) is called generator polynomial of C and divides \(x^n-1\). Similar to the case over \({\mathbb {F}}_q\), a cyclic code over \(R_q\) of length n is an ideal in \(\frac{{{R_q}\left[ x \right] }}{{\left\langle {{x^n} - 1} \right\rangle }}\). Hence, we need to investigate the ideal structure of \(\frac{{{R_q}\left[ x \right] }}{{\left\langle {{x^n} - 1} \right\rangle }}\).

Equation 4 implies that for every vector \(x \in R_q^n\), there exits uniquely vectors \({x_1},{x_2} \in {\mathbb {F}}_q^n\) such that \(x = \alpha {x_1} + {\alpha ^*}{x_2}\). This leads to a characterization of linear and cyclic codes of length n over \(R_q\).

Theorem 5

A linear code C over \(R_q\) of length n is of the form \(C = \alpha {C_1} \oplus {\alpha ^*}{C_2}\), where \(C_1\) and \(C_2\) are linear codes over \({\mathbb {F}}_q\) of length n. If the code C is a cyclic code, then \(C_1\) and \(C_2\) are cyclic codes over \({\mathbb {F}}_q\).

We now are ready to give exact characterization for cyclic codes over \(R_q\).

Theorem 6

Every cyclic code C over \(R_q\) of length n has the form \(C = \left\langle \alpha {g_1}\left( x \right) + {\alpha ^*}{g_2}\left( x \right) \right\rangle \) for some polynomials \({{g_1}\left( x \right) }\) and \({{g_2}\left( x \right) }\) in \(\frac{{{{\mathbb {F}}_q}\left[ x \right] }}{{\left\langle {{x^n} - 1} \right\rangle }}\) which divide \(x^n-1\). Moreover, \(\left| C \right| = {q^{2n - \sum \nolimits _{i = 1}^2 {\deg {g_i}\left( x \right) } }}\).

Proof

By Theorem 5, \(C = \alpha {C_1} + {\alpha ^*}{C_2}\) for some cyclic codes \({C_1} = \left\langle {{g_1}\left( x \right) } \right\rangle \) and \({C_2} = \left\langle {{g_2}\left( x \right) } \right\rangle \) of length n, where \({g_i}\left( x \right) \) divides \(x^n-1\) for \(i=1,2\). Then, \(C = \left\langle {\alpha {g_1}\left( x \right) ,{\alpha ^*}{g_2}\left( x \right) } \right\rangle \). Set \(J = \left\langle {\alpha {g_1}\left( x \right) + {\alpha ^*}{g_2}\left( x \right) } \right\rangle \). Clearly, \(J \subseteq C\). For reverse inclusion, see that \(\alpha ^2 = 2a\alpha \) and \({\left( {{\alpha ^*}} \right) ^2} = 2a{\alpha ^*}\). This implies that \(\alpha \left( {\alpha {g_1}\left( x \right) + {\alpha ^*}{g_2}\left( x \right) } \right) = {\alpha ^2}{g_1}\left( x \right) = 2a\alpha {g_1}\left( x \right) \in J\) and \({\alpha ^*}\left( {\alpha {g_1}\left( x \right) + {\alpha ^*}{g_2}\left( x \right) } \right) = {\left( {{\alpha ^*}} \right) ^2}{g_2}\left( x \right) = 2a{\alpha ^*}{g_2}\left( x \right) \in J\). Hence, \({\alpha {g_1}\left( x \right) }\) and \({{\alpha ^*}{g_2}\left( x \right) }\) are included in J and \(J=C\). The size of C is clear. \(\square \)

To construct quantum error correcting codes via cyclic codes over \(R_q\), we need the condition that cyclic codes over \(R_q\) contain their Hermitian dual. We begin to determine the structure of Hermitian dual code of a cyclic code over \(R_q\). Note that \(h\left( x \right) = \frac{{{x^n} - 1}}{{g\left( x \right) }}\) is called check polynomial of a cyclic code \(C = \left\langle {g\left( x \right) } \right\rangle \) over \({\mathbb {F}}_q\) of length n and \({h^R}\left( x \right) = {x^{\deg h\left( x \right) }}h( {{x^{ - 1}}})\).

Theorem 7

Suppose \(C = \alpha {C_1} \oplus {\alpha ^*}{C_2}\) is a cyclic code over \(R_q\) of length n. Then, \({C^{{ \bot _h}}} = \langle {\alpha h_2^R( x ) + {\alpha ^*}h_1^R( x )}\rangle \), where \(h_1\left( x \right) \) and \(h_2( x )\) are check polynomials of \(C_1\) and \(C_2\), respectively.

Proof

Set \(J = \langle {\alpha h_2^R( x ) + {\alpha ^*}h_1^R( x)} \rangle \). Let \({C_i} = \left\langle {{g_i}\left( x \right) } \right\rangle \) for \(i=1,2\). Since \(C = \left\langle {\alpha {g_1}\left( x \right) + {\alpha ^*}{g_2}\left( x \right) } \right\rangle \), the definition of Hermitian inner product forces that proving the following equality is necessary.

$$\begin{aligned}&\left( {\alpha {g_1}\left( x \right) + {\alpha ^*}{g_2}\left( x \right) } \right) {\left( {\alpha {h_2}\left( x \right) + {\alpha ^*}{h_1}\left( x \right) } \right) ^*} \\&\quad = \left( {\alpha {g_1}\left( x \right) + {\alpha ^*}{g_2}\left( x \right) } \right) \left( {\alpha {h_1}\left( x \right) + {\alpha ^*}{h_2}\left( x \right) } \right) \\&\quad = {\alpha ^2}{g_1}\left( x \right) {h_1}\left( x \right) + \alpha {\alpha ^*}\left( {{g_1}\left( x \right) {h_2}\left( x \right) + {g_2}\left( x \right) {h_1}\left( x \right) } \right) + {\left( {{\alpha ^*}} \right) ^2}{g_2}\left( x \right) {h_2}\left( x \right) = 0 \end{aligned}$$

Hence, \({\left( {\alpha {h_2}\left( x \right) + {\alpha ^*}{h_1}\left( x \right) } \right) ^R} = \alpha h_2^R\left( x \right) + {\alpha ^*}h_1^R\left( x \right) \in {C^{{ \bot _h}}}\) and \(J \subseteq {C^{{ \bot _h}}}\). Since \(| J || C | = | {R_q^{2n}}|\), \(J = {C^{{ \bot _h}}}\). \(\square \)

Note that \(x^n-1\) has no multiple roots over \({\mathbb {F}}_q\) if \(\left( {n,q} \right) = 1\). Then, there exists an \(n^{th}\) root \(\beta \) of unity in some field extension of \({\mathbb {F}}_q\). This fact enables to describe a cyclic code of length n and generator polynomial \({g\left( x \right) }\) with respect to its defining set \(Z = \{ {i:g( {{\beta ^i}} ) = 0,\,i \in \{ {0,1,\ldots ,n - 1}\}}\}\). Denote \({Z^{ - 1}} = \left\{ { - i\bmod \, n:\,i \in Z} \right\} \). Recall that the defining set of \({g^R\left( x \right) }\) is \(Z^{-1}\) if the defining set of \({g\left( x \right) }\) is Z. In the following theorem, equivalent conditions for a cyclic code over \(R_q\) to contain its Hermitian dual are derived.

Theorem 8

Let \(\left( {n,q} \right) = 1\). Let \(C_i\) be a cyclic code of length n and generator polynomial \({g_i\left( x \right) }\) over \({\mathbb {F}}_q\) and let \(Z_i\) be defining set of \(C_i\) for \(i=1,2\). Suppose that \(C = \alpha {C_1} + {\alpha ^*}{C_2}\). The following are equivalent:

  1. 1.

    \({C^{{ \bot _h}}} \subseteq C\),

  2. 2.

    \(C_2^ \bot \subseteq {C_1}\),

  3. 3.

    \(C_1^ \bot \subseteq {C_2}\),

  4. 4.

    \({x^n} - 1 \equiv 0\left( {\bmod \, {g_1}\left( x \right) g_2^R\left( x \right) } \right) \),

  5. 5.

    \({x^n} - 1 \equiv 0\left( {\bmod \, {g_1^R}\left( x \right) g_2\left( x \right) } \right) \),

  6. 6.

    \({Z_1} \cap Z_2^{ - 1} = \emptyset \),

  7. 7.

    \({Z_1^{-1}} \cap Z_2 = \emptyset \).

Proof

It is easy to see that the conditions (2), (3), (4), (5), (6) and (7) are equivalent from definitions and so it is enough to prove \((1) {\Leftrightarrow } (4)\). Since \(C = \alpha {C_1} + {\alpha ^*}{C_2}\), Theorem 7 implies that \({C^{{ \bot _h}}} = \alpha C_2^ \bot \oplus {\alpha ^*}C_1^ \bot \). So, if \({C^{{ \bot _h}}} \subseteq C\), then \(C_2^ \bot \subseteq {C_1}\) and \(C_1^ \bot \subseteq {C_2}\). Thus, \(\left. {{g_1}\left( x \right) } \right| h_2^R\left( x \right) \) and \(\left. {{g_2}\left( x \right) } \right| h_1^R\left( x \right) \). Say \(h_2^R\left( x \right) = {g_1}\left( x \right) f\left( x \right) \). Since \(g_2^R\left( x \right) h_2^R\left( x \right) = - \left( {{x^n} - 1} \right) \), we get \(g_2^R\left( x \right) {g_1}\left( x \right) f\left( x \right) = - \left( {{x^n} - 1} \right) \).

For the other side, if \({x^n} - 1 \equiv 0\bmod \, ({{g_1}( x)g_2^R( x)})\), then \(\left. {g_2^R\left( x \right) } \right| {h_1}\left( x \right) \) and so \(\left. {{g_2}\left( x \right) } \right| h_1^R\left( x \right) \). This means that \(C_1^ \bot \subseteq {C_2}\) and \(C_2^ \bot \subseteq {C_1}\), which completes the proof. \(\square \)

The following is immediate from Theorem 8.

Corollary 3

Let C be a cyclic code over \({\mathbb {F}}_q\) containing its dual and let \(C' = \alpha C \oplus {\alpha ^*}C\). Then, \(C'\) is a cyclic code over \(R_q\) containing its Hermitian dual.

Corollary 1 is rearranged for cyclic codes containing its Hermitian dual as follows:

Corollary 4

Let \(C = \alpha {C_1} \oplus {\alpha ^*}{C_2} = \left\langle {\alpha {g_1}\left( x \right) + {\alpha ^*}{g_2}\left( x \right) } \right\rangle \) be a cyclic code over \(R_q\) of length n and \(\left( {n,q} \right) = 1\). If one of the conditions given in Theorem 8 is satisfied, then there exists a \({[[ {2n,2( {n - \sum \nolimits _{i = 1}^2 {deg({g_i}( x )}) } ),d \ge {d_L}}]]_q}\) quantum error correcting code, where \(d_L\) is the minimum Lee weight of the cyclic code C and \({g_i}\left( x \right) \) is generator polynomial of \(C_i\).

Furthermore, Corollary 2 is rearranged for cyclic codes containing its Hermitian dual as follows:

Corollary 5

Let \(C = \alpha {C_1} \oplus {\alpha ^*}{C_2} = \left\langle {\alpha {g_1}\left( x \right) + {\alpha ^*}{g_2}\left( x \right) } \right\rangle \) be a cyclic code over \(R_q\) of length n and \(\left( {n,q} \right) = 1\). If one of the conditions given in Theorem 8 is satisfied, then there exists a \({[[ {n,n - \sum \nolimits _{i = 1}^2 {deg({g_i}( x))} ,d \ge {d_H}}]]_q}\) quantum error correcting code, where \(d_H\) is the minimum Hamming weight of the cyclic code C and \({g_i}\left( x \right) \) is generator polynomial of \(C_i\).

Example 1

Let \({x^{9}} - 1 = {f_1}{f_2}{f_3}\) over \({\mathbb {F}}_5\), where \({f_1} = x + 4\), \({f_2} = 1 + x^3 + {x^6} \) and \({f_3} = 1+x+x^2\). All nontrivial cyclic codes over \(R_5\) of length 9 containing its Hermitian dual and quantum error correcting codes(QECC) obtained by Corollaries 4 and 5 are represented in Table 1.

Table 1 All nontrivial cyclic codes over \(R_5\) of length 9 containing its Hermitian dual and QECC1 and QECC2 obtained by Corollaries 4 and 5 (respectively) in Example 1

Example 2

Let \({x^{11}} - 1 = {f_1}{f_2}{f_3}\) over \({\mathbb {F}}_5\), where \({f_1} = x + 4\), \({f_2} = 4 + x + {x^2} + 4{x^3} + 2{x^4} + {x^5}\) and \({f_3} = 4 + 3x + {x^2} + 4{x^3} + 4{x^4} + {x^5}\). All nontrivial cyclic codes over \(R_5\) of length 11 containing its Hermitian dual and quantum error correcting codes(QECC) obtained by Corollaries 4 and 5 are represented in Table 2.

Table 2 All nontrivial cyclic codes over \(R_5\) of length 11 containing its Hermitian dual and QECC1 and QECC2 obtained by Corollaries 4 and 5 (respectively) in Example 2

Remark 1

The quantum codes having the parameters marked with “*” in Tables 1 and 2 are QMDS codes.

5 Quantum codes from additive cyclic codes over \(R_q\)

This section is devoted to obtaining quantum error correcting codes via additive cyclic codes over \(R_q\) for \(q=p^2\). An additive cyclic code C over \(R_q\) means that C is closed under addition and cyclic shift of a codeword in C is again a codeword in C. In other words, an additive cyclic code of length n over \(R_q\) is an additive subgroup in the quotient group \(\frac{{{R_q}\left[ x \right] }}{{\left\langle {{x^n} - 1} \right\rangle }}\) which is closed under multiplication by x. Making use of technique used in Theorem 14 in [4], we first characterize the structure of additive cyclic codes over \(R_q\) for \(q=p^2\) and then study self-orthogonality condition for these codes which are needed to construct quantum error correcting codes.

Lemma 1

Let \(q=p^2\) be for a prime p and the set \(\left\{ {1,w} \right\} \) be a polynomial basis of \({\mathbb {F}}_q\) over \({\mathbb {F}}_p\). An additive cyclic code over \({\mathbb {F}}_q\) of length n is of the form \(\left\langle {g\left( x \right) + wp\left( x \right) ,wa\left( x \right) } \right\rangle \) for some polynomials \(g\left( x \right) ,p\left( x \right) ,a\left( x \right) \in {{\mathbb {F}}_p}\left[ x \right] \). Furthermore, \({g\left( x \right) }\) and \({a\left( x \right) }\) divide \({x^n} - 1\left( {\bmod \, p} \right) \) and \(\left| C \right| = {p^{2n - \deg g\left( x \right) - \deg a\left( x \right) }}\).

Proof

Consider the map \(\phi :{{\mathbb {F}}_q} \rightarrow {{\mathbb {F}}_p}\) mapping an element \(a + bw\) to a and extend it to the map \(\mu :\frac{{{{\mathbb {F}}_q}\left[ x \right] }}{{\left\langle {{x^n} - 1} \right\rangle }} \rightarrow \frac{{{{\mathbb {F}}_p}\left[ x \right] }}{{\left\langle {{x^n} - 1} \right\rangle }}\), \(\sum {{c_i}{x^i} \rightarrow } \sum {\phi \left( {{c_i}} \right) {x^i}} \). Then, \(\mu \) is an onto \({{{\mathbb {F}}_p}\left[ x \right] }\)-module homomorphism. If C is an additive cyclic code over \({\mathbb {F}}_q\), then the image of C under \(\mu \) is an ideal in \(\frac{{{F_p}\left[ x \right] }}{{\left\langle {{x^n} - 1} \right\rangle }}\) and so has a generator \(g\left( x \right) \) dividing \({x^n} - 1\left( {\bmod \, p} \right) \). Define the set \(J = \left\{ {a\left( x \right) \in \frac{{{F_p}\left[ x \right] }}{{\left\langle {{x^n} - 1} \right\rangle }}:wa\left( x \right) \in Ker\mu } \right\} \). It is immediate that J is an ideal in \(\frac{{{F_p}\left[ x \right] }}{{\left\langle {{x^n} - 1} \right\rangle }}\) and so \(Ker\mu = \left\langle {a\left( x \right) } \right\rangle \) for some polynomial \(\left. {a\left( x \right) } \right| {x^n} - 1\left( {\bmod \, p} \right) \). Since C is generated by the polynomials \(a\left( x \right) \) and some inverse of \(g\left( x \right) \), \(C=\left\langle {g\left( x \right) + wp\left( x \right) ,wa\left( x \right) } \right\rangle \) for some polynomial \(p\left( x \right) \in {{\mathbb {F}}_p}\left[ x \right] \). The remaining is clear. \(\square \)

The following theorem characterizes the structure of additive cyclic codes over \(R_{p^2}\). The proof is similar to the proofs of Theorems 6 and 7, so we omit it here.

Theorem 9

An additive cyclic code C over \(R_{p^2}\) of length n is of the form \(C = \alpha {C_1} \oplus {\alpha ^*}{C_2}\) for some additive cyclic codes \(C_1\) and \(C_2\) of length n over \({\mathbb {F}}_q\). Hence,

$$\begin{aligned} C = \left\langle {\alpha \left( {{g_1}\left( x \right) + w{p_1}\left( x \right) } \right) ,\alpha w{a_1}\left( x \right) ,{\alpha ^*}\left( {{g_2}\left( x \right) + w{p_2}\left( x \right) } \right) ,\alpha ^* w{a_2}\left( x \right) } \right\rangle , \end{aligned}$$
(10)

where \(\left. {{g_i}\left( x \right) ,{a_i}\left( x \right) } \right| {x^n} - 1\left( {\bmod \, p} \right) \).

Next theorem investigates the duals of additive cyclic codes over \(R_{p^2}\) and gives a condition for additive cyclic codes which are Hermitian self-orthogonal.

Theorem 10

Let \(C = \alpha {C_1} \oplus {\alpha ^*}{C_2}\) be an additive cyclic code over \(R_{p^2}\) of length n. Then, \({C^{{ \bot _h}}} = \alpha C_2^ \bot \oplus {\alpha ^*}C_1^ \bot \). Moreover, C is Hermitian self-orthogonal with respect to Hermitian dual if and only if \({C_1} \subseteq C_2^ \bot \).

Proof

Set \(J = \alpha C_2^ \bot \oplus {\alpha ^*}C_1^ \bot \). It is easy to check that \(J \subseteq {C^{{ \bot _h}}}\). Since \(| J| | C | = | {R_{p^2}^n}|\), \(J = {C^{{ \bot _h}}}\). The second part is immediate. \(\square \)

Letting \({C_i} = \left\langle {{g_i}\left( x \right) + w{p_i}\left( x \right) ,w{a_i}\left( x \right) } \right\rangle \) for \(i \in \left\{ {1,2} \right\} \) be an additive cyclic code over \({\mathbb {F}}_{p^2}\), we seek the circumstance for \({C_1} \subseteq C_2^ \bot \).

Lemma 2

\({C_1} \subseteq C_2^ \bot \) if and only if the following hold:

  1. 1.

    \({g_1}\left( x \right) {g_2}\left( {{x^{n - 1}}} \right) +b{p_1}\left( x \right) {p_2}\left( {{x^{n - 1}}} \right) \equiv 0\left( {\bmod \, {x^n} - 1} \right) \),

  2. 2.

    \({g_1}\left( x \right) {p_2}\left( {{x^{n - 1}}} \right) + {p_1}\left( x \right) {g_2}\left( {{x^{n - 1}}} \right) \equiv 0\left( {\bmod \, {x^n} - 1} \right) \),

  3. 3.

    \({g_1}\left( x \right) {a_2}\left( {{x^{n - 1}}} \right) \equiv 0\left( {\bmod \, {x^n} - 1} \right) \),

  4. 4.

    \({p_1}\left( x \right) {a_2}\left( {{x^{n - 1}}} \right) \equiv 0\left( {\bmod \, {x^n} - 1} \right) \),

  5. 5.

    \({a_1}\left( x \right) {g_2}\left( {{x^{n - 1}}} \right) \equiv 0\left( {\bmod \, {x^n} - 1} \right) \),

  6. 6.

    \({a_1}\left( x \right) {p_2}\left( {{x^{n - 1}}} \right) \equiv 0\left( {\bmod \, {x^n} - 1} \right) \),

  7. 7.

    \({a_1}\left( x \right) {a_2}\left( {{x^{n - 1}}} \right) \equiv 0\left( {\bmod \, {x^n} - 1} \right) \),

where b is a nonresidue \(\bmod \, p\).

Proof

Note that \(x^2-b\) is an irreducible polynomial over \({\mathbb {F}}_p\) if b is a nonresidue \(\bmod \, p\). So we can assume that \(w^2=b\). See that the inner product of the vectors corresponding to the polynomials \({g_1}\left( x \right) + w{p_1}\left( x \right) \) and \({x^j}\left( {{g_2}\left( x \right) + w{p_2}\left( x \right) } \right) \) for \(j \in \left\{ {0,1, \ldots ,n - 1} \right\} \) are the coefficient of \({x^j}\) in the polynomial \(( {{g_1}( x ) + w{p_1}( x)} ){x^j}( {{g_2}({{x^{n - 1}}}) + w{p_2}( {{x^{n - 1}}})})\). This fact implies that 1 and 2 hold. The proofs of the remaining are similar. \(\square \)

By considering the images of additive cyclic codes over \(R_{p^2}\) under the Gray map \(\varphi \) , one fails to get p-ary quantum error correcting codes since \(\varphi \) carries elements of \(R_{p^2}\) to vectors in \({\mathbb {F}}_{p^2}^2\). We therefore need a new map to obtain p-ary quantum error correcting codes by using Theorem 2. Let \(\left\{ {1,w} \right\} \) be a polynomial basis of \({\mathbb {F}}_{p^2}\) over \({\mathbb {F}}_p\). Note that every element \(x \in {\mathbb {F}}_{p^2}\) can be written uniquely as \(x=x_1+wx_2\) for some \(x_1, x_2 \in {\mathbb {F}}_p\). Define the map \(\sigma {:}{R_{{p^2}}} \rightarrow {\mathbb {F}}_p^4\) as

$$\begin{aligned} \sigma \left( {x + y\alpha } \right) = \left( {{y_2},{y_1} + {y_2},{x_2} + {y_2},{x_1} + {x_2} + {y_1} + {y_2}} \right) \end{aligned}$$
(11)

and extend it to the map \(\delta {:}R_{{p^2}}^n \rightarrow {\mathbb {F}}_p^{4n}\) as

$$\begin{aligned}&\left( {{r_0}, \ldots ,{r_{n - 1}}} \right) \\&\quad \rightarrow ({y_{0,2}},{y_{0,1}} + {y_{0,2}}, \ldots ,{y_{n - 1,2}},{y_{n - 1,1}} + {y_{0,2}},{x_{0,2}} + {y_{0,2}},{x_{0,1}} + {x_{0,2}}\\&\qquad +\, {y_{0,1}} + {y_{0,2}}, \ldots ,{x_{n - 1,2}} + {y_{n - 1,2}},{x_{n - 1,1}} + {x_{n - 1,2}} + {y_{n - 1,1}} + {y_{n - 1,2}}), \end{aligned}$$

where \({r_i} = {x_{i,1}} + {x_{i,2}} + ( {{y_{i,1}} + {y_{i,2}}} )w\) for some \(x_{i,1},x_{i,2},y_{i,1}y_{i,2} \in {\mathbb {F}}_p\). Before stating that the \(\delta \)-images of two vectors over \(R_{p^2}\) which are perpendicular to each other with respect to Hermitian inner product are so with respect to trace-symplectic inner product, we note that if \({r_1}{ \bot _h}{r_2}\) for two elements \({r_1} = x + y\alpha \) and \({r_2} = u + v\alpha \) in \(R_{{p^2}}\), by Eq. 9, we further get

$$\begin{aligned} {y_1}{u_2} + {y_2}{u_1} - \left( {{x_1}{v_2} + {x_2}{v_1}} \right) = 0 \end{aligned}$$
(12)

and

$$\begin{aligned} {y_1}{u_1} - {x_1}{v_1} + {w^2}\left( {{y_2}{u_2} - {x_2}{v_2}} \right) = 0. \end{aligned}$$
(13)

In this case, we also observe that

$$\begin{aligned} {\left\langle {\delta \left( {{r_1}} \right) ,\delta \left( {{r_2}} \right) } \right\rangle _s}= & {} \mathrm{tr}\left( {{x_1}{v_2} + {x_2}{v_1} - \left( {{y_1}{u_2} + {y_2}{u_1}} \right) } \right) \\&+\, \mathrm{tr}\left( {{x_1}{v_1} - {y_1}{u_1} + 2\left( {{x_2}{v_2} - {y_2}{u_2}} \right) } \right) \\ \end{aligned}$$

and Eq. 12 implies that

$$\begin{aligned} {\left\langle {\delta \left( {{r_1}} \right) ,\delta \left( {{r_2}} \right) } \right\rangle _s} = \mathrm{tr}\left( {{x_1}{v_1} - {y_1}{u_1} + 2\left( {{x_2}{v_2} - {y_2}{u_2}} \right) } \right) . \end{aligned}$$
(14)

Then, \({\left\langle {\delta \left( {{r_1}} \right) ,\delta \left( {{r_2}} \right) } \right\rangle _s}\) vanishes by Eq. 13 if \({w^2} \equiv 2\left( {\bmod \, p} \right) \). This is possible only when 2 is a nonresidue \(\bmod \, p\), otherwise the polynomial \(x^2-2\) is reducible over \({\mathbb {F}}_p\) and so the set \(\left\{ {1,w} \right\} \) does not form a basis for \({\mathbb {F}}_{p^2}\) over \({\mathbb {F}}_p\). We hence have:

Theorem 11

Let p be an odd prime which can be written \(a^2+b^2\) for some \(a,b \in {\mathbb {Z}}\) and \(p \equiv 3\,or\,5\left( {\bmod \, 8} \right) \). Suppose that \(\left\{ {1,w} \right\} \) is a polynomial basis of \({\mathbb {F}}_{p^2}\) over \({\mathbb {F}}_p\), where \({w^2} = 2\). If C is an additive code over \(R_{p^2}\) containing its Hermitian dual, then \(\delta \left( C \right) \) is a linear code over \({\mathbb {F}}_p\) containing its trace-symplectic dual.

Proof

Since \(p \equiv 3\,or\,5\left( {\bmod \, 8} \right) \), 2 is a nonresidue \(\bmod \, p\) and so the polynomial \(x^2-2\) is irreducible over \({\mathbb {F}}_p\). By the above observation and Eq. 13, proof is over. \(\square \)

Theorems 2 and 11 together imply:

Corollary 6

Let p be an odd prime which can be written \(a^2+b^2\) for some \(a,b \in {\mathbb {Z}}\) and \(p \equiv 3\,or\,5\left( {\bmod \, 8} \right) \). Suppose that \(\left\{ {1,w} \right\} \) is a polynomial basis of \({\mathbb {F}}_{p^2}\) over \({\mathbb {F}}_p\), where \({w^2} = 2\). Let \(C = \alpha {C_1} \oplus {\alpha ^*}{C_2}\) be a cyclic code over \(R_{p^2}\) of length n, where for \(i=1,2\), \({C_i} = \left\langle {{g_i}\left( x \right) + w{p_i}\left( x \right) ,{a_i}\left( x \right) } \right\rangle \). If the conditions given in Lemma 2 are satisfied, then there exists a \({[[{2n,2n-k,d}]]_p}\) quantum error correcting code, where \(k = \sum \nolimits _{i = 1}^2 {\deg {g_i} + \deg {a_i}} \) and d is the minimum symplectic weight in \(\delta {\left( C \right) ^{{ \bot _s}}} - \delta \left( C \right) \).

Example 3

Let \({x^{11}} - 1 = {f_1}{f_2}{f_3}\) over \({\mathbb {F}}_5\), where \({f_1} = x + 4\), \({f_2} = 4 + x + {x^2} + 4{x^3} + 2{x^4} + {x^5}\) and \({f_3} = 4 + 3x + {x^2} + 4{x^3} + 4{x^4} + {x^5}\). Table 3 illustrates what we discuss in this section by giving some examples of quantum error correcting codes over \(F_5\) obtained by Hermitian self-orthogonal additive cyclic codes over \(R_{25}\) of length 11.

Table 3 Some nontrivial additive cyclic codes over \(R_{25}\) of length 11 which are Hermitian self-orthogonal and some QECC over \({\mathbb {F}}_5\) of length 22 obtained by Corollary 6 in Example 3

Example 4

Let \(q=29\), \(\alpha =5+2i\) and \({x^{31}} - 1 = {f_1}{f_2}{f_3}{f_4}\). With help of MAGMA and under the conditions of Theorem 8, some nontrivial quantum code parameters of length 31 over \(R_{29}\) are given in Table 4.

Example 5

Let \(q=13\), \(\alpha =3+2i\). Satisfying the conditions given in Corollary 4 and using the software programme Mathematica, we obtain a \([[8,0,4]]_{13}\) quantum code from a classical code C over \(R_{13}\). Also, this classical code C is an extremal self-dual code over \(R_{13}\). The generator matrix G of the classical code C is

$$\begin{aligned} G = \left( {\begin{array}{llllllll} 1&{}{12 + 11\alpha }&{}{8\alpha }&{}{2\alpha }&{}{12}&{}{8 + 7\alpha }&{}{10 + 5\alpha }&{}{3 + 12\alpha }\\ {12\alpha }&{}1&{}{5 + 10\alpha }&{}{11\alpha }&{}{1 + 6\alpha }&{}{1 + 9\alpha }&{}{2 + 8\alpha }&{}{6 + 7\alpha }\\ {5\alpha }&{}{9\alpha }&{}1&{}{8 + 3\alpha }&{}{11 + 8\alpha }&{}2&{}{11 + \alpha }&{}{12 + 6\alpha }\\ \alpha &{}1&{}{11 + \alpha }&{}1&{}{11 + 4\alpha }&{}{9 + 3\alpha }&{}{7 + 10\alpha }&{}{8 + 6\alpha } \end{array}} \right) . \end{aligned}$$
Table 4 Some nontrivial quantum codes over \(R_{29}\) of length 31 which are Hermitian self-orthogonal and some QECC over \({\mathbb {F}}_{29}\) of length 62 obtained by Theorem 8 in Example 4
Table 5 Using the software programme Mathematica and the method given in this paper, some new quantum codes with respect to the Mannheim metric over \(R_{13}\) of length 5, 6, 8 are given

Using the Gray image of this code, we obtain a quantum code with the parameters \([[16,0,\ge 6]]\) over \({\mathbb {F}}_{13}\) (Table 5). The generator matrix of the Gray image of the code C is

$$\begin{aligned} G^{'}=\left( {\begin{array}{llllllllllllllll} 0&{}\quad 4&{}\quad {10}&{}\quad 9&{}\quad 0&{}\quad {12}&{}\quad 3&{}\quad 2&{}\quad 1&{}\quad 6&{}\quad {11}&{}\quad 6&{}\quad {12}&{}\quad 3&{}\quad {12}&{}\quad 0\\ 2&{}\quad 0&{}\quad 6&{}\quad 4&{}\quad 1&{}\quad 8&{}\quad {10}&{}\quad {12}&{}\quad {10}&{}\quad 1&{}\quad 9&{}\quad 7&{}\quad 6&{}\quad 2&{}\quad 0&{}\quad 1\\ 3&{}\quad 8&{}\quad 0&{}\quad 7&{}\quad {10}&{}\quad 0&{}\quad {11}&{}\quad 1&{}\quad 2&{}\quad 1&{}\quad 1&{}\quad 4&{}\quad 9&{}\quad 2&{}\quad 1&{}\quad 4\\ {11}&{}\quad 0&{}\quad {11}&{}\quad 0&{}\quad 5&{}\quad 7&{}\quad 6&{}\quad 1&{}\quad 3&{}\quad 1&{}\quad 1&{}\quad 1&{}\quad {10}&{}\quad 5&{}\quad {11}&{}\quad 0\\ {12}&{}\quad 7&{}\quad 2&{}\quad 7&{}\quad 1&{}\quad {10}&{}\quad 1&{}\quad 0&{}\quad 0&{}\quad 4&{}\quad {10}&{}\quad 9&{}\quad 0&{}\quad {12}&{}\quad 3&{}\quad 2\\ 3&{}\quad {12}&{}\quad 4&{}\quad 6&{}\quad 7&{}\quad {11}&{}\quad 0&{}\quad {12}&{}\quad 2&{}\quad 0&{}\quad 6&{}\quad 4&{}\quad 1&{}\quad 8&{}\quad {10}&{}\quad {12}\\ {11}&{}\quad {12}&{}\quad {12}&{}\quad 9&{}\quad 4&{}\quad {11}&{}\quad {12}&{}\quad 9&{}\quad 3&{}\quad 8&{}\quad 0&{}\quad 7&{}\quad {10}&{}\quad 0&{}\quad {11}&{}\quad 1\\ {10}&{}\quad {12}&{}\quad {12}&{}\quad {12}&{}\quad 3&{}\quad 8&{}\quad 2&{}\quad 0&{}\quad {11}&{}\quad 0&{}\quad {11}&{}\quad 0&{}\quad 5&{}\quad 7&{}\quad 6&{}\quad 1 \end{array}} \right) . \end{aligned}$$

Using the software programme MAGMA, it can easily be checked that this [16, 8, 6] classical linear code is an extremal self-dual code over \({\mathbb {F}}_{13}\).

For the benefit of readers, some of these programs can be found in [7, 8].

6 Quantum logical gates and quantum teleportation in quantum channel over \(R_q\)

In this section, we define quantum logical gates based on Pauli spin matrices, for example Hadamard gate, for quantum codes given in Sects. 4 and 5 for \(q=p\). Using these gates, we encode qubits in quantum channel over \(R_p\).

6.1 Quantum logical gates and basis vectors over \(R_q\)

We can consider a quantum system with p-dimensional state space. For the basis vectors, bra-ket notations are used in general. For p-ary quantum state space, the basis vectors are denoted by

$$\begin{aligned} \left| 0 \right\rangle = {\left( {\begin{array}{l} 1\\ 0\\ \vdots \\ 0 \end{array}} \right) _{p \times 1}},\left| 1 \right\rangle = {\left( {\begin{array}{l} 0\\ 1\\ \vdots \\ 0 \end{array}} \right) _{p \times 1}}, \ldots ,\left| {p - 1} \right\rangle = {\left( {\begin{array}{l} 0\\ 0\\ \vdots \\ 1 \end{array}} \right) _{p \times 1}}. \end{aligned}$$

To define the basis for q-ary quantum state space, we need tensor product. The tensor product \(\otimes \) is usual tensor product, namely \(\left| {{a_1}} \right\rangle \otimes \left| {{a_2}} \right\rangle \otimes \cdots \otimes \left| {{a_n}} \right\rangle = \left| {{a_1}{a_2} \cdots {a_n}} \right\rangle \). Let \(u=(a_1,\ldots , a_n)\) be a vector in a vector space. Thereafter, \(\left| u \right\rangle \) denotes \(\left| {{u_1}{u_2} \cdots {u_n}} \right\rangle \).

Let the set \(P = \left\{ {I,X,Z,Y} \right\} \) denote the well-known Pauli spin matrices. Here, for example, X is known quantum NOT gate that it can flip a quantum bit (shortly qubit). More information can be found in ([13], pp.13–20).

Definition 1

[10, 14] Let the set \({P_p} = \left\{ {I,{X_a},{Z_a},{Y_a}} \right\} \) be the Pauli spin matrices for p-ary quantum state space. The quantum NOT gate X and quantum gate Z were given by

$$\begin{aligned} {\left( {{X_i}} \right) _{s,t}} = {\delta _{t,\left( {s + i\,\left( {\bmod \,p} \right) } \right) }},\quad {\left( {{Z_i}} \right) _{s,t}} = {\xi ^{i.s\,\left( {\bmod \,\,p} \right) }}{\delta _{s,t}}, \end{aligned}$$

respectively. Here, \(\delta _{s,t}\) denotes the Kronecker delta function and \(0 \le s,t \le p - 1\). The Hadamard gate is defined as

$$\begin{aligned} {H_{p}} = \frac{1}{\sqrt{p}}\left( {{a_{s,t}}} \right) ,\quad {a_{s,t}} = {\xi ^{\left( {s - 1} \right) \left( {t - 1} \right) \ \left( {\bmod \;p}\right) }},\quad 1 \le s,t \le p. \end{aligned}$$

These gates act on the quantum state \(\left| {{a_1}} \right\rangle \) as

$$\begin{aligned} {X_a}\left| {{a_1}} \right\rangle = \left| {{a_1} + a\,\,(\mathrm{mod}\,p)} \right\rangle ,\,{Z_a}\left| {{a_1}} \right\rangle = {\xi ^{Tr(a{a_1})}}\left| {{a_1}} \right\rangle ,\,{Y_a} = {X_a}{Z_a}, \end{aligned}$$

where \(\xi =e^{2\pi i/p}\). Lastly, the Hadamard gate for q-ary quantum state space was constructed by

$$\begin{aligned} {H_q} = \frac{1}{{\sqrt{q} }}\left( {\underbrace{{H_p} \otimes \cdots \otimes {H_p}}_{m\,\,\,{\mathrm{times}}}} \right) . \end{aligned}$$

For example, let \(p=5\). Then,

$$\begin{aligned} {H_{p}} = \frac{1}{\sqrt{5}}\left( {\begin{array}{lllll} 1 &{}\quad 1 &{}\quad 1 &{}\quad 1 &{}\quad 1 \\ 1 &{}\quad \xi &{}\quad {{\xi ^2}} &{}\quad {{\xi ^3}} &{}\quad {{\xi ^4}} \\ 1 &{}\quad {{\xi ^2}} &{}\quad {{\xi ^4}} &{}\quad \xi &{}\quad {{\xi ^3}} \\ 1 &{}\quad {{\xi ^3}} &{}\quad \xi &{}\quad {{\xi ^4}} &{}\quad {{\xi ^2}} \\ 1 &{}\quad {{\xi ^4}} &{}\quad {{\xi ^3}} &{}\quad {{\xi ^2}} &{}\quad \xi \\ \end{array}} \right) . \end{aligned}$$

Note that \({H_{p}}H_{p}^\dag =H_{p}^\dag {H_{p}} = {I_p}\), where \(H_{p}^\dag \) denotes the conjugate transpose of \(H_{p}\) and \(I_p\) denotes the identity matrix in p dimensions. In light of the above facts, we now define basis vectors and quantum logical gates for a p-ary quantum state space over \(R_p\).

Definition 2

Let \(r=r_1+r_2\alpha \) be an element of \(R_p\) and let \(X_{r_1},X_{r_2},Z_{r_1}\) and \(Z_{r_2}\) denote the quantum gates given in Definition 1. We define quantum gates \(X_r^{'}\) and \(Z_r^{'}\) over \(R_p\) as

$$\begin{aligned} X_r^{'} = {X_{{r_1}}} \otimes {X_{{r_2}}},\quad Z_r^{'} = {Z_{{r_1}}} \otimes {Z_{{r_2}}}, \end{aligned}$$

respectively. Also, we define Hadamard gate \(H_p^{'}\) for \(R_p\) as

$$\begin{aligned} H_p^{'} = {H_p \otimes H_p}. \end{aligned}$$

Example 6

Let \(\alpha =2+i\), that is, \(p=5\). There are 25 quantum \(X_r^{'}\) gates and 25 quantum \(Z_r^{'}\) gates for \(R_5={\mathbb {F}} _5+\alpha {\mathbb {F}} _5\). Using the above method, we now give some of them:

$$\begin{aligned} X_1^{'} = {X_1} \otimes {X_0} = {\left[ {\begin{array}{lllll} {{0_5}}&{}\quad {{I_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}\\ {{0_5}}&{}\quad {{0_5}}&{}\quad {{I_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}\\ {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{I_5}}&{}\quad {{0_5}}\\ {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{I_5}}\\ {{I_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}} \end{array}} \right] _{25 \times 25}}, \end{aligned}$$

where \(0_5\) denotes \(5\times 5\) zero matrix and

$$\begin{aligned} {X_1} = {\left[ {\begin{array}{lllll} 0&{}\quad 1&{}\quad 0&{}\quad 0&{}\quad 0\\ 0&{}\quad 0&{}\quad 1&{}\quad 0&{}\quad 0\\ 0&{}\quad 0&{}\quad 0&{}\quad 1&{}\quad 0\\ 0&{}\quad 0&{}\quad 0&{}\quad 0&{}\quad 1\\ 1&{}\quad 0&{}\quad 0&{}\quad 0&{}\quad 0 \end{array}} \right] _{5 \times 5}}. \end{aligned}$$

Note \(1=1+0.\alpha \), that is, \(r_1=1,r_2=0\), and \(X_0=I_5\).

Another quantum NOT gate \(X_\alpha ^{'}\) for \(R_5\) is

$$\begin{aligned}&X_\alpha ^{'} = {\left[ {\begin{array}{lllll} {{X_1}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}\\ {{0_5}}&{}\quad {{X_1}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}\\ {{0_5}}&{}\quad {{0_5}}&{}\quad {{X_1}}&{}\quad {{0_5}}&{}\quad {{0_5}}\\ {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{X_1}}&{}\quad {{0_5}}\\ {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{X_1}} \end{array}} \right] _{25 \times 25}}, \\&\begin{array}{c} Z_1^{'} = {Z_1} \otimes {Z_0} = \left[ {\begin{array}{lllll} 1&{}\quad 0&{}\quad 0&{}\quad 0&{}\quad 0\\ 0&{}\quad \xi &{}\quad 0&{}\quad 0&{}\quad 0\\ 0&{}\quad 0&{}\quad {{\xi ^2}}&{}\quad 0&{}\quad 0\\ 0&{}\quad 0&{}\quad 0&{}\quad {{\xi ^3}}&{}\quad 0\\ 0&{}\quad 0&{}\quad 0&{}\quad 0&{}\quad {{\xi ^4}} \end{array}} \right] \otimes {I_5}\\ \\ = {\left[ {\begin{array}{lllll} {{I_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}\\ {{0_5}}&{}\quad {\xi {I_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}\\ {{0_5}}&{}\quad {{0_5}}&{}\quad {{\xi ^2}{I_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}\\ {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{\xi ^3}{I_5}}&{}\quad {{0_5}}\\ {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{0_5}}&{}\quad {{\xi ^4}{I_5}} \end{array}} \right] _{25 \times 25}} \end{array}, \end{aligned}$$

The Hadamard gate \(H_p^{'}\) acts on the state \(\left| 0 \right\rangle \) as

$$\begin{aligned} {H_p}^{'}\left| 0 \right\rangle= & {} \left| 0 \right\rangle + \left| 1 \right\rangle + \left| 2 \right\rangle + \left| 3 \right\rangle + \left| 4 \right\rangle + \left| \alpha \right\rangle \\&\quad +\,\left| {2\alpha } \right\rangle + \left| {3\alpha } \right\rangle + \left| {4\alpha } \right\rangle + \left| {1 + \alpha } \right\rangle + \left| {2 + \alpha } \right\rangle + \left| {3 + \alpha } \right\rangle \\&\quad +\,\left| {4 + \alpha } \right\rangle + \left| {1 + 2\alpha } \right\rangle + \left| {2 + 2\alpha } \right\rangle + \left| {3 + 2\alpha } \right\rangle + \left| {4 + 2\alpha } \right\rangle + \left| {1 + 3\alpha } \right\rangle \\&\quad +\, \left| {2 + 3\alpha } \right\rangle + \left| {3 + 3\alpha } \right\rangle + \left| {4 + 3\alpha } \right\rangle + \left| {1 + 4\alpha } \right\rangle + \left| {2 + 4\alpha } \right\rangle + \left| {3 + 4\alpha } \right\rangle \\&+ \left| {4 + 4\alpha } \right\rangle . \end{aligned}$$

The number of basis vector for quantum codes defined over \(R_5\) is 25, namely

$$\begin{aligned}&\left| 0 \right\rangle ,\left| 1 \right\rangle ,\left| 2 \right\rangle ,\left| 3 \right\rangle ,\left| 4 \right\rangle ,\\&\quad \left| \alpha \right\rangle ,\left| {1 + \alpha } \right\rangle ,\left| {2 + \alpha } \right\rangle ,\left| {3 + \alpha } \right\rangle ,\left| {4 + \alpha } \right\rangle ,\\&\quad \left| {1 + 2\alpha } \right\rangle ,\left| {2 + 2\alpha } \right\rangle , \ldots ,\left| {4 + 4\alpha } \right\rangle . \end{aligned}$$

Using the above NOT gates \(X_1 ^{'}\) and \(X_\alpha ^{'}\), we define some of these basis vectors as

$$\begin{aligned} \left| 0 \right\rangle= & {} {\left( {\begin{array}{c} 1\\ 0\\ 0\\ \vdots \\ 0 \end{array}} \right) _{25 \times 1}},\\ \left| 1 \right\rangle= & {} X_1^{'}\left| 0 \right\rangle = {\left( {\begin{array}{c} 0\\ \vdots \\ 0\\ {1\,(21th\,{\mathrm{component}})}\\ 0\\ \vdots \\ 0 \end{array}} \right) _{25 \times 1}},\\ \left| 2 \right\rangle= & {} X_1^{'}\left| 1 \right\rangle = {\left( {\begin{array}{c} 0\\ \vdots \\ 0\\ {1\,(16th\,{\mathrm{component}})}\\ 0\\ \vdots \\ 0 \end{array}} \right) _{25 \times 1}},\\ \left| \alpha \right\rangle= & {} X_\alpha ^{'}\left| 0 \right\rangle = {\left( {\begin{array}{c} 0\\ \vdots \\ 0\\ {1\,(5th\,{\mathrm{component}})}\\ 0\\ \vdots \\ 0 \end{array}} \right) _{25 \times 1}},\\ \left| {1 + \alpha } \right\rangle= & {} X_1^{'}\otimes \left( {X_\alpha ^{'}\left| 0 \right\rangle } \right) . \end{aligned}$$

It is clear that we obtain all basis vectors, using the above method since \(\left| {{r_1} + {r_2}\alpha } \right\rangle = X_{{r_1}}^{'}\otimes \left( {X_{{r_2}\alpha }^{'}\left| 0 \right\rangle } \right) \) and \(\,\left| {{r_2}\alpha } \right\rangle = \underbrace{X_{{\alpha }}^{'}\otimes X_{\alpha }^{'} \otimes \cdots \otimes X_{\alpha }^{'}}_{{r_2}\,times}\left| 0 \right\rangle \).

6.2 Quantum encoding

There are infinitely many \(p\times p\) matrices, and thus infinitely many single qubit gates. However, it turns out that the properties of the complete set can be understood from the properties of a much smaller set. It is possible to build up an arbitrary single qubit gate using a finite set of quantum gates. More generally, an arbitrary quantum computation on any number of qubits can be generated by a finite set of gates that is said to be universal for quantum computation. To obtain such a universal set, we first can construct some quantum gates involving multiple qubits. We already define single qubit gates in Definition 2. To obtain such a universal set, we need quantum controlled-NOT, shortly CNOT, gate which is a multiple qubits gate.

Definition 3

([13], pp. 177–193, 484–488) The prototypical multi-qubit quantum logic gate is the controlled-NOT gate. This gate has two input qubits, known as the control qubit and the target qubit, respectively. The CNOT acts on qubits in two-dimensional quantum state space as:

$$\begin{aligned} \begin{array}{*{20}{c}} {CNOT\left| {00} \right\rangle = \left| {00} \right\rangle ,\,\,CNOT\left| {01} \right\rangle = \left| {01} \right\rangle ,}\\ {CNOT\left| {10} \right\rangle = \left| {11} \right\rangle ,\,\,CNOT\left| {11} \right\rangle = \left| {10} \right\rangle .} \end{array} \end{aligned}$$

Definition 4

Let \(r_1 + {r_2}\alpha \) be an element of \(R_p\). Then, we define CNOT for p-dimensional quantum state space over \(R_p\) as follows:

$$\begin{aligned} CNO{T_{{r_1} + {r_2}\alpha }}\left| {{r_1} + {r_2}\alpha \,\,{r_1} + {r_2}\alpha } \right\rangle = \left| {{r_1} + {r_2}\alpha 0} \right\rangle . \end{aligned}$$

Here, \(CNOT_{{r_1} + {r_2}\alpha }\) is a matrix with type \(p^4\times p^4\). Note \(CNO{T_{{r_1} + {r_2}\alpha }}\left| {{r_3} + {r_4}\alpha \,\,0} \right\rangle = \left| {{r_3} + {r_4}\alpha 0} \right\rangle \) for \({r_1} + {r_2}\alpha \ne {r_3} + {r_4}\alpha \).

For example, \(CNO{T_1}\left| {10} \right\rangle = \left| {11} \right\rangle \), \(CNO{T_2}\left| {20} \right\rangle = \left| {22} \right\rangle \), \(CNO{T_\alpha }\left| {\alpha 0} \right\rangle = \left| {\alpha \alpha } \right\rangle \).

Example 7

Using these quantum gates and taking \(\alpha =2+i\), let us encode the quantum state

$$\begin{aligned} \left| \psi \right\rangle= & {} {a_0}\left| 0 \right\rangle + {a_1}\left| 1 \right\rangle + {a_2}\left| 2 \right\rangle + {a_3}\left| 3 \right\rangle + {a_4}\left| 4 \right\rangle + {a_5}\left| \alpha \right\rangle \\&\quad +\, {a_6}\left| {2\alpha } \right\rangle + {a_7}\left| {3\alpha } \right\rangle + {a_8}\left| {4\alpha } \right\rangle + {a_9}\left| {1 + \alpha } \right\rangle + \cdots + {a_{24}}\left| {4 + 4\alpha } \right\rangle \end{aligned}$$

to

$$\begin{aligned} \left| {{\psi ^{'}}} \right\rangle= & {} {a_0}\left| {\underbrace{0 \cdots 0}_{26}} \right\rangle + {a_1}\left| {1 \cdots 1} \right\rangle + {a_2}\left| {2 \cdots 2} \right\rangle + {a_3}\left| {3 \cdots 3} \right\rangle \\&\quad +\, {a_4}\left| {4 \cdots 4} \right\rangle + {a_5}\left| {\alpha \cdots \alpha } \right\rangle + \cdots + {a_{24}}\left| {4 + 4\alpha \cdots 4 + 4\alpha } \right\rangle . \end{aligned}$$

A circuit performing this encoding is illustrated in Fig. 2. Circuit symbols of quantum gates are given in Fig. 1.

Fig. 1
figure 1

Quantum gates and circuit symbols

Fig. 2
figure 2

Encoding circuit for the three-qubit bit flip code. The data to be encoded enters the circuit on the top line

In Fig. 2, \(\left| {{\psi _1}} \right\rangle \,,\,\left| {{\psi _2}} \right\rangle ,\,\,\left| {{\psi _3}} \right\rangle ,\,\left| {{\psi _{24}}} \right\rangle \) are

$$\begin{aligned} \left| {{\psi _1}} \right\rangle= & {} {a_0}\left| {\underbrace{0 \cdots 0}_{26}} \right\rangle + {a_1}\left| {11\underbrace{0 \cdots 0}_{24}} \right\rangle + {a_2}\left| {22\underbrace{0 \cdots 0}_{24}} \right\rangle + {a_3}\left| {33\underbrace{0 \cdots 0}_{24}} \right\rangle \\&\quad +\, {a_4}\left| {44\underbrace{0 \cdots 0}_{24}} \right\rangle + {a_5}\left| {\alpha \alpha \underbrace{0 \cdots 0}_{24}} \right\rangle + \cdots + {a_{24}}\left| {4 + 4\alpha \,4 + 4\alpha \underbrace{0 \cdots 0}_{24}} \right\rangle \\ \left| {{\psi _2}} \right\rangle= & {} {a_0}\left| {\underbrace{0 \cdots 0}_{26}} \right\rangle + {a_1}\left| {111\underbrace{0 \cdots 0}_{23}} \right\rangle + {a_2}\left| {222\underbrace{0 \cdots 0}_{23}} \right\rangle + {a_3}\left| {333\underbrace{0 \cdots 0}_{23}} \right\rangle \\&\quad +\, {a_4}\left| {444\underbrace{0 \cdots 0}_{23}} \right\rangle + {a_5}\left| {\alpha \alpha \alpha \underbrace{0 \cdots 0}_{23}} \right\rangle + \cdots \\&+ {a_{24}}\left| 4 + 4\alpha 4 + 4\alpha \,4 + 4\alpha \underbrace{0 \cdots 0}_{23} \right\rangle , \\ \left| {{\psi _3}} \right\rangle= & {} {a_0}\left| {\underbrace{0 \cdots 0}_{26}} \right\rangle + {a_1}\left| {1111\underbrace{0 \cdots 0}_{22}} \right\rangle + {a_2}\left| {2222\underbrace{0 \cdots 0}_{22}} \right\rangle \\&\quad +\, {a_3}\left| {3333\underbrace{0 \cdots 0}_{22}} \right\rangle + {a_4}\left| {4444\underbrace{0 \cdots 0}_{22}} \right\rangle \\&\quad +\, {a_5}\left| {\alpha \alpha \alpha \alpha \underbrace{0 \cdots 0}_{22}} \right\rangle + \cdots + {a_{24}}\left| {4 + 4\alpha \,4 + 4\,\alpha 4 + 4\alpha \,4 + 4\alpha \underbrace{0 \cdots 0}_{22}} \right\rangle , \\ \left| {{\psi _{24}}} \right\rangle= & {} {a_0}\left| {\underbrace{0 \cdots 0}_{26}} \right\rangle + {a_1}\left| {\underbrace{1 \cdots 1}_{25}0} \right\rangle + {a_2}\left| {\underbrace{2 \cdots 2}_{25}0} \right\rangle + {a_3}\left| {\underbrace{3 \cdots 3}_{25}0} \right\rangle + {a_4}\left| {\underbrace{4 \cdots 4}_{25}0} \right\rangle \\&\quad +\, {a_5}\left| {\underbrace{\alpha \cdots \alpha }_{25}0} \right\rangle + \cdots + {a_{24}}\left| {\underbrace{4 + 4\alpha \cdots 4 + 4\alpha }_{25}0} \right\rangle . \end{aligned}$$

\(\left| {{\psi _{25}}} \right\rangle = \left| {{\psi ^{'}}} \right\rangle \) is given above. Using these quantum logical gates and basis vectors, one can encode codes given in Tables 1, 2 and 3 in previous section.

7 Conclusion

Since there is a transformation between quantum error correction codes over the finite field \({\mathbb {F}}_q\) and additive codes over \({\mathbb {F}}_q\) which are self-orthogonal with respect to certain inner products [10], we consider these additive codes as the Gray images of cyclic codes over \(R_q\) containing their Hermitian duals and Hermitian self-orthogonal additive cyclic codes over \(R_{p^2}\), respectively. The structures of cyclic codes and their duals over \(R_q\) are determined, and the condition for cyclic codes to contain their duals is given. Considering the images of these cyclic codes under the Gray map \(\varphi \), we obtain two classes of q-ary quantum error correcting codes. We also tabulate all nontrivial cyclic codes over \(R_5\) of length 9 and 11 which contain their Hermitian duals and quantum codes obtained by Gray images of these codes. Note that we can tabulate all nontrivial cyclic codes over \(R_q\) of some length n. But as the length n increases, the table occupies more space in the paper. Also, for \(q=p^2\), the structure of additive cyclic codes over \(R_q\) is studied and the circumstances of these codes to be self-orthogonal with respect to Hermitian inner product are given. Introducing the map \(\delta \), we obtain a class of p-ary quantum error correcting codes of length 2n from the additive cyclic codes over \(R_{p^2}\) of length n. We furthermore give some examples of additive cyclic codes over \(R_{25}\) of length 11 and quantum codes over \({\mathbb {F}}_5\) of length 22 obtained by the help of \(\delta \)-images of these codes.