function dist = point_to_dist_table ( dim_num, point_num, point )

%*****************************************************************************80
%
%% POINT_TO_DIST_TABLE creates a distance matrix from a list of Cartesian coordinates.
%
%  Discussion:
%
%    The euclidean distance is used.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    15 September 2009
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer DIM_NUM, the spatial dimension.
%
%    Input, integer POINT_NUM, the number of points.
%
%    Input, real POINT(DIM_NUM,POINT_NUM), the  point coordinates.
%
%    Output, real DIST(POINT_NUM,POINT_NUM), the distance matrix.
%
  for i = 1 : point_num
    dist(i,i) = 0.0;
    for j = i + 1 : point_num
      dist(i,j) = 0.0;
      for dim = 1 : dim_num
        dist(i,j) = dist(i,j) + ( point(dim,i) - point(dim,j) )^2;
      end
      dist(i,j) = sqrt ( dist(i,j) );
      dist(j,i) = dist(i,j);
    end
  end

  return
end
