function cluster_center = cluster_initialize_5 ( dim_num, point_num, ...
  cluster_num, point )

%*****************************************************************************80
%
%% cluster_initialize_5() initializes the cluster centers to random values.
%
%  Discussion:
%
%    In this case, each cluster center is a random convex combination 
%    of the data points.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    19 January 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer DIM_NUM, the number of spatial dimensions.
%
%    integer POINT_NUM, the number of points.
%
%    integer CLUSTER_NUM, the number of clusters.
%
%    real POINT(POINT_NUM,DIM_NUM), the coordinates of the points.
%
%  Output:
%
%    real CLUSTER_CENTER(CLUSTER_NUM,DIM_NUM),
%    the coordinates of the cluster centers.
%

%
%  Get a CxP block of random factors.
%
  factor = rand ( cluster_num, point_num );
%
%  Make each column of factors have unit sum.
%
  for j = 1 : cluster_num
    column_sum = sum ( factor(j,1:point_num) );
    factor(j,1:point_num) = factor(j,1:point_num) / column_sum;
  end
%
%  Set centers = factors * points.
%
  cluster_center(1:cluster_num,1:dim_num) = ...
    factor(1:cluster_num,1:point_num) * point(1:point_num,1:dim_num);

  return
end
