function value = factor_value ( r, x )

%*****************************************************************************80
%
%% factor_value evaluates a polynomial in factor form.
%
%  Input:
%
%    real r(d): the roots of the polynomial.
%
%    real x: the evaluation point.
%
%  Output:
%
%    real value: the value of the polynomial at X.
%
  d = length ( r );
  value = ones ( shape ( x ) );
  for i = 1 : d
    value = value .* ( x - r(i) );
  end
  return
end
