function variance = r8col_variance ( m, n, a )

%*****************************************************************************80
%
%% r8col_variance() returns the variances of an R8COL.
%
%  Discussion:
%
%    An R8COL is an M by N array of R8's, regarded as an array of N columns,
%    each of length M.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    24 April 2005
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, N, the number of rows and columns in the array.
%
%    real A(M,N), the array whose variances are desired.
%
%  Output:
%
%    real VARIANCE(N), the variances of the rows.
%
  for j = 1 : n

    mean = sum ( a(1:m,j) ) / m;

    variance(j) = sum ( ( a(1:m,j) - mean ).^2 );

    if ( 1 < m )
      variance(j) = variance(j) / ( m - 1 );
    else
      variance(j) = 0.0;
    end

  end

  return
end
