function variomino_condense_test ( )

%*****************************************************************************80
%
%% variomino_condense_test() tests variomino_condense().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    18 April 2023
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'variomino_condense_test():\n' );
  fprintf ( 1, '  variomino_condense() "cleans up" a matrix that\n' );
  fprintf ( 1, '  represents a variomino by eliminating initial and final:\n' );
  fprintf ( 1, '  rows and columns of zeros.\n' );
%
%  Nothing happens:
%
  p = [  0,  1,  2; ...
         2,  3,  0; ...
         0,  2,  0 ];
  condense_demo ( p );
%
%  Nonzero.
%
  p = [ 0,  0,  0, 0; ...
        0,  2,  3, 0; ...
        0,  1,  2, 0; ...
        0,  0,  0, 0 ];
  condense_demo ( p );
%
%  Internal zero rows and columns are NOT removed.
%
  p = [  3,  1,  0,  3; ...
         0,  0,  0,  0; ...
         1,  2,  0,  1 ];
  condense_demo ( p );
%
%  Null matrices are detected.
%
  p = [ 0, 0, 0, 0; ...
        0, 0, 0, 0 ];
  condense_demo ( p );

  return
end
function condense_demo ( p )

%*****************************************************************************80
%
%% condense_demo() demonstrates the result of calling variomino_condense.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    18 April 2023
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer p(mp,np): a matrix representing the variomino.  
%
  [ mp, np ] = size ( p );
  label = sprintf ( '  The initial (%d,%d) variomino P:', mp, np );
  variomino_print ( p, label );

  q = variomino_condense ( p );
  [ mq, nq ] = size ( q );
  label = sprintf ( '  The condensed (%d,%d) variomino Q:', mq, nq );
  variomino_print ( q, label );

  return
end
