function a_ge = r83s_to_r8ge ( m, n, a_83s )

%*****************************************************************************80
%
%% R83S_TO_R8GE copies an R83S matrix to a R8GE matrix.
%
%  Discussion:
%
%    The R83S storage format is used for a tridiagonal scalar matrix.
%    The vector A(3) contains the subdiagonal, diagonal, and superdiagonal
%    values that occur on every row.
%    RGE A(I,J) = R83S A[I-J+1].
%
%  Example:
%
%    Here is how an R83S matrix of order 5, stored as (A1,A2,A3), would
%    be interpreted:
%
%      A2  A1   0   0   0
%      A3  A2  A1   0   0
%       0  A3  A2  A1   0 
%       0   0  A3  A2  A1
%       0   0   0  A3  A2
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    05 September 2015
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer M, N, the order of the matrix.
%
%    Input, real A_83S(3), the R83S matrix.
%
%    Output, real A_GE(M,N), the R8GE matrix.
%
  a_ge = zeros ( m, n );

  for j = 1 : n
    for i = max ( 1, j - 1 ) : min ( m, j + 1 )
      a_ge(i,j) = a_83s(i-j+2);
    end
  end

  return
end
