function a_columns = rref_columns ( a )

%*****************************************************************************80
%
%% RREF_COLUMNS uses reduced row echelon form (RREF) for column independence.
%
%  Discussion:
%
%    The RREF process will identify columns that are linear combinations of
%    previous columns.
%
%    This function will return a matrix containing only the linearly
%    independent columns.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    28 September 2018
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, real A(M,N), the matrix to be analyzed.
%
%    Output, real A_COLUMNS(M,N2), a matrix whose N2 columns are the linearly
%    independent columns of A.
%
  [ a_ref, a_cols ] = rref ( a );

  a_columns = a(:,a_cols);

  return
end

