function r8gb_trs_test ( )

%*****************************************************************************80
%
%% R8GB_TRS_TEST tests R8GB_TRS.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 June 2016
%
%  Author:
%
%    John Burkardt
%
  n = 10;
  m = n;
  ml = 1;
  mu = 2;
  nrhs = 1;
  seed = 123456789;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'R8GB_TRS_TEST\n' );
  fprintf ( 1, '  R8GB_TRS solves a linear system factored by R8GB_TRS.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Matrix rows M =      %d\n', m );
  fprintf ( 1, '  Matrix columns N =   %d\n', n );
  fprintf ( 1, '  Lower bandwidth ML = %d\n', ml );
  fprintf ( 1, '  Upper bandwidth MU = %d\n', mu );
%
%  Set the matrix.
%
  [ a, seed ] = r8gb_random ( m, n, ml, mu, seed );
%
%  Set the desired solution.
%
  x = r8vec_indicator1 ( n );
%
%  Compute the corresponding right hand side.
%
  b = r8gb_mv ( m, n, ml, mu, a, x );
%
%  Factor the matrix.
%
  [ a_lu, pivot, info ] = r8gb_trf ( m, n, ml, mu, a );

  if ( info ~= 0 )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'R8GB_TRS_TEST - Fatal error!\n' );
    fprintf ( 1, '  R8GB_TRF declares the matrix is singular!\n' );
    fprintf ( 1, '  The value of INFO is %d\n', info );
    return
  end
%
%  Solve the linear system.
%  Note that, because of quirks in MATLAB, we need to copy our vector-based
%  data to and from 2D arrays.
%
  b_mat = r8vec_to_r8ge ( n, nrhs, b );
  [ x_mat, info ] = r8gb_trs ( n, ml, mu, nrhs, 'N', a_lu, pivot, b_mat );
  x = r8ge_to_r8vec ( n, nrhs, x_mat );
  r8vec_print ( n, x, '  Solution:' );
%
%  Set the desired solution.
%
  x = r8vec_indicator1 ( n );
%
%  Compute the corresponding right hand side.
%
  job = 1;
  b = r8gb_mu ( n, ml, mu, a_lu, pivot, x, job );
%
%  Solve the linear system.
%
  b_mat = r8vec_to_r8ge ( n, nrhs, b );
  [ x_mat, info ] = r8gb_trs ( n, ml, mu, nrhs, 'T', a_lu, pivot, b_mat );
  x = r8ge_to_r8vec ( n, nrhs, x_mat );
  r8vec_print ( n, x, '  Solution to transposed system:' );

  return
end
