I am currently reading Quantum Chromodynamics on the Lattice by C. Gattringer C.B. Lang and I am confused about an expression in the book.

The expression is

$$\langle \text{tr}[S(\textbf{m}, \textbf{n}, n_t)S(\textbf{m}, \textbf{n}, 0)^{\dagger}]\rangle_{temp} =\sum_k \langle0| \hat S(\textbf{m}, \textbf{n})_{ab}|k \rangle\langle k|\hat S(\textbf{m}, \textbf{n})^\dagger_{ba}|0\rangle e^{-tE_k}.$$

For context, the left-hand side is the expression for a Wilson loop (in the temporal gauge) in the classical theory. The $$\langle ... \rangle$$ on the LHS denotes the expectation of the classical object by placing it in the path integral, which is written in terms of classical objects. The RHS is written in the canonical quantization formalism where the originally classical variables are promoted to linear operators on the Hilbert space of states.

My question comes from the adjoint notation. On the LHS the adjoint specifically means wrt the matrix indices on $$S$$, whilst on the RHS it is not clear whether it is the adjoint in the sense of the Hilbert space sense (since $$\hat S$$ is an operator), if it refers to the matrix indices or both.

My guess, although I am not totally sure, is that in canonical quantization formalism the complex conjugation of the classical variable is translated to the adjoint of the operator variable in the quantum theory. $$A^* \rightarrow \hat A^\dagger$$.

So $$S^\dagger= S^{* T}$$ goes to $$(\hat{S}^\dagger_{ab})^T = \hat{S}^\dagger_{ba}$$ and the transpose acts on the matrix indices.

The notation is slightly unclear, because the meaning depends on whether the $$\dagger$$ is applied before or after the indices are applied. The meaning can be clarified by adding parentheses: $$\langle \text{tr}[S(\textbf{m}, \textbf{n}, n_t)S(\textbf{m}, \textbf{n}, 0)^{\dagger}]\rangle_{temp} =\sum_k \langle0| \hat S(\textbf{m}, \textbf{n})_{ab}|k \rangle\big\langle k\big|\big(\hat S(\textbf{m}, \textbf{n})_{ba}\big)^\dagger\big|0\big\rangle e^{-tE_k}.$$ In words: on the RHS, the $$\dagger$$ is taking the operator adjoint of a single component of the matrix-of-operators, namely the component $$\hat S(\mathbf{m},\mathbf{n})_{ba}$$.
The $$\dagger$$ on the LHS includes a matrix transpose, which is already explicit in the indices on the RHS, so the $$\dagger$$ on the RHS should only affect the individual component without transposing the matrix indices.