function [ nodes, weights ] = kron_prod ( n1D, w1D )

%*****************************************************************************80
%
%% kron_prod() generates a tensor product quadrature rule.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 May 2010
%
%  Author:
%
%    Original MATLAB version by Florian Heiss, Viktor Winschel.
%    This version by John Burkardt.
%
%  Reference:
%
%    Florian Heiss, Viktor Winschel,
%    Likelihood approximation by numerical integration on sparse grids,
%    Journal of Econometrics,
%    Volume 144, 2008, pages 62-80.
%
%  Input:
%
%    cell array n1D{}, the 1D nodes.
%
%    cell array w1D{}, the 1D weights.
%
%  Output:
%
%    real nodes(?,?), the tensor product nodes.
%
%    real weights(?), the tensor product weights.
%
  nodes = n1D{1};
  weights = w1D{1};

  for j = 2 : length(n1D)
    newnodes = n1D{j};
    nodes = [ kron(nodes,ones(size(newnodes,1),1)) ...
              kron(ones(size(nodes,1),1),newnodes) ];
    weights = kron ( weights, w1D{j} );
  end

  return
end
