Diagonalization functional!