I am studying an operator $A$ that acts as a multiplication by a matrix $A(k)$ and am trying to find a relation between the trace of the operator $A$ and the trace of the matrix $A(k)$. However, something in my calculation seems to be wrong, but I can not find the mistake:
Suppose $A$ is a linear operator on $L^2(\mathbb{T}^d; \mathbb{C}^s)$, that acts as a multiplication by a matrix $A(k) \in \mathbb{C}^{s \times s}$, i.e. \begin{align*} (A \psi)(k) = A(k) \psi(k). \end{align*} Note that I define the $d$-torus to be $\mathbb{T}^d = \underbrace{\mathbb{S}^1 \times ... \times \mathbb{S}^1}_{d-\text{times}}$.
An orthonormal basis of $L^2(\mathbb{T}^d; \mathbb{C}^s)$ is given by $e_{n,j}(k) = \frac{1}{\sqrt{2 \pi}^d} \, e^{i n \cdot k} \, e_j$ for $n \in \mathbb{Z}^d, j \in \{1,...,s\}$, where $e_j$ denotes the $j^{\text{th}}$ unit vector. In other words, $e_{n,j}(k)$ is a vector, where the $j^{\text{th}}$ component is $\frac{1}{\sqrt{2 \pi}^d} \, e^{i n \cdot k}$ and all other components are $0$. Now I can compute the trace of $A$ by \begin{align*} \text{tr}(A) &= \sum_{n,j} \langle e_{n,j} \, | \, A \, e_{n,j} \rangle_{L^2} = \sum_{n,j} \, \int_{\mathbb{T}^d} \langle e_{n,j}(k) \, | \, (A \, e_{n,j})(k) \rangle_{\mathbb{C}^s} \, dk \\ &= \sum_{n,j} \, \int_{\mathbb{T}^d} \langle e_{n,j}(k) \, | \, A(k) \, e_{n,j}(k) \rangle_{\mathbb{C}^s} \, dk \\ &= \sum_{n,j} \, \int_{\mathbb{T}^d} \frac{1}{(2 \pi)^d} \, A_{j,j}(k) \, dk = \frac{1}{(2 \pi)^d} \, \sum_n \, \int_{\mathbb{T}^d} \text{Tr}(A(k)) \, dk \end{align*} Thus, we'd have $\text{tr}(A) = 0$ if and only if $\int_{\mathbb{T}^d} \text{Tr}(A(k)) \, dk = 0$ and otherwise the trace does not exist.
However, by taking for example $A(k)$ unitary but with a zero diagonal, I can force this integral to be zero. Then $A$ would be trace class and therefore compact. However, I should be able to choose $A(k)$ in a way that the spectrum of $A$ is the entire unit sphere (I have examples for this, so unless I made a mistake there this should be correct). This would now be a contradiction to $A$ being compact (since the only accumulation point in the spectrum of a compact operator can be $0$).
So somewhere above I must have made a mistake. Can anyone help me find it?
Firstly it must be shown that $A$ is actually a well defined operator on $L^2$ and this will certainly impose some restrictions on the matrix valued function $k \mapsto A(k)$. You also need to show that it is bounded to make any trace class arguments.
Secondly you want to use the statement: "$T$ trace class $\Rightarrow T$ compact" to show that $A$ is compact, but you have not shown that $A$ is trace class since by definition a bounded operator $A$ is trace class if $\mathrm{tr} \sqrt{ A^* A }< \infty$.
Otherwise you have to show first that $A$ is continous, non-negative and self-adjoint which of course places further restrictions on $A$ (and certainly disables your unitary operator).