function r8mat_is_solution_test ( )

%*****************************************************************************80
%
%% r8mat_is_solution_test() tests r8mat_is_solution().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 May 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'r8mat_is_solution_test():\n' );
  fprintf ( 1, '  r8mat_is_solution() tests whether X is the solution of\n' );
  fprintf ( 1, '  A*X=B by computing the Frobenius norm of the residual.\n' );
%
%  Get random shapes.
%
  m = randi ( [ 1, 10 ], 1 );
  n = randi ( [ 1, 10 ], 1 );
  k = randi ( [ 1, 10 ], 1 );
%
%  Get a random A.
%
  r8_lo = -5.0;
  r8_hi = +5.0;
  a = r8_lo + ( r8_hi - r8_lo ) * rand ( m, n );
%
%  Get a random X.
%
  r8_lo = -5.0;
  r8_hi = +5.0;
  x = r8_lo + ( r8_hi - r8_lo ) * rand ( n, k );
%
%  Compute B = A * X.
%
  b = a * x;
%
%  Compute || A*X-B||
%
  enorm = r8mat_is_solution ( m, n, k, a, x, b );
  
  fprintf ( 1, '\n' );
  fprintf ( 1, '  A is %d by %d\n', m, n );
  fprintf ( 1, '  X is %d by %d\n', n, k );
  fprintf ( 1, '  B is %d by %d\n', m, k );
  fprintf ( 1, '  Frobenius error in A*X-B is %g\n', enorm );

  return
end
