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

%*****************************************************************************80
%
%% R83V_MV multiplies a R83V matrix times a vector.
%
%  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, N, the order of the linear system.
%
%    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.
%
%    Output, real AX(M), the product A * x.
%

%
%  Force X to be a column vector.
%
  x = x ( : );
%
%  Multiply.
%
  ax = zeros ( m, 1 );

  for k = 1 : min ( m - 1, n )
    ax(k+1) = ax(k+1) + a(k) * x(k);
  end

  for k = 1 : min ( m, n )
    ax(k) = ax(k) + b(k) * x(k);
  end

  for k = 1 : min ( m, n - 1 )
    ax(k) = ax(k) + c(k) * x(k+1);
  end

  return
end
