# Use set notation to define vector or matrix?

I'm looking for a concise way to define the following (horizontal) vector:

$$\mathbf{x} = [x_{-k}, \dots ,x_{k}]$$

where $x_k = \mathrm{i}$ if $k$ is odd and zero otherwise, and $|k| \le K$.

So far I though I thought something like

$$\mathbf{x} = \{x_k = \mathrm{i}\, (k\bmod 2) : k \in \mathbb{Z} \land |k| \le K\}$$

but is it correct to use set notation this way? Is there a better notation?

Also, if I want to define a $2K+1 \times 2K+1$ diagonal matrix, $\mathbf{X}$, where $X_{k,k} = e^{\mathrm{i} k \theta}$ could I write

$$\mathbf{X} = \{ X_{k,k} = e^{\mathrm{i} k \theta} : k \in \mathbb{Z} \land |k| \le K\}$$

-

$x_k= (k-2[k/2])i$ for all $k\in \Bbb Z$ with $|k|\le K$.