function walker_build_test ( )

%*****************************************************************************80
%
%% WALKER_BUILD_TEST tests WALKER_BUILD.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    21 February 2016
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'WALKER_BUILD_TEST\n' );
  fprintf ( 1, '  WALKER_BUILD builds the Walker sampler data vectors Y\n' );
  fprintf ( 1, '  and A, given a probability vector X.\n' );

  n = 5;
  x = zeros ( n + 2, 1 );

  for i = 1 : n
    x(i+1) = ( i4_choose ( n - 1, i - 1 ) ) / ( 2 ^ ( n - 1 ) );
  end

  r8vec_print ( n + 2, x, '  Binomial PDF (ignore first and last entries):' );

  [ y, a ] = walker_build ( n, x );

  fprintf ( 1, '\n' );
  fprintf ( 1, '   I    A[I]    Y[i] (ignore first and last entries)\n' );
  fprintf ( 1, '\n' );
  for i = 0 : n + 1
    fprintf ( 1, '  %2d  %2d  %14.6g\n', i, a(i+1), y(i+1) );
  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'WALKER_BUILD_TEST\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end

