1 Introduction

Let \(q=p^{e}\) for a prime p. Denote by \( \mathbb {F}_{Q} =\mathbb {F}_{q^{m}} \) the finite field with Q elements and \(\mathbb {F}_{q^{m}}^{*}\) the multiplicative group of \(\mathbb {F}_{q^{m}}\).

If C is a k-dimensional \(\mathbb {F}_{q}\)-vector subspace of \(\mathbb {F}_{q}^{n},\) then it is called an [nkd] linear code with length n and minimum Hamming distance d over \(\mathbb {F}_{q}.\) Here the Hamming distance d(xy) between two codewords \(x,y\in C\) is defined as the numbers of places in which x is different from y. And \(d=\min \{d(x,0)|x\in C, x\ne 0\}\) since C is linear. Denote by \(A_{i}\) the number of codewords with Hamming weight i in C. If \(|\{i:A_i\ne 0,1\le i\le n\}|=t, \) then C is called a t-weight code. The readers are referred to [12] for more details and general theory of linear codes.

A generic construction of linear code as below was proposed by Ding et al. [5, 6]. Let \( D= \{d_{1},d_{2}, \ldots ,d_{n}\}\) be a subset of \( \mathbb {F}_Q^{*}. \) Define a linear code \( C_{D} \) of length n over \( \mathbb {F}_{q} \) as follows:

$$\begin{aligned} C_{D}=\{\left( \mathrm {Tr}_{Q/q}(xd_1), \mathrm {Tr}_{Q/q}(xd_2),\ldots , \mathrm {Tr}_{Q/q}(xd_{n})\right) :x\in \mathbb {F}_{Q}\}, \end{aligned}$$
(1)

where \( \mathrm {Tr}_{Q/q}\) is the standard trace map from \(\mathbb {F}_Q\) to \(\mathbb {F}_q\) and D is called the defining set. The method is used in a lot of references to get linear codes with a few weights [9, 17, 23, 24] by choosing properly defining sets.

For an [nkd] linear code C,  we could extend Hamming weight to obtain the concept of the generalized Hamming weight(GHW) \( d_{r}(C)(0<r\le k)\) (see [15, 20]). It is defined as follows. Denote by \( [C,r]_{q} \) the set of the r-dimensional \(\mathbb {F}_{q}\)-vector subspaces of C. For \( V \in [C,r]_{q}, \) let Supp(V) be the set of positions i where there exists a codeword \( x = (x_{1}, x_{2}, \ldots , x_{n})\in V \) with \( x_{i} \ne 0. \) Then the rth generalized Hamming weight(GHW) \( d_{r}(C)\) of the linear code C is defined by

$$\begin{aligned} d_{r}(C)=\min \{|Supp(V)|:V\in [C,r]_{q}\}, \end{aligned}$$

and \( \{d_{i}(C): 1\le i \le k\} \) is defined to be the weight hierarchy of C. In particular, the GHW \( d_{1}(C)\) is just the usual minimum distance d. Since the classic results of Wei in the paper [20] in 1991, many people researched into the generalized Hamming weight. A survey on known results on this topic up to 1995 was done in [19]. Afterwards there have been a number of studies on the generalized Hamming weight of some particular families of codes [1,2,3, 7, 11, 13, 14, 21, 22]. It is worth mentioning that the recent work in [22] gave a very instructive approach to calculating the GHWs of irreducible cyclic codes. Generally, it is not easy to determine the weight hierarchy.

The rest of this paper is organized as follows: in Sect. 2, we review basic concepts and results on Gauss sum and exponential sums which are needed in this paper; in Sect. 3, we follow the work of Ding et al. [8, 10] to construct a class of cyclotomic linear codes and give general formulas on \( d_{r}(C). \) Meanwhile, we determine their weight distribution under certain conditions; in Sect. 4, we give the conclusion of this paper.

2 Preliminaries

We assume that h is a positive divisor of \(Q-1\) and \(1<h<\sqrt{Q}+1.\) And \(\theta \) is a fixed primitive element of \(\mathbb {F}_{Q}=\mathbb {F}_{q^{m}}.\) We start with the additive character. Let \(b\in \mathbb {F}_{Q}\), the mapping

$$\begin{aligned} \chi _{b}(c)=\zeta _{p}^{\mathrm {Tr}_{Q/p}(bc)} \ \text {for all }\ c\in \mathbb {F}_{Q}, \end{aligned}$$

