function triang_test ( )

%*****************************************************************************80
%
%% TRIANG_TEST tests TRIANG.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  n = 10;

  a = [ ...
    1, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
    0, 1, 0, 1, 0, 1, 0, 1, 0, 0; ...
    1, 0, 1, 1, 0, 0, 0, 0, 0, 0; ...
    0, 0, 0, 1, 0, 0, 0, 0, 0, 0; ...
    1, 1, 1, 1, 1, 1, 1, 1, 0, 1; ...
    0, 0, 0, 1, 0, 1, 0, 1, 0, 0; ...
    1, 0, 1, 1, 0, 1, 1, 1, 0, 1; ...
    0, 0, 0, 1, 0, 0, 0, 1, 0, 0; ...
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0; ...
    1, 0, 1, 1, 0, 0, 0, 1, 0, 1];

  fprintf ( 1, '\n' );
  fprintf ( 1, 'TRIANG_TEST\n' );
  fprintf ( 1, '  TRIANG relabels elements for a partial ordering,\n' );

  i4mat_print ( n, n, a, '  The input matrix:' );
 
  p = triang ( n, a );
 
  perm1_print ( n, p, '  The new ordering:' );

  a = i4mat_2perm1 ( n, n, a, p, p );
 
  i4mat_print ( n, n, a, '  The reordered matrix:' );

  return
end
