Simultaneous diagonalization of matrices parametrized by a projective algebraic curve