defines an additive character of \(\mathbb {F}_{Q}, \) where \(\zeta _{p}=e^{\frac{2\pi \sqrt{-1}}{p}}. \) Particularly, the character \(\chi _{1}\) is called the canonical additive character of \(\mathbb {F}_{Q}\). The multiplicative characters of \(\mathbb {F}_{Q}\) are defined by

$$\begin{aligned} \psi _{j}(\theta ^{k})=e^{2\pi \sqrt{-1}jk/(Q-1)} \ \text {for }\ k=0,1,\ldots , Q-2, \ 0\le j\le Q-2. \end{aligned}$$

For each additive \( \chi \) and multiplicative character \(\psi ,\) we define the Gauss sum \(G_{Q}(\psi , \chi )\) over \(\mathbb {F}_{Q}\) by

$$\begin{aligned} G_{Q}(\psi , \chi )=\sum _{x\in \mathbb {F}_{Q}^{*}}\psi (x)\chi (x). \end{aligned}$$

The reader can refer to [16] for more information about the explicit values of Gauss sums.

For each \( \alpha \in \mathbb {F}_{Q}, \) an exponential sum \( S(\alpha ) \) is defined as follows.

$$\begin{aligned} S(\alpha )=\sum _{x\in \mathbb {F}_{Q}}\chi _{1}(\alpha x^{h}). \end{aligned}$$

For an integer i,  define

$$\begin{aligned} C_{i}=\left\{ \theta ^{i}(\theta ^{h})^{j}: 0\le j< \frac{Q-1}{h}\right\} ,\ \eta _{i}=\sum _{x\in C_{i}}\chi _{1}(x). \end{aligned}$$

It is easy to see \( C_{u}=C_{v} \) if and only if \( u\equiv v \ (\text {mod}\ h).\) These sets \( C_{i}\) and numbers \( \eta _{i} \) are called the cyclotomic classes and Gaussian periods (see [4]) of order h in \( \mathbb {F}_{Q}^{*}, \) respectively. By definition, it is not hard to get \( S(\theta ^{i})=h\eta _{i}+1.\)

The following lemma is about the explicit values of the exponential sum \( S(\alpha ). \) It will be used later.

Lemma 1

([18]) Assume \( m=2lk, h|(q^{k}+1). \) Then for any \( \alpha \in \mathbb {F}_{Q}^{*}, \)

