Solution (source code)

= Solution

By <spectral decomposition>, the <Von Neumann entropy> is the <Shannon entropy> of the <eigenvalues>:
$$
\boxed{S(\rho_Q)=-\operatorname{Tr}(\rho_Q\log_2\rho_Q)=-\sum_{i=0}^{d-1}\lambda_i\log_2\lambda_i.}
$$
Throughout, logarithms have base two, so the <Von Neumann entropy> and <Shannon entropy> are measured in bits. The continuous convention $0\log_2 0=0$ includes zero <eigenvalues>.