function r8mat_standardize_test ( )

%*****************************************************************************80
%
%% r8mat_standardize_test() tests r8mat_standardize().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 October 2018
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'R8MAT_STANDARDIZE_TEST\n' );
  fprintf ( 1, '  R8MAT_STANDARDIZE shifts and scales an R8MAT so that\n' );
  fprintf ( 1, '  each column has zero mean and unit standard deviation.\n' );

  m = 10;
  n = 3;
  a = -5.0;
  b = 15.0;

  x = a + ( b - a ) * rand ( m, n );

  r8mat_print ( m, n, x, '  Vector X:' );
  mu = mean ( x );
  sigma = std ( x );
  xmax = max ( x );
  xmin = min ( x );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  mean(X) = %g  %g  %g\n', mu(1:n) );
  fprintf ( 1, '  std(X)  = %g  %g  %g\n', sigma(1:n) );
  fprintf ( 1, '  max(X)  = %g  %g  %g\n', xmax(1:n) );
  fprintf ( 1, '  min(X)  = %g  %g  %g\n', xmin(1:n) );

  xs = r8mat_standardize ( m, n, x );

  r8mat_print ( m, n, xs, '  Vector XS:' );
  mu = mean ( xs );
  sigma = std ( xs );
  xmax = max ( xs );
  xmin = min ( xs );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  mean(X) = %g  %g  %g\n', mu(1:n) );
  fprintf ( 1, '  std(X)  = %g  %g  %g\n', sigma(1:n) );
  fprintf ( 1, '  max(X)  = %g  %g  %g\n', xmax(1:n) );
  fprintf ( 1, '  min(X)  = %g  %g  %g\n', xmin(1:n) );

  return
end
