% GCHRI2  Alternative modification by a quadratic divisor.

%    Given a weight function w(t) through the first numax recurrence
%    coefficients ab0 of its orthogonal polynomials, [ab,rho,nu]=
%    GCHRI2(n,ab0,x,y,eps0,nu0,numax) uses the modified Chebyshev
%    algorithm to generate to a relative accuracy eps0 the first n
%    recurrence coefficients of the orthogonal polynomials
%    relative to the modified weight function w(t)/((t-x)^2+y^2). 
%    The required modified moments are generated by a continued
%    fraction algorithm, which involves backward recursion from
%    nu down to 0. The starting index nu is increased by 5 until
%    convergence of the continued fraction algorithm is obtained. 
%    The initial value of nu to be used is nu0, and nu is not
%    allowed to exceed numax. The output variable nu is either
%    numax, if there is no convergence, or the final value of
%    nu achieving convergence. The alpha- and beta-coefficients 
%    of the given weight function are to be provided in the first 
%    and second column of the numax x 2 input array ab0; those 
%    of the modified weight function are returned in the first and
%    second column of the nx2 output array ab. The Cauchy 
%    integrals, which except for the sign are the modified
%    moments, are stored in the output array rho.
%
function [ab,rho,nu]=gchri2(N,ab0,x,y,eps0,nu0,numax)
if N<1, error('N out of range'), end
N0=size(ab0,1); if N0<numax, error('input array ab0 too short'), end
y=abs(y); z=x+y*i;
[rho,r,nu]=cauchy(2*N-1,ab0,z,eps0,nu0,numax);
mom=-imag(rho)'/y;
[ab,s]=chebyshev(N,mom,ab0);
