function values = horner ( pn, X )

% returns the values at X  of the polynomial whose Newton form is in pn.
%
%  Reference:
%
%    Samuel Conte, Carl de Boor,
%    Elementary Numerical Analysis,
%    Third Edition,
%    SIAM, 2017,
%    ISBN: 978-1-611975-19-2.
%
   NP1 = length ( pn.coefs ); 
   values = repmat ( pn.coefs(1), size(X) );

   for i = 2 : NP1
     values = pn.coefs(i) + ( X - pn.sites(i) ) .* values;
   end

  return
end

