function [ amin, imin ] = r8col_min ( m, n, a )

%*****************************************************************************80
%
%% r8col_min() returns the column minimums 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.
%
%    real A(M,N), the array to be examined.
%
%  Output:
%
%    real AMIN(N), the minimums of the columns.
%
%    integer IMIN(N); IMIN(I) is the row of A in which
%    the minimum for column I occurs.
%
  for j = 1 : n

    imin(j) = 1;
    amin(j) = a(1,j);
    for i = 2 : m
      if ( a(i,j) < amin(j) )
        imin(j) = i;
        amin(j) = a(i,j);
      end
    end

  end

  return
end
