function w = bssinnerprod( m )
%BSSINNERPROD Compute the inner product weights for an mth order normalized, uniform B-Spline.

%
% INPUTS:
%
%         m:
%            The bspline order. m >= 1.
%
% OUTPUTS:
%
%         w: 
%            The inner product weights for the overlapping intervals of an
%            mth order normalized B-spline over its canonical knots 0, 1,
%            2, ..., m.
%
%

%
% Copyright 2014-2018 Biometrics Northwest LLC
%

%
% Created: 2016-09-29
% Author : Kevin R. Gehringer
%

if ( m == 1)
    w = 1;
else
    np = 100;
    w = zeros(m,1);
    x = linspace(0,m,m*np+1)';
    y = B-spline(x,m);
    for i = 1:m
        if (i == 1)
            w(i) = trapz(x,y.*y);
        else
            w(i) = trapz(x,y.*[zeros((i-1)*np,1);y(1:end-(i-1)*np)]);
        end
    end
end