
function BSUV=bspuvP(P)
%calculation of samples  of B-splines of multiple orders P at integer and semi-integer points
lp=length(P);mp=max(P);
BSUV=cell(mp,2);
for kk=1:lp
    p=P(kk);
    yy=cell(1,2);
    [y,l]=bspint_ih(p,0);
    yy{1}=y;yy{2}=l;
    BSUV{p,1}=yy;
    yy=cell(1,2);
    [y,l]=bspint_ih(p,1);
    yy{1}=y;yy{2}=l;
    BSUV{p,2}=yy;
end
save BSUV BSUV
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [y,l1]=bspint_ih(p,uv)
%B-spline of the order p at the grid with the step h 
%p=4
l=factorial(p-1);%*2^(p-1);
l1=l;

a=[1 -1];b=a;

s=1:p;
%pp=p+uv;
ss=(rem(p,2)+((-1)^p)*uv);
%if round(p/2)~=p/2

%
s=s-ss/2;l1=l*(1-ss)+ss*l*2^(p-1);
%
%end
c=ones(1,p);
for kk=1:p-1
b=conv(a,b);
c=c.*s;
end
zz=conv(c,b);
%z=zz/l1;
y=zeros(1,p);
%y=z(1:p);
y=zz(1:p)*l1/l;