function r8vec_mirror_ab_next_test ( )

%*****************************************************************************80
%
%% R8VEC_MIRROR_AB_NEXT_TEST tests R8VEC_MIRROR_AB_NEXT.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    01 August 2015
%
%  Author:
%
%    John Burkardt
%
  m = 3;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'R8VEC_MIRROR_AB_NEXT_TEST\n' );
  fprintf ( 1, '  R8VEC_MIRROR_AB_NEXT generates all versions of\n' );
  fprintf ( 1, '  of a real vector X mirrored by A and B.\n' );

  a(1:m) = [ -0.5; -0.5; -0.5 ];
  x(1:m) = [  0.0;  0.0;  0.0 ];
  b(1:m) = [  0.5;  0.5;  0.5 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Case 1: 3x3x3 possibilities:\n' ) ;
  fprintf ( 1, '\n' );
  r8vec_transpose_print ( m, a, '   A:' );
  r8vec_transpose_print ( m, x, '   X:' );
  r8vec_transpose_print ( m, b, '   B:' );
  fprintf ( 1, '\n' );

  i = 0;
  done = true;

  while ( true )

    [ x, done ] = r8vec_mirror_ab_next ( m, a, b, x, done );

    if ( done )
      fprintf ( 1, '\n' );
      fprintf ( 1, '  Done.\n' );
      break
    end

    i = i + 1;
    s = sprintf ( '  %2d:', i );

    r8vec_transpose_print ( m, x, s );

  end

  a(1:m) = [ -0.5; -0.5; -0.5 ];
  x(1:m) = [  0.0;  0.5;  0.0 ];
  b(1:m) = [  0.5;  0.5;  0.5 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Case 2: 3x2x3 possibilities:\n' ) ;
  fprintf ( 1, '\n' );
  r8vec_transpose_print ( m, a, '   A:' );
  r8vec_transpose_print ( m, x, '   X:' );
  r8vec_transpose_print ( m, b, '   B:' );
  fprintf ( 1, '\n' );

  i = 0;
  done = true;

  while ( true )

    [ x, done ] = r8vec_mirror_ab_next ( m, a, b, x, done );

    if ( done )
      fprintf ( 1, '\n' );
      fprintf ( 1, '  Done.\n' );
      break
    end

    i = i + 1;
    s = sprintf ( '  %2d:', i );

    r8vec_transpose_print ( m, x, s );

  end

  a(1:m) = [  0.0; -0.5; -0.5 ];
  x(1:m) = [  0.0;  0.0;  0.0 ];
  b(1:m) = [  0.0;  0.5;  0.5 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Case 3: 1x3x3 possibilities:\n' ) ;
  fprintf ( 1, '\n' );
  r8vec_transpose_print ( m, a, '   A:' );
  r8vec_transpose_print ( m, x, '   X:' );
  r8vec_transpose_print ( m, b, '   B:' );
  fprintf ( 1, '\n' );

  i = 0;
  done = true;

  while ( true )

    [ x, done ] = r8vec_mirror_ab_next ( m, a, b, x, done );

    if ( done )
      fprintf ( 1, '\n' );
      fprintf ( 1, '  Done.\n' );
      break
    end

    i = i + 1;
    s = sprintf ( '  %2d:', i );

    r8vec_transpose_print ( m, x, s );

  end

  return
end
