function simplex_gm_rule_test08 ( )

%*****************************************************************************80
%
%% simplex_gm_rule_test08() tests gm_general_rule_set().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    09 July 2007
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'simplex_gm_rule_test08():\n' );
  fprintf ( 1, '  gm_general_rule_set() determines the weights and abscissas\n' );
  fprintf ( 1, '  of a Grundmann-Moeller quadrature rule for\n' );
  fprintf ( 1, '  the M dimensional general simplex,\n' );
  fprintf ( 1, '  using a rule of index RULE,\n' );
  fprintf ( 1, '  which will have degree of exactness 2*RULE+1.\n' );

  t = [ ...
    1.0, 0.0, 0.0; ...
    2.0, 0.0, 0.0; ...
    1.0, 2.0, 0.0; ...
    1.0, 0.0, 3.0 ]';

  m = 3;
  rule = 2;

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Here we use M = %d\n', m );
  fprintf ( 1, '  RULE = %d\n', rule );
  fprintf ( 1, '  DEGREE = %d\n', 2 * rule + 1 );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Simplex vertices:\n' );
  fprintf ( 1, '\n' );
  for j = 1 : 4
    for i = 1 : 3
      fprintf ( 1, '%14.6g', t(i,j) );
    end
    fprintf ( 1, '\n' );
  end

  n = gm_rule_size ( rule, m );

  [ w, x ] = gm_general_rule_set ( rule, m, n, t );

  fprintf ( 1, '\n' );
  fprintf ( 1, '     POINT        W             X             Y             Z\n' );
  fprintf ( 1, '\n' );

  for point = 1 : n
    fprintf ( 1, '  %8d  %12f', point, w(point) );
    for dim = 1 : m
      fprintf ( 1, '  %12f', x(dim,point) );
    end
    fprintf ( 1, '\n' );
  end

  return
end
