function r8st_write_test ( )

%*****************************************************************************80
%
%% r8st_write_test() tests r8st_write().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 September 2015
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'r8st_write_test():\n' );
  fprintf ( 1, '  r8st_write() writes an r8st matrix to a file.\n' );

  m = 100;
  n = 100;
  nz_num = 3 * n - 2;

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Matrix order M         = %d\n', m );
  fprintf ( 1, '  Matrix order N         = %d\n', n );
  fprintf ( 1, '  Matrix nonzeros NZ_NUM = %d\n', nz_num );
%
%  Set the matrix values.
%
  [ row, col, a ] = r8st_dif2 ( m, n, nz_num );
%
%  Print a bit of the matrix.
%
  r8st_print_some ( m, n, nz_num, row, col, a, 1, 1, ...
    10, 10, '  Initial 10x10 block of r8st matrix:' );
%
%  Write the matrix to a file.
%
  output_file = 'r8st_matrix.txt';

  r8st_write ( m, n, nz_num, row, col, a, output_file );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Matrix data written to "%s"\n.', output_file );

  return
end
