function yi = newton_value_1d ( nd, xd, cd, ni, xi )

%*****************************************************************************80
%
%% NEWTON_VALUE_1D evaluates a Newton 1D interpolant.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    04 July 2015
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Carl deBoor,
%    A Practical Guide to Splines,
%    Springer, 2001,
%    ISBN: 0387953663,
%    LC: QA1.A647.v27.
%
%  Parameters:
%
%    Input, integer ND, the order of the difference table.
%
%    Input, real XD(ND), the X values of the difference table.
%
%    Input, real CD(ND), the divided differences.
%
%    Input, integer NI, the number of interpolation points.
%
%    Input, real XI(NI), the interpolation points.
%
%    Output, real YI(NI), the interpolation values.
%

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

  yi = zeros ( ni, 1 );

  yi(1:ni) = cd(nd);

  for i = 1 : nd - 1
    yi(1:ni) = cd(nd-i) + ( xi(1:ni) - xd(nd-i) ) .* yi(1:ni);
  end

  return
end
