function [ab,Mcap,kount]=r_cBspline_dis(N,m)
%R_CBSPLINE_DIS Recurrence coefficients for the B-spline weight function.
%   AB=R_CBSPLINE_DIS(N,M) uses a multicomponent discretization
%   procedure to generate the first N recurrence coefficients for 
%   the Mth-order B-spline weight function PHI_M. The latter
%   is computed recursively in terms of lower-order B-splines.

global mc mp iq idelta irout xw_cBspline
Nm=N+ceil(m/2)-1;
xw_cBspline=zeros(Nm,2,m);
ab=r_jacobi01(Nm);
xw=gauss(Nm,ab);
for k=1:Nm
  y=cBspline(xw(k,1),m);
  for i=1:m
    xw_cBspline(k,1,i)=xw(k,1)+i-1; 
    xw_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 mcdis, which is known to
% produce an exact result.
%
eps0=1;
[abm,Mcap,kount]=mcdis(N+ceil(m/2)-1,eps0,@quad_cBspline,Mmax);
ab=abm(1:N,:);
ab(:,1)=(m/2)*ones(N,1);
