function Age = r8crs_to_r8ge ( m, n, nz, row, col, val )

%*****************************************************************************80
%
%% crs_to_ge() converts a CRS matrix to a GE matrix.
%
%  Discussion:
%
%    The CRS storage format stores the nonzero entries of row I in 
%    entries ROW(I) through ROW(I+1)-1 of VAL.  
%    COL(J) records the column index of the entry in VAL(J).
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 March 2026
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N: the order of the matrix.
%
%    integer NZ: the number of nonzero elements.
%
%    integer ROW(M+1): the nonzero offdiagonal elements 
%    of row I of A are contained in A(ROW(I)) through A(ROW(I+1)-1).
%
%    integer COL(NZ): the column indices of the nonzero elements of A.
%
%    real VAL(NZ): the nonzero elements of A.
%
%  Output:
%
%    real Age(M,N): the GE matrix.
%
  Age = zeros ( m, n );

  if ( row(1) == 0 )
    for i = 1 : m
      for j = row(i) + 1 : row(i+1)
        Age(i,col(j)+1) = val(j);
      end
    end
  else
    for i = 1 : m
      for j = row(i) : row(i+1)-1
        Age(i,col(j)) = val(j);
      end
    end
  end

  return
end

