function pariomino_condense_test ( )

%*****************************************************************************80
%
%% pariomino_condense_test tests pariomino_CONDENSE.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    09 May 2020
%
%  Author:
%
%    John Burkardt
%
  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'pariomino_condense_test:\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  pariomino_condense() "cleans up" a matrix that\n' );
  fprintf ( 1, '  represents a pariomino by eliminating initial and final:\n' );
  fprintf ( 1, '  rows and columns of zeros.\n' );
%
%  Nothing happens:
%
  p = [  0, -1, +1; ...
        -1, +1,  0; ...
         0, -1,  0 ];
  condense_demo ( p );
%
%  Nonzero, but non-one entries are set to 1.
%
  p = [ 0,  0,  0, 0; ...
        0, +1, -1, 0; ...
        0, -1, +1, 0; ...
        0,  0,  0, 0 ];
  condense_demo ( p );
%
%  Internal zero rows and columns are NOT removed.
%
  p = [ +1, -1,  0, -1; ...
         0,  0,  0,  0; ...
        +1, -1,  0, -1 ];
  condense_demo ( p );
%
%  Null matrices are detected.
%
  p = [ 0, 0, 0, 0; ...
        0, 0, 0, 0 ];
  condense_demo ( p );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'pariomino_condense_test:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  return
end
function condense_demo ( p )

%*****************************************************************************80
%
%% condense_demo demonstrates the result of calling pariomino_condense.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    09 May 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer P(MP,NP), a matrix representing the pariomino.  
%
  [ mp, np ] = size ( p );
  label = sprintf ( '  The initial (%d,%d) pariomino P:', mp, np );
  pariomino_print ( p, label );

  q = pariomino_condense ( p );
  [ mq, nq ] = size ( q );
  label = sprintf ( '  The condensed (%d,%d) pariomino Q:', mq, nq );
  pariomino_print ( q, label );

  return
end
