function polyomino_monohedral_matrix_test ( )

%*****************************************************************************80
%
%% POLYOMINO_MONOHEDRAL_MATRIX_TEST tests POLYOMINO_MONOHEDRAL_MATRIX.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    17 May 2018
%
%  Author:
%
%    John Burkardt
%
  timestamp ( )
  fprintf ( 1, '\n' );
  fprintf ( 1, 'POLYOMINO_MONOHEDRAL_MATRIX_TEST:\n' );
  fprintf ( 1, '  MATLAB version\n' );
  fprintf ( 1, '  POLYOMINO_MONOHEDRAL_MATRIX sets up the linear system\n' );
  fprintf ( 1, '    A*x=b\n' );
  fprintf ( 1, '  used to search for solutions to the problem of tiling\n' );
  fprintf ( 1, '  a region R with copies of a polyomino P that may be\n' );
  fprintf ( 1, '  reflected or rotated.\n' );
%
%  Define the region to be tiled.
%
  shape_r = [ ...
    1, 1, 0; ...
    1, 1, 1;
    1, 1, 1 ];

  [ m_r, n_r ] = size ( shape_r );

  polyomino_print ( m_r, n_r, shape_r, '  The region R:' );
%
%  Define the polyomino that will be used for the tiling.
%
  shape_p = [ 1, 1 ];

  [ m_p, n_p ] = size ( shape_p );

  polyomino_print ( m_p, n_p, shape_p, '  The polyomino P:' );
%
%  Compute the corresponding linear system A*x=b.
%
  [ a, b ] = polyomino_monohedral_matrix ( shape_r, shape_p );

  [ ma, na ] = size ( a );
%
%  Print the system.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Linear system A | b\n' );
  fprintf ( 1, '\n' );
  for i = 1 : ma
    fprintf ( 1, '  ' );
    for j = 1 : na
      fprintf ( 1, ' %d', a(i,j) );
    end
    fprintf ( 1, ' | %d\n', b(i) );
  end
%
%  Write the linear system to an LP file.
%
  filename = 'matrix.lp';
  label = '\ LP file for the polyomino_monohedral_matrix example.';

  polyomino_lp_write ( filename, label, ma, na, a, b );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Wrote the LP file "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'POLYOMINO_MONOHEDRAL_MATRIX_TEST:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  return
end
