function b = r83t_mtv ( m, n, a, x )

%*****************************************************************************80
%
%% R83T_MTV multiplies an R83T matrix transposed times an R8VEC.
%
%  Discussion:
%
%    The R83T storage format is used for an MxN tridiagonal matrix.
%    The superdiagonal is stored in entries (1:M-1,3), the diagonal in
%    entries (1:M,2), and the subdiagonal in (2:M,1).  Thus, the
%    the rows of the original matrix slide horizontally to form an
%    Mx3 stack of data.
%
%    An R83T matrix of order 3x5 would be stored:
%
%       *  A11 A12
%      A21 A22 A23
%      A32 A33 A34
%
%    An R83T matrix of order 5x5 would be stored:
%
%       *  A11 A12
%      A21 A22 A23
%      A32 A33 A34
%      A43 A44 A45
%      A54 A55  *
%
%    An R83T matrix of order 5x3 would be stored:
%
%       *  A11 A12
%      A21 A22 A23
%      A32 A33  *
%      A43  *   *
%       *   *   *
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    28 May 2016
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer M, N, the number of rows and columns.
%
%    Input, real A(M,3), the matrix.
%
%    Input, real X(M), the vector to be multiplied by A.
%
%    Output, real B(N), the product A' * x.
%
  b(1:n) = 0.0;

  for i = 1 : m
    for k = 1 : 3
      j = i - 2 + k;
      if ( 1 <= j && j <= n )
        b(j) = b(j) + x(i) * a(i,k);
      end
    end
  end

  return
end

