function r = r83_res ( m, n, a, x, b )

%*****************************************************************************80
%
%% r83_res() computes the residual R = b-A*x for R83 matrices.
%
%  Discussion:
%
%    The R83 storage format is used for a tridiagonal matrix.
%    The superdiagonal is stored in entries (1,2:min(M+1,N)).
%    The diagonal in entries (2,1:min(M,N)).
%    The subdiagonal in (3,min(M-1,N)).
%    R8GE A(I,J) = R83 A(I-J+2,J).   
%
%    The original matrix is "collapsed" vertically into the array.
%
%  Example:
%
%    An R83 matrix of order 3x5 would be stored:
%
%       *  A12 A23 A34  *
%      A11 A22 A33  *   *
%      A21 A32  *   *   *
%
%    An R83 matrix of order 5x5 would be stored:
%
%       *  A12 A23 A34 A45
%      A11 A22 A33 A44 A55
%      A21 A32 A43 A54  *
%
%    An R83 matrix of order 5x3 would be stored:
%
%       *  A12 A23
%      A11 A22 A33
%      A21 A32 A43
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    02 June 2014
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, the number of rows of the matrix.
%    M must be positive.
%
%    integer N, the number of columns of the matrix.
%    N must be positive.
%
%    real A(3,N), the matrix.
%
%    real X(N), the vector to be multiplied by A.
%
%    real B(M), the desired result A * x.
%
%  Output:
%
%    real R(M), the residual R = b - A * x.
%
  r = r83_mv ( m, n, a, x );

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

  return
end
