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

%*****************************************************************************80
%
%% R83S_RES computes the residual R = B-A*X for R83S matrices.
%
%  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:
%
%    09 July 2014
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer M, N, the order of the matrix.
%
%    Input, real A(3), the matrix.
%
%    Input, real X(N), the vector to be multiplied by A.
%
%    Input, real B(M), the desired result A * x.
%
%    Output, real R(M), the residual R = B - A * X.
%
  r = r83s_mv ( m, n, a, x );

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

  return
end
