function yv = dif_vals ( nd, xd, yd, nv, xv )

%*****************************************************************************80
%
%% dif_vals() evaluates a divided difference polynomial at a set of points.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    23 May 2011
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Carl deBoor,
%    A Practical Guide to Splines,
%    Springer, 2001,
%    ISBN: 0387953663,
%    LC: QA1.A647.v27.
%
%  Input:
%
%    integer ND, the order of the difference table.
%
%    real XD(ND), the X values of the difference table.
%
%    real YD(ND), the divided differences.
%
%    integer NV, the number of evaluation points.
%
%    real XV(NV), the evaluation points.
%
%  Output:
%
%    real YV(NV), the value of the divided difference
%    polynomial at the evaluation points.
%

%
%  Deal with the blasted curse of row vectors.
%
  yd = yd ( : );
  xd = xd ( : );
  xv = xv ( : );

  yv = zeros ( nv, 1 );

  yv(1:nv) = yd(nd);

  for i = 1 : nd - 1
    yv(1:nv) = yd(nd-i) + ( xv(1:nv) - xd(nd-i) ) .* yv(1:nv);
  end

  return
end
