function [ xy, w ] = quad_2d_compute ( m, n )

%*****************************************************************************80
%
%% QUAD_2D_COMPUTE computes a 2D product quadrature rule.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    24 February 2013
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer M, N, the orders of the rules for X and Y.
%
%    Output, real XY(2,M*N), W(M*N), the points and weights.

%
%  Compute the Legendre rule for X and Y, adjusting from [-1,+1] to [0,1].
%
  [ x, u ] = legendre_ek_compute ( m );
  [ x, u ] = rule_adjust ( -1, +1, 0, 1, m, x, u );

  [ y, v ] = legendre_ek_compute ( n );
  [ y, v ] = rule_adjust ( -1, +1, 0, 1, n, y, v );
%
%  Compute the weights and points of the product rule.
%
  w = zeros ( m * n, 1 );
  xy = zeros ( 2, m * n );
  k = 0;
  for j = 1 : n
    for i = 1 : m
      k = k + 1;
      w(k) = u(i) * v(j);
      xy(1:2,k) = [ x(i); y(j) ];
    end
  end

  return
end


