function p = polynomial_value ( d, o, c, e, nx, x )

%*****************************************************************************80
%
%% polynomial_value() evaluates a polynomial.
%
%  Discussion:
%
%    The polynomial is evaluated term by term, and no attempt is made to
%    use an approach such as Horner's method to speed up the process.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 December 2013
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer D, the spatial dimension.
%
%    integer O, the "order" of the polynomial.
%
%    real C(O), the coefficients of the polynomial.
%
%    integer E(O), the indices of the exponents of the polynomial.
%
%    integer NX, the number of evaluation points.
%
%    real X(D,NX), the coordinates of the evaluation points.
%
%  Output:
%
%    real P(NX), the value of the polynomial at X.
%  
  p = zeros ( nx, 1 );

  for j = 1 : o
    f = mono_unrank_grlex ( d, e(j) );
    v = mono_value ( d, nx, f, x );
    p(1:nx) = p(1:nx) + c(j) * v(1:nx);
  end

  return
end

