Let y' be the set of n x n hermitian matrices, the set of n x n symmetric matrices, the set of all effects, or the set of all projections of rank one. Let c be a real number. We characterize bijective maps phi : y' -> y' satisfying tr (AB) = c double left right arrow tr (phi(A)phi(B)) = c with some additional restrictions on c, depending on the underlying set of matrices.