Display the von Neumann entropy

Generally, the von Neumann entropy of a density matrix $ \rho$ is defined by

$\displaystyle S_{vN}(\rho)=-\mathrm{Tr}\rho\log_2\rho.$ (14)

We use the binary logarithm (base 2) in this software. It is also written by using the eigenvalues $ \{\lambda_i\}$ of $ \rho$ as

$\displaystyle S_{vN}(\rho)=-\sum_i\lambda_i\log_2\lambda_i.$ (15)

This is because a density matrix $ \rho$ can be diagonalized by a proper unitary transformation. Such a transformation preserves eigenvalues of $ \rho$. A density matrix $ \rho$ is an Hermitian matrix and its eigenvalues are non-negative real numbers.

The command

shows the von Neumann entropy of the current density matrix.

The command

SvNRDO(bit labels);
shows the von Neumann entropy of the reduced density operator of the qubits specified by bit labels.