function p = polynomial_value ( m, o, c, e, n, 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 M, 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 N, the number of evaluation points.
%
%    real X(M,N), the coordinates of the evaluation points.
%
%  Output:
%
%    real P(N), the value of the polynomial at X.
%  
  p = zeros ( n, 1 );

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

  return
end

