function chain_init_print ( chain_num, fit, gen_num, par_num, ...
  restart_read_filename, z )

%*****************************************************************************80
%
%% CHAIN_INIT_PRINT prints the initial values for Markov chains.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    22 January 2018
%
%  Author:
%
%    John Burkardt
%
%  Input parameters:
%
%    Input, integer CHAIN_NUM, the total number of chains.
%    3 <= CHAIN_NUM.
%
%    Input, real FIT(CHAIN_NUM,GEN_NUM), the likelihood of
%    each sample.
%
%    Input, integer GEN_NUM, the total number of generations.
%    2 <= GEN_NUM.
%
%    Input, integer PAR_NUM, the total number of parameters.
%    1 <= PAR_NUM.
%
%    Input, string RESTART_READ_FILENAME, the name of the file
%    containing restart information, or '' if this is not a restart run.
%
%    Input, real Z(PAR_NUM,CHAIN_NUM,GEN_NUM), the Markov chain 
%    sample data.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'CHAIN_INIT_PRINT\n' );
  fprintf ( 1, '  Display initial values of Markov chains.\n' );

  if ( 0 < length ( restart_read_filename ) )
    fprintf ( 1, '  Initialization from restart file "%s"\n', ...
      restart_read_filename );
  else
    fprintf ( 1, '  Initialization by sampling prior density.\n' );
  end

  for j = 1 : chain_num
    fprintf ( 1, '\n' );
    fprintf ( 1, '  Chain %d\n', j );
    fprintf ( 1, '  Fitness %g\n', fit(j,1) );
    for i = 1 : par_num
      fprintf ( 1, '  %14.6g', z(i,j,1) );
      if ( mod ( i, 5 ) == 0 || i == par_num )
        fprintf ( 1, '\n' );
      end
    end
  end

  return
end
