function yi = interpolant_value ( d, r, pn, po, pc, pe, pd, ni, xi )

%*****************************************************************************80
%
%% interpolant_value() evaluates a Lagrange interpolant.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    29 January 2014
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer D, the spatial dimension.
%
%    integer R, the maximum number of terms in any polynomial.
%
%    integer PN, the number of polynomials.
%
%    integer PO(PN), the "order" of the polynomials.
%
%    real PC(PN,R), the coefficients of the polynomial.
%
%    integer PE(PN,R), the indices of the exponents of the polynomial.
%
%    real PD(PN), the coefficient of each polynomial.  
%    For a Lagrange interpolant, this is the data value at each Lagrange point.
%
%    integer NI, the number of interpolant evaluation points.
%
%    real XI(D,NI), the coordinates of the interpolation evaluation points.
%
%  Output:
%
%    real YI(NI), the value of the interpolant at XI.
%  
  yi = zeros ( ni, 1 );

  for j = 1 : pn
    oj = po(j);
    value(1:ni,1) = polynomial_value ( d, oj, pc(j,1:oj), pe(j,1:oj), ni, xi ); 
    yi(1:ni,1) = yi(1:ni,1) + pd(j,1) * value(1:ni,1);
  end    

  return
end
