Rational Krylov algorithms for nonsymmetric eigenvalue problems. II. matrix pairs