function hamming74_h_test ( )

%*****************************************************************************80
%
%% HAMMING74_H_TEST tests HAMMING74_H.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    03 July 2018
%
%  Author:
%
%    John Burkardt
%
  r = 3;
  n = 2^r - 1;
  k = 2^r - r - 1;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'HAMMING74_H_TEST:\n' );
  fprintf ( 1, '  HAMMING74_H returns the Hamming H74 parity-check matrix.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Exponent R = %d\n', r );
  fprintf ( 1, '  Block length N = 2^R-1 = %d\n', n );
  fprintf ( 1, '  Message length K = 2^R - R - 1 = %d.\n', k );

  h74 = hamming74_h ( );
  g74 = hamming74_g ( );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Test #1: mod ( H * G, 2 ) = 0?\n' );
  fprintf ( 1, '\n' );

  hg = h74 * g74;
  hg = mod ( hg, 2 );

  fprintf ( 1, '  || mod ( H * G, 2 ) || = %g\n', norm ( hg, 'fro' ) );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Test #2: Only codewords with 0 parity are Messages\n' );
  fprintf ( 1, '\n' );

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

  i_max = 2^n - 1;

  for i = 0 : i_max
    y = ui4_to_ubvec ( i, n );
    p = h74 * y;
    p = mod ( p, 2 );
    fprintf ( 1, '  %3d: (%d %d %d %d %d %d %d) --> (%d %d %d)\n', ...
      i, y(1:n), p(1:k-1) )
  end

  return
end

