function r8mat_2perm1_test ( )

%*****************************************************************************80
%
%% r8mat_2perm1_test() tests r8mat_2perm1().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 April 2009
%
%  Author:
%
%    John Burkardt
%
  m = 9;
  n = 7;
  p = [ 2, 3, 9, 6, 7, 8, 5, 4, 1 ];
  q = [ 3, 4, 5, 6, 7, 1, 2 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, 'r8mat_2perm1_test():\n' );
  fprintf ( 1, '  r8mat_2perm1() reorders a real matrix in place.\n' );
  fprintf ( 1, '  Rows and columns use different permutations.\n' );
 
  for i = 1 : m
    for j = 1 : n
      a(i,j) = i * 10 + j;
    end
  end
 
  r8mat_print ( m, n, a, '  The original matrix' );
 
  perm1_print ( m, p, '  The row permutation:' );
 
  perm1_print ( n, q, '  The column permutation:' );

  a = r8mat_2perm1 ( m, n, a, p, q );
 
  r8mat_print ( m, n, a, '  The permuted matrix' );
 
  return
end
