Functionally commutative matrices and matrices with constant eigenvectors