Spectral factorization of the Krylov matrix and convergence of GMRES