function hermite_product_polynomial_test03 ( )

%*****************************************************************************80
%
%% hermite_product_polynomial_test03() tests hepp_value().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 October 2014
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'hermite_product_polynomial_test03():\n' );
  fprintf ( 1, '  hepp_value() evaluates a Hermite product polynomial.\n' );
  fprintf ( 1, '  polynomial_value() evaluates a polynomial.\n' );

  m = 3;
  n = 1;
  x = -1.0 + 2.0 * rand ( m, 1 );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Evaluate at X = ( %g, %g, %g )\n', x(1:3) )
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Rank  I1  I2  I3:  He(I1,X1)*He(I2,X2)*He(I3,X3)  P(X1,X2,X3)\n' );
  fprintf ( 1, '\n' );

  for rank = 1 : 20

    l = comp_unrank_grlex ( m, rank );
%
%  Evaluate the HePP directly.
%
    v1 = hepp_value ( m, n, l, x );
%
%  Convert the HePP to a polynomial, and reevaluate.
%
    o_max = prod ( floor ( ( l(1:m) + 2 ) / 2 ) );

    [ o, c, e ] = hepp_to_polynomial ( m, l, o_max );

    v2 = polynomial_value ( m, o, c, e, n, x );
%
%  Compare results.
%
    fprintf ( 1, '  %4d  %2d  %2d  %2d  %12g  %12g\n', rank, l(1:m), v1, v2 );

  end

  return
end