$$\begin{aligned} S(\alpha )=\left\{ \begin{array}{ll} (-1)^{l}\sqrt{Q}, &{} \text {if } \ \alpha \notin C_{h_{0}}, \\ (-1)^{l-1}(h-1)\sqrt{Q}, &{} \text {if } \ \alpha \in C_{h_{0}}, \end{array} \right. \end{aligned}$$

where

$$\begin{aligned} h_{0}=\left\{ \begin{array}{ll} \frac{h}{2}, &{} \text {if } \ p>2, l\ \text {odd, and } \frac{q^{k}+1}{h}\ \text {odd }, \\ 0, &{} \text {otherwise }. \end{array} \right. \end{aligned}$$

Here we present three bounds on GHWs of linear codes. The reader may refer to the literature [19] for them.

Lemma 2

Let C be a linear code over \( \mathbb {F}_{q} \) with parameters [nm]. For \(1\le r \le m, \)

  1. 1.

    (Singleton type bound) \( r\le d_{r}(C)\le n-m+r. \) And C is called an r-MDS code if \(d_{r}(C) = n-m+r.\)

  2. 2.

    (Griesmer-like bound)

    $$\begin{aligned} d_{r}(C)\ge \sum _{i=0}^{r-1}\left\lceil \frac{d_{1}(C)}{q^{i}} \right\rceil . \end{aligned}$$
  3. 3.

    (Plotkin-like bound)

    $$\begin{aligned} d_{r}(C)\le \left\lfloor \frac{n(q^{r}-1)q^{m-r}}{q^{m}-1} \right\rfloor . \end{aligned}$$

3 Main results and proofs

First of all, we give a general formula for computing the GHWs of the linear code defined by the generic method in (1) with the defining set D.

Theorem 1

For each \( r (1\le r \le m), \) if the dimension of \( C_{D} \) is m,  then \(d_{r}(C_{D})= n-\max \{|D \bigcap H|: H \in [\mathbb {F}_{Q},m-r]_{q}\}. \)

Proof

The proof is similar to that of Theorem 6 in [22]. But for the convenience of the reader, we provide the proof. Let \( \phi \) be a mapping from \( \mathbb {F}_{Q} \) to \( \mathbb {F}_{q}^{n}\) defined by

$$\begin{aligned} \phi (x)=( \mathrm {Tr}_{Q/q}(xd_1), \mathrm {Tr}_{Q/q}(xd_2),\ldots , \mathrm {Tr}_{Q/q}(xd_{n})) \end{aligned}$$

for each \(x\in \mathbb {F}_{Q}. \) Obviously, \(\phi \) is an \(\mathbb {F}_{q}\)-linear mapping and the image of \(\phi \) is \(C_{D}.\) And \(\phi \) is injective since the dimension of \( C_{D} \) is m. For an r-dimension subspace \( U_{r} \in [C_{D}, r]_{q}, \) denote by \(H_{r}\) the pre-image \(\phi ^{-1}(U_{r})\) in \(\mathbb {F}_{Q}.\) Also \(H_{r}\) is an r-dimension subspace of \(\mathbb {F}_{Q}.\) By definition, \( d_{r}(C_{D})= n-\max \{N(U_{r}): U_{r} \in [C_{D}, r]_{q}\}, \) where

$$\begin{aligned} N(U_{r})= & {} \sharp \{i: 1\le i \le n, c_{i}=0\ \ \text {for each } c=(c_{1},c_{2}, \ldots , c_{n}) \in U_{r}\}\\= & {} \sharp \{i: 1\le i \le n, \mathrm {Tr}_{Q / q}(\beta d_{i})=0\ \ \text {for each } \beta \in H_{r}\}. \end{aligned}$$

Let \( \{ \beta _{1},\beta _{2},\ldots ,\beta _{r}\}\) be an \(\mathbb {F}_{q}\)-basis of \( H_{r}. \) Then

$$\begin{aligned} N(U_{r})&=\frac{1}{q^{r}}\sum _{i=1}^{n}\sum _{x_{1}\in F_{q}}\zeta _{p}^{\mathrm {Tr}_{q/ p}(\mathrm {Tr}_{Q/ q}(\beta _{1} d_{i})x_{1})}\ldots \sum _{x_{r}\in \mathbb {F}_{q}}\zeta _{p}^{\mathrm {Tr}_{q/ p}(\mathrm {Tr}_{Q/ q}(\beta _{r} d_{i})x_{r})} \nonumber \\&=\frac{1}{q^{r}}\sum _{i=1}^{n}\sum _{x_{1},\ldots ,x_{r}\in \mathbb {F}_{q}}\zeta _{p}^{\mathrm {Tr}_{Q/ p}( d_{i}(\beta _{1}x_{1}+\cdots +\beta _{r}x_{r}))} \nonumber \\&=\frac{1}{q^{r}}\sum _{i=1}^{n}\sum _{\beta \in H_{r}}\zeta _{p}^{\mathrm {Tr}_{Q/ p}(\beta d_{i})}. \nonumber \end{aligned}$$

Let \( H^{\bot }=\{v\in \mathbb {F}_{Q}: \mathrm {Tr}_{Q/q}(uv)=0 \ \text {for any}\ u \in H\}.\) It is called the dual of H. We know that \( \dim _{\mathbb {F}_{q}}(H)+\dim _{\mathbb {F}_{q}}(H^{\bot })=m.\)

For \(y\in \mathbb {F}_{Q}, \)

$$\begin{aligned} \sum _{\beta \in H_{r}}\zeta _{p}^{\mathrm {Tr}_{Q/ p}(\beta y)}=\left\{ \begin{array}{ll} |H_{r}|, &{} \text {if } \ y \in H_{r}^{\bot }, \\ 0, &{} \text {otherwise }. \end{array} \right. \end{aligned}$$

By the above equation, we have

$$\begin{aligned} N(U_{r}) =\frac{1}{q^{r}}\sum _{y\in D \bigcap H_{r}^{\bot }} |H_{r}|=|D \bigcap H_{r}^{\bot }|. \end{aligned}$$

So the desired result follows from the fact that there is a bijection between \([\mathbb {F}_{Q},r]_{q}\) and \([\mathbb {F}_{Q},m-r]_{q}.\) We complete the proof.

From now on, we suppose \( h(q-1)\) is also a divisor of \(Q-1.\) In [10], C. Ding and H. Niederreiter presented two classes of cyclotomic linear codes of order 3 and determined their weight distributions. Inspired by their work, we construct linear codes by choosing the defining set to be

$$\begin{aligned} \overline{D} =\{\theta ^{t_{1}} d_{1},\ldots ,\theta ^{t_{1}} d_{n_{0}},\theta ^{t_{2}} d_{1},\ldots ,\theta ^{t_{2}} d_{n_{0}}, \ldots ,\theta ^{t_{s}} d_{1},\ldots ,\theta ^{t_{s}} d_{n_{0}}\}, \end{aligned}$$

where \(d_{i}=\theta ^{h(i-1)}, n_{0}=\frac{q^{m}-1}{h(q-1)}, 0\le t_{1}<t_{2}<\cdots <t_{s} \le h-1, 1\le s\le h. \) The code \(C_{\overline{D}}\) is closely related to irreducible cyclic codes. Note that \(\{ d_{1}, d_{2}, \ldots , d_{n_{0}}\}\) is a complete set of coset representatives of the quotient group \(C_{0}/\mathbb {F}_{q}^{*}\) since \(h(q-1)\) divides \(Q-1.\) If \(s=1, t_{1}=0,\) then \(C_{\overline{D}}\) is a linear code punctured from the code \(C_{C_{0}}\) (see [8]). Here \(C_{C_{0}}\) is the code defined in (1) with the defining set \(D=C_{0}.\) It is known as the irreducible cyclic code. Thus we also call \(C_{\overline{D}}\) a cyclotomic linear code since \(\overline{D}\) has relation to the cyclotomic classes of order h in \( \mathbb {F}_{Q}^{*}. \)

In addition to Theorem 1, we give alternative formulas for calculating the GHWs of the cyclotomic linear code \(C_{\overline{D}}\).

Theorem 2

For each \( r(1\le r \le m),\) if \(\dim (C_{\overline{D}})=m,\) then \( d_{r}(C_{\overline{D}})= sn_{0}-N_{r}, \) where

  1. 1.

    \( N_{r}=\frac{s(q^{m}-q^{r})}{hq^{r}(q-1)}+\frac{1}{hq^{r}(q-1)}\max \{ A_{H_{r}} : H_{r} \in [\mathbb {F}_Q, r]_{q}\}, \) and

    \( A_{H_{r}} =\sum _{j=1}^{s}\sum _{\lambda =1}^{h-1}\sum _{\beta \in H_{r}^{*}}\overline{\varphi ^{\lambda }} (\beta \theta ^{t_{j}})G_{Q}(\varphi ^{\lambda }), \) or

  2. 2.

    \( N_{r}=\frac{sn_{0}}{q^{r}}+\frac{1}{q^{r}(q-1)}\max \{ \sum _{i=0}^{h-1}|H_{r}\bigcap (\bigcup _{j=1}^{s}C_{i-t_{j}})|\eta _{i} : H_{r} \in [\mathbb {F}_Q, r]_{q}\}.\)

Proof

1. By definition, \( d_{r}(C_{\overline{D}})= sn_{0}-N_{r}, N_{r}=\max \{N(U_{r}):U_{r}\in [{C}_{\overline{D}},r]_{q}\}. \) Let \( \{ \beta _{1},\beta _{2},\ldots ,\beta _{r}\}\) be an \(\mathbb {F}_{q}\)-basis of \( H_{r}. \) Here \( \phi ( H_{r})=U_{r}.\) See the proof of Theorem 1 for the definitions of \(N(U_{r})\) and \(\phi .\) Set \( H_{r}^{*}=H_{r}\backslash \{0\}. \) Then

$$\begin{aligned} N(U_{r})&=\frac{1}{q^{r}}\sum _{u_{i}\in \overline{D}}\left( \sum _{x_{1}\in \mathbb {F}_{q}}\zeta _{p}^{\mathrm {Tr}_{q/ p}(\mathrm {Tr}_{Q/ q}(\beta _{1} u_{i})x_{1})}\right) \ldots \left( \sum _{x_{r}\in \mathbb {F}_{q}}\zeta _{p}^{\mathrm {Tr}_{q/ p}(\mathrm {Tr}_{Q/ q}(\beta _{r} u_{i})x_{r})}\right) \nonumber \\&=\frac{1}{q^{r}}\sum _{\beta \in H_{r}}\sum _{u_{i}\in \overline{D}}\zeta _{p}^{\mathrm {Tr}_{Q/ p}(\beta u_{i})} =\frac{sn_{0}}{q^{r}}+\frac{1}{q^{r}}\sum _{\beta \in H_{r}^{*}}\sum _{u_{i}\in \overline{D}}\zeta _{p}^{\mathrm {Tr}_{Q/ p}(\beta u_{i})} \nonumber \\&=\frac{sn_{0}}{q^{r}}+\frac{1}{q^{r}(q-1)}\sum _{\beta \in H_{r}^{*}}\sum _{u_{i}\in \mathbb {F}^{*}_{q}\overline{D}}\zeta _{p}^{\mathrm {Tr}_{Q/ p}(\beta u_{i})}, \nonumber \end{aligned}$$

where \( \mathbb {F}^{*}_{q}\overline{D}=\{xy|x\in \mathbb {F}^{*}_{q}, \ y\in \overline{D}\}.\) So

$$\begin{aligned} N(U_{r})&=\frac{sn_{0}}{q^{r}} +\frac{1}{hq^{r}(q-1)}\sum _{j=1}^{s}\sum _{\beta \in H_{r}^{*}}\sum _{x\in \mathbb {F}_{Q}^{*}}\zeta _{p}^{\mathrm {Tr}_{Q/ p}(\beta x)}\sum _{\lambda =0}^{h-1}\varphi ^{\lambda }(\theta ^{-t_{j}}x) \nonumber \\&=\frac{s(q^{m}-q^{r})}{hq^{r}(q-1)} +\frac{1}{hq^{r}(q-1)}\sum _{j=1}^{s}\sum _{\lambda =1}^{h-1}\sum _{\beta \in H_{r}^{*}}\sum _{x\in \mathbb {F}_{Q}^{*}}\zeta _{p}^{\mathrm {Tr}_{Q/ p}(\beta x)}\varphi ^{\lambda }(\theta ^{-t_{j}}x) \nonumber \\&=\frac{s(q^{m}-q^{r})}{hq^{r}(q-1)}+\frac{1}{hq^{r}(q-1)} \sum _{j=1}^{s}\sum _{\lambda =1}^{h-1}G_{Q}(\varphi ^{\lambda })\sum _{\beta \in H_{r}^{*}} \overline{\varphi ^{\lambda }}(\theta ^{t_{j}}\beta ) \nonumber \\&=\frac{s(q^{m}-q^{r})}{hq^{r}(q-1)}+\frac{1}{hq^{r}(q-1)} \sum _{j=1}^{s}\sum _{\lambda =1}^{h-1}\overline{\varphi ^{\lambda }}(\theta ^{t_{j}})G_{Q}(\varphi ^{\lambda })\sum _{\beta \in H_{r}^{*}} \overline{\varphi ^{\lambda }}(\beta ). \nonumber \end{aligned}$$

For simplicity, we set \( A_{H_{r}} = \sum _{j=1}^{s}\sum _{\lambda =1}^{h-1}\overline{\varphi ^{\lambda }}(\theta ^{t_{j}})G_{Q}(\varphi ^{\lambda })\sum _{\beta \in H_{r}^{*}} \overline{\varphi ^{\lambda }}(\beta ). \) So

$$\begin{aligned} N(U_{r}) =\frac{s(q^{m}-q^{r})}{hq^{r}(q-1)}+\frac{A_{H_{r}}}{hq^{r}(q-1)}. \end{aligned}$$

2. By the proof of Part 1, we have

$$\begin{aligned} N(U_{r})&=\frac{sn_{0}}{q^{r}}+\frac{1}{q^{r}(q-1)}\sum _{\beta \in H_{r}^{*}}\sum _{u\in \mathbb {F}^{*}_{q}\overline{D}}\zeta _{p}^{\mathrm {Tr}_{Q/ p}(\beta u)} \nonumber \\&=\frac{sn_{0}}{q^{r}}+\frac{1}{q^{r}(q-1)}\sum _{\beta \in H_{r}^{*}}\sum _{j=1}^{s}\sum _{u\in C_{t_{j}}}\zeta _{p}^{\mathrm {Tr}_{Q/ p}(\beta u)} \nonumber \\&=\frac{sn_{0}}{q^{r}}+\frac{1}{q^{r}(q-1)}\sum _{j=1}^{s}\sum _{\beta \in H_{r}^{*}} \sum _{u\in C_{t_{j}}}\chi _{1}(\beta u). \nonumber \end{aligned}$$

By definition, \( \eta _{i}=\sum _{x\in C_{i}}\chi _{1}(x). \) So we have

$$\begin{aligned} \sum _{j=1}^{s}\sum _{\beta \in H_{r}^{*}} \sum _{u\in C_{t_{j}}}\chi _{1}(\beta u)=\sum _{i=0}^{h-1}\sum _{j=1}^{s}|H_{r}\bigcap C_{i-t_{j}}|\eta _{i} =\sum _{i=0}^{h-1}|H_{r}\bigcap \left( \bigcup _{j=1}^{s}C_{i-t_{j}}\right) |\eta _{i}. \end{aligned}$$

Then the desired result follows and the proof is completed.

Remarks

  1. (1)

    If \( s=h,\) then \( C_{\overline{D}}\) is a \([\frac{q^{m}-1}{q-1},m,q^{m-1}]\) code, the nonzero elements of which all have weights \(q^{m-1}.\) It is a simplex code. By Theorem 1 or Theorem 2(2), it is easy to get \( d_{r}(C_{\overline{D}})=\frac{q^{m}-q^{m-r}}{q-1}. \)

  2. (2)

    By the construction of \(\overline{D},\) for any two elements \(\alpha \) and \(\beta \) in \( \overline{D},\) we have \((\frac{\alpha }{\beta })^{q-1}\ne 1.\) This means that \(\frac{\alpha }{\beta }\notin \mathbb {F}^{*}_{q}.\) So \(\max \{|\overline{D} \bigcap H|: H \in [\mathbb {F}_{Q},1]_{q}\}=1. \) By Theorem 1, if \( \dim (C_{\overline{D}})=m,\) then \( d_{m-1}(C_{\overline{D}})=\frac{s(q^{m}-1)}{h(q-1)}-1. \) By the Singleton type bound in Lemma 2, \( C_{\overline{D}} \) is an \((m-1)\)-MDS code [19] over \(\mathbb {F}_q. \) Especially, if \( m=2, \) then the code \( C_{\overline{D}} \) is an \( [\frac{s(q+1)}{h},2,\frac{s(q+1)}{h}-1]\) MDS code [12] over \(\mathbb {F}_q. \)

  3. (3)

    Generally, it is difficult to establish linkage between the additive properties and the multiplicative ones of a field. So Theorems 1 and 2 indicate that it is difficult to give the explicit values of the generalized Hamming weights of \(C_{\overline{D}}\) in other cases.

Next under certain conditions, we give the weight distributions of the cyclotomic linear codes \(C_{\overline{D}}\) in the following theorem.

Theorem 3

Assume \( m=2lk \) and \( h|(q^{k}+1). \) Then the code \(C_{\overline{D}}\) is an \([\frac{s(Q-1)}{h(q-1)},m]\) linear code over \( \mathbb {F}_{q} \) with the weight distribution in Table 1. And the dual code \(C_{\overline{D}}^{\perp }\) of \(C_{\overline{D}}\) is an \([\frac{s(Q-1)}{h(q-1)}, \frac{s(Q-1)}{h(q-1)}-m, d^{\perp }]\) linear code with minimum distance \( d^{\perp }\ge 3.\)

Table 1 The weight distribution of the codes of Theorem 3

Proof

For \(x \in \mathbb {F}_{q}^{*}, \) let \(c_{x}=(\mathrm {Tr}_{Q/q}(xd))_{d\in \overline{D}}\) and \(w(c_{x})\) denote the Hamming weight of the codeword \(c_{x},\) then we have

$$\begin{aligned} w(c_{x})&=sn_{0}-\sum _{j=1}^{s}|\{i: 1\le i \le n_{0}, \mathrm {Tr}_{Q/q}(x\theta ^{t_{j}}d_{i})=0 \}| \nonumber \\&=sn_{0}-\frac{1}{q}\sum _{j=1}^{s}\sum _{i=1}^{n_{0}}\sum _{u\in \mathbb {F}_{q}}\zeta _{p}^{\mathrm {Tr}_{q/p}(u\mathrm {Tr}_{Q/q}(x\theta ^{t_{j}}d_{i}))} \nonumber \\&=\frac{s(Q-1)}{hq}-\frac{1}{q}\sum _{j=1}^{s}\sum _{i=1}^{n_{0}}\sum _{u\in \mathbb {F}_{q}^{*}}\chi _{1}(ux\theta ^{t_{j}}d_{i}) \nonumber \\&=\frac{s(Q-1)}{hq}-\frac{1}{q}\sum _{j=1}^{s}\sum _{k=1}^{\frac{Q-1}{h}}\chi _{1}(x\theta ^{t_{j}+hk}) \nonumber \\&=\frac{s(Q-1)}{hq}-\frac{1}{qh}\sum _{j=1}^{s}\sum _{k=1}^{Q-1}\chi _{1}(x\theta ^{t_{j}+hk}) \nonumber \\&=\frac{s(Q-1)}{hq}-\frac{1}{qh}\sum _{j=1}^{s}((S(x\theta ^{t_{j}})-1) \nonumber \\&=\frac{1}{qh}(s(Q-1)+s-\sum _{j=1}^{s}S(x\theta ^{t_{j}})). \nonumber \end{aligned}$$

By Lemma 1, we have

$$\begin{aligned} w(c_{x})=\left\{ \begin{array}{ll} \frac{1}{qh}(s(Q-1)+s+(-1)^{l}(h-s)\sqrt{Q}), &{} \text {if one of } \ x\theta ^{t_{j}}\in C_{h_{0}}, \\ \frac{1}{qh}(s(Q-1)+s-s(-1)^{l}\sqrt{Q}), &{} \text {otherwise}. \end{array} \right. \end{aligned}$$

As for the parameters of the dual code, it is enough to prove \( d^{\perp }\ge 3. \) It is easy to show that any two elements in \(\overline{D}\) are linearly independent over \(\mathbb {F}_{q}.\) Then the desired results follow and we complete the proof.

Example 1

Let \((q,m,l,k,h,s)=(3,4,1,2,5,3)\) and \((t_{1},t_{2},t_{3})=(1,2,3).\) Then, the corresponding code \(C_{\overline{D}}\) has parameters [24, 4, 15],  weight enumerator \(1+48x^{15}+32x^{18}\) and its dual code has parameters [24, 20, 3].

Example 2

Let \((q,m,l,k,h,s)=(5,4,2,1,6,2)\) and \((t_{1},t_{2})=(0,1).\) Then, the corresponding code \(C_{\overline{D}}\) has parameters [52, 4, 40],  weight enumerator \(1+416x^{40}+208x^{45}\) and its dual code has parameters [52, 48, 3].

Corollary 1

Assume \( m=2lk \) and \( h|(q^{k}+1). \) If \( (l,2)=1, \) then

$$\begin{aligned} d_{r}(C_{\overline{D}})=\left\{ \begin{array}{ll} \frac{s(q^{m}-q^{m-r})+(s-h)q^{\frac{m}{2}-r}(q^{r}-1)}{h(q-1)}, &{} \text {if } \ 1\le r \le \frac{m}{2}, \\ \frac{s(q^{m}-1)-h(q^{m-r}-1)}{h(q-1)}, &{} \text {if } \ \frac{m}{2}\le r \le m. \end{array} \right. \end{aligned}$$

Proof

By Lemma 1, we have \( \eta _{i}=\frac{(h-1)\sqrt{Q}-1}{h} \) if \( i=h_{0}, \) otherwise \( \eta _{i}=\frac{-\sqrt{Q}-1}{h}. \) So by Theorem 2(2), we get \( \sum _{j=1}^{s}\sum _{i=0}^{h-1}|H_{r}\bigcap C_{i-t_{j}}|\eta _{i} \)

$$\begin{aligned}&=\sum _{j=1}^{s}\sum _{i=0}^{h-1}|H_{r}\bigcap C_{i-t_{j}}|\frac{-\sqrt{Q}-1}{h}+\sum _{j=1}^{s}|H_{r}\bigcap C_{h_{0}-t_{j}}|\left( \eta _{h_{0}}-\frac{-\sqrt{Q}-1}{h}\right) \nonumber \\&=s(q^{r}-1)\frac{-\sqrt{Q}-1}{h}+\sqrt{Q}\sum _{j=1}^{s}|H_{r}\bigcap C_{h_{0}-t_{j}}|. \nonumber \end{aligned}$$

If \( (l,2)=1, \) then \(\mathbb {F}_{q^{lk}}\subset C_{0}.\) Notice that \( C_{i}=\theta ^{i}C_{0} \) and \( \theta ^{i}H_{r}\) is also an r-dimension subspace. So we have

$$\begin{aligned} \max \left\{ |H_{r}\bigcap \left( \bigcup _{j=1}^{s}C_{h_{0}-t_{j}}\right) | : H_{r} \in [\mathbb {F}_Q, r]_{q}\right\} =q^{r}-1 \end{aligned}$$

for each r with \( 1\le r \le \frac{m}{2}. \) By Theorem 2, we get the first part of the corollary. If \( \frac{m}{2}\le r \le m, \) then \( 0\le m-r \le \frac{m}{2}. \) So we know that there is an \((m-r)\)-dimensional subspace \(H_{m-r}\subset \mathbb {F}_{q^{lk}}\subset C_{0}.\) Therefore, \( \max \{|(\bigcup _{j=1}^{s}C_{t_{j}}) \bigcap H|: H \in [\mathbb {F}_{Q},m-r]_{q}\} =q^{m-r}-1. \) Note that \( \mathbb {F}^{*}_{q}\overline{D}=\bigcup _{j=1}^{s}C_{t_{j}}\) and \(\frac{\alpha }{\beta }\notin \mathbb {F}^{*}_{q}\) for any two elements \(\alpha \) and \(\beta \) in \(\overline{D}.\) So \(|(\bigcup _{j=1}^{s}C_{t_{j}}) \bigcap H|=(q-1)|H\bigcap \overline{D}|\) for any subspace H. Therefore, \( \max \{|\overline{D} \bigcap H|: H \in [\mathbb {F}_{Q},m-r]_{q}\} =\frac{q^{m-r}-1}{q-1}. \) By Theorem 1, we get the second part of this corollary. The proof is completed.

Example 3

For the code in Example 1, its weight hierarchy is \(d_{1}=15, d_{2}=20, d_{3}=23, d_{4}=24.\)

Corollary 2

Also assume \( m=2lk \) and \( h|(q^{k}+1). \) If \( l=2^{u}l'\) with \( u>0, (l',2)=1,\) and \( s<h, \) then

$$\begin{aligned} d_{r}(C_{\overline{D}})=\left\{ \begin{array}{ll} \frac{sq^{\frac{m}{2}-r}(q^{r}-1)(q^{\frac{m}{2}}-1)}{h(q-1)}, &{} \text {if } \ 1\le r \le l'k, \\ \frac{s(q^{m}-1)-h(q^{m-r}-1)}{h(q-1)}, &{} \text {if } \ m-l'k\le r \le m. \end{array} \right. \end{aligned}$$

Proof

Also by Lemma 1, we have \( \eta _{i}=-\frac{(h-1)\sqrt{Q}+1}{h} \) if \( i=h_{0}, \) otherwise \( \eta _{i}=\frac{\sqrt{Q}-1}{h}. \) For an r-dimensional subspace \(H_{r},\)

$$\begin{aligned}&\sum _{i=0}^{h-1}|H_{r}\bigcap \left( \bigcup _{j=1}^{s}C_{i-t_{j}}\right) |\eta _{i}=\sum _{j=1}^{s}\sum _{i=0}^{h-1}|H_{r}\bigcap C_{i-t_{j}}|\eta _{i} \nonumber \\&\quad =\sum _{j=1}^{s}\sum _{i=0}^{h-1}|H_{r}\bigcap C_{i-t_{j}}|\frac{\sqrt{Q}-1}{h}+\sum _{j=1}^{s}|H_{r}\bigcap C_{h_{0}-t_{j}}|\left( \eta _{h_{0}}-\frac{\sqrt{Q}-1}{h}\right) \nonumber \\&\quad =s(q^{r}-1)\frac{\sqrt{Q}-1}{h}-\sqrt{Q}\sum _{j=1}^{s}|H_{r}\bigcap C_{h_{0}-t_{j}}|. \nonumber \end{aligned}$$

By assumption, we have \(\mathbb {F}_{q^{l'k}}\subset C_{0}.\) Notice that \(\bigcup _{j=1}^{s}C_{h_{0}-t_{j}}\ne \overline{D}\) since \(s<h.\) So for each r with \( 1\le r \le l'k, \) we have

$$\begin{aligned} \min \left\{ \left| H_{r}\bigcap \left( \bigcup _{j=1}^{s}C_{h_{0}-t_{j}}\right) \right| : H_{r} \in [\mathbb {F}_Q, r]_{q}\right\} =0. \end{aligned}$$

Then the desired result of the first part follows directly from Theorem 2(2). For \( m-l'k\le r \le m, \) we know that there is an \((m-r)\)-dimensional subspace \(H_{m-r}\subset \mathbb {F}_{q^{l'k}}\subset C_{0}.\) So \( \max \{|(\bigcup _{j=1}^{s}C_{t_{j}}) \bigcap H|: H \in [\mathbb {F}_{Q},m-r]_{q}\} =q^{m-r}-1\) and \( \max \{|\overline{D} \bigcap H|: H \in [\mathbb {F}_{Q},m-r]_{q}\} =\frac{q^{m-r}-1}{q-1}. \) By Theorems 1 and 3, we get the second part of this corollary. The proof is completed.

Example 4

For the code in Example 2, its weight hierarchy is \(d_{1}=40, d_{2}=48, d_{3}=51, d_{4}=52.\)

The above four examples have been verified by Magma.

4 Concluding remarks

In this paper, we gave a formula for computing the generalized Hamming weights of linear code \(C_{D}, \) which is constructed by the generic method proposed by Ding et al. By choosing properly the defining set, we presented a class of cyclotomic linear codes \( C_{\overline{D}}. \) We gave two alternative formulas about their generalized Hamming weights in terms of Gauss sums and Gaussian periods. Under certain conditions, we solved the weight distribution of \( C_{\overline{D}} \) and proved that it is a two-weight linear code. We determined completely the generalized Hamming weights of \( C_{\overline{D}} \) in one case.