function r8vec_print_mask_test ( )

%*****************************************************************************80
%
%% R8VEC_PRINT_MASK_TEST tests R8VEC_PRINT_MASK.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    05 August 2018
%
%  Author:
%
%    John Burkardt
%

  fprintf ( 1, '\n' );
  fprintf ( 1, 'R8VEC_PRINT_MASK_TEST\n' );
  fprintf ( 1, '  R8VEC_PRINT_MASK prints masked elements of an R8VEC.\n' );

  n = 10;
  a = 10.0;
  b = 20.0;
  seed = 123456789;
  [ r, seed ] = r8vec_uniform_ab ( n, a, b, seed );
  r8vec_print ( n, r, '  The full vector:' );

  mask_num = 0;
  mask = [];
  for i = 1 : n
    if ( 15.0 < r(i) )
      mask_num = mask_num + 1;
      mask(mask_num) = i;
    end
  end
  r8vec_print_mask ( n, r, mask_num, mask, '  R > 15.0:' );

  mask_num = 0;
  mask = [];
  for i = 1 : n
    if ( abs ( r(i) - 12.0 ) < 2.0 )
      mask_num = mask_num + 1;
      mask(mask_num) = i;
    end
  end
  r8vec_print_mask ( n, r, mask_num, mask, '  R near 12:' );

  mask_num = floor ( ( n + 1 ) / 2 );
  mask = 1 : 2 : n;
  r8vec_print_mask ( n, r, mask_num, mask, '  Odd index R:' );

  return
end
