function r = r83v_res ( m, n, a, b, c, x, ax )

%*****************************************************************************80
%
%% R83V_RES computes the residual R = b-A*x for R83V matrices.
%
%  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:
%
%    01 February 2016
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer M, the number of rows of the matrix.
%    M must be positive.
%
%    Input, integer N, the number of columns of the matrix.
%    N must be positive.
%
%    Input, real A(min(M-1,N)), B(min(M,N)), C(min(M,N-1)), the R83V matrix.
%
%    Input, real X(N), the vector to be multiplied by A.
%
%    Input, real AX(M), the desired result A * x.
%
%    Output, real R(M), the residual R = b - A * x.
%
  r = r83v_mv ( m, n, a, b, c, x );

  r(1:m,1) = ax(1:m,1) - r(1:m,1);

  return
end
