function [ x, w, r ] = product_rule_set ( point_num_1d, x_1d, ... w_1d, r_1d, dim_num, point_num ) %% PRODUCT_RULE_SET sets up a product rule. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 12 May 2007 % % Author: % % John Burkardt % % Parameters: % % Input, integer POINT_NUM_1D, the order of the 1D rule. % % Input, real X_1D(POINT_NUM_1D), the points of the 1D rule. % % Input, real W_1D(POINT_NUM_1D), the weights of the 1D rule. % % Input, real R_1D(2), the extreme points that define % the range of the 1D region. % % Input, integer DIM_NUM, the spatial dimension. % % Input, integer POINT_NUM, the number of points in the product rule. % % Output, real X(DIM_NUM,POINT_NUM), the points of the % product rule. % % Output, real W(POINT_NUM), the weights of the % product rule. % % Output, real R(DIM_NUM,2), the extreme points % that define the range of the product rule region. % x = zeros ( dim_num, point_num ); w = zeros ( 1, point_num ); r = zeros ( dim_num, 2 ); k = 0; indx = []; while ( 1 ) [ k, indx ] = tuple_next ( 1, point_num_1d, dim_num, k, indx ); if ( k == 0 ) break end w(k) = prod ( w_1d(indx(1:dim_num)) ); x(1:dim_num,k) = x_1d(indx(1:dim_num)); end r(1:dim_num,1) = r_1d(1); r(1:dim_num,2) = r_1d(2);