function ptsperpart = bssdefaultpointsperpartition(ndim)
% BSSDEFAULTPOINTSPERPARTITION return the number of evaluation points per
%    partition to generate the interpolation grid for a B-Spline series.
%
% INPUTS:
%
%    ndim:
%       The dimension of the data. Only four dimensions are recognized: 1,
%       2, 3, and 4 or more.
%
% OUTPUTS:
%
%    ptsperpart:
%       The number of points per partition to use to use when evaluating
%       tha B-Spline series to generate a grid for interpolation. This is a
%       scalar value that is used for each dimension in the partition, but
%       the partition in each dimension may have different sizes.
%

%
% Copyright 2014-2023 Biometrics Northwest LLC
%

%
% Modified: 2023-05-06
% Author : Kevin R. Gehringer
%
%    Changed the name of the function, removed arguments except for NDIM,
%    deleted unnecessary code. This function now simply provides the
%    default values for the number of grid points per partition.
%
% Modified: 2023-03-06
% Author : Kevin R. Gehringer
%
%    Changed the default values for points per partition, making them
%    smaller for faster evaluation. This had minimal impact on the
%    estimation errors.
%
% Created: 2016-04-24
% Author : Kevin R. Gehringer
%

npts_default = [5 3.25 2.5 2.125];

if ( exist ('ndim','var') )
    if ( ~isnumeric(ndim) )
        error('The number of dimensions was not numeric.');
    end
    ndim = floor(ndim);
    if (ndim < 1 )
        error('The number of dimensions must be at least 1.');
    end
end

if ( ndim <= 3)
    ptsperpart = npts_default(ndim);
else
    ptsperpart = npts_default(4);
end

end