function [ a1, a2, a3 ] = r8ge_to_r83v ( m, n, a )

%*****************************************************************************80
%
%% R8GE_TO_R83V copies (some of) an R8GE matrix to an R83V matrix.
%
%  Discussion:
%
%    The R83V storage format is used for a tridiagonal matrix.
%    The subdiagonal is in A(min(M-1,N)).
%    The diagonal is in B(min(M,N)).
%    The superdiagonal is in C(min(M,N-1)).
%
%  Example:
%
%    An R83V matrix of order 3x5 would be stored:
%
%      B1  C1  **  **  **
%      A1  B2  C2  **  **
%      **  A2  B3  C3  **
%
%    An R83 matrix of order 5x5 would be stored:
%
%      B1  C1  **  **  **
%      A1  B2  C2  **  **
%      **  A2  B3  C3  **
%      **  **  A3  B4  C4
%      **  **  **  A4  B5
%
%    An R83 matrix of order 5x3 would be stored:
%
%      B1  C1  **
%      A1  B2  C2
%      **  A2  B3
%      **  **  A3
%      **  **  **
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    20 February 2016
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer M, N, the order of the matrix.
%
%    Input, real A(M,N), the R8GE matrix.
%
%    Output, real A1(min(M-1,N)), A2(min(M,N)), A3(min(M,N-1)), 
%    the R83V matrix.
%
  ahi = min ( m - 1, n );
  bhi = min ( m,     n );
  chi = min ( m,     n - 1 );

  a1 = zeros ( ahi, 1 );
  for k = 1 : ahi
    a1(k) = a(k+1,k);
  end

  a2 = zeros ( bhi, 1 );
  for k = 1 : bhi
    a2(k) = a(k,k);
  end

  a3 = zeros ( chi, 1 );
  for k = 1 : chi
    a3(k) = a(k,k+1);
  end
   
  return
end