function ab=sr_cBspline(dig,nofdig,N)
%SR_CBSPLINE_DIS Recurrence coefficients for a B-spline weight function.
%   AB=SR_CBSPLINE_DIS(DIG,NOFDIG,N,M) uses a multicomponent
%   discretization procedure to compute in DIG-digit arithmetic the
%   first N recurrence coefficients for the Mth-order B-spline weight
%   function on [0,M] and places them to NOFDIG digits into the Nx2
%   array AB. In the script calling this routine, the variable "dig"
%   must be assigned and declared global.

global m mc mp iq idelta irout sxw_cBspline 
digits(dig);
Nm=N+ceil(m/2)-1;
sxw_cBspline=vpa(zeros(Nm,2,m));
ab=sr_jacobi01(dig,Nm);
xw=sgauss(dig,Nm,ab);
for k=1:Nm
  y=scBspline(dig,xw(k,1),m);
  for i=1:m
    sxw_cBspline(k,1,i)=xw(k,1)+vpa(i-1);
    sxw_cBspline(k,2,i)=xw(k,2)*y(i);
  end
end
mc=m; mp=0; iq=1; idelta=2; irout=1; Mmax=1000;
%
% The choice eps0=1 made here is designed to force one iteration 
% only to be executed in the routine smcdis, which is known to
% produce an exact result.
%
eps0=1;
[abm,Mcap,kount]=smcdis(dig,N+ceil(m/2)-1,eps0,@quad_scBspline,Mmax);
ab=abm(1:N,:);
ab(:,1)=vpa((m/2)*ones(N,1));
ab=vpa(ab,nofdig);
