function hamming84_r_test ( )

%*****************************************************************************80
%
%% hamming84_r_test() tests hamming84_r().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 July 2018
%
%  Author:
%
%    John Burkardt
%
  r = 3;
  n = 2^r;
  k = 2^r - r - 1;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'hamming84_r_test():\n' );
  fprintf ( 1, '  hamming84_r() returns the Hamming R84 matrix.\n' );
  fprintf ( 1, '  Multiplying a codeword by R84 gives the original message.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Exponent R = %d\n', r );
  fprintf ( 1, '  Block length N = 2^R = %d\n', n );
  fprintf ( 1, '  Message length K = 2^R - R - 1 = %d.\n', k );

  g84 = hamming84_g ( );
  r84 = hamming84_r ( );

  fprintf ( 1, '\n' );
  fprintf ( 1, '   I   Message       Codeword              Message\n' );
  fprintf ( 1, '\n' );

  i_max = 2^k - 1;

  for i = 0 : i_max
    x = ui4_to_ubvec ( i, k );
    y = g84 * x;
    y = mod ( y, 2 );
    z = r84 * y;
    fprintf ( 1, '  %2d: (%d %d %d %d) --> (%d %d %d %d %d %d %d %d) --> (%d %d %d %d)\n', ...
      i, x(1:k), y(1:n), z(1:k) )
  end

  return
end

