function b = r8to_mtv ( n, a, x )

%*****************************************************************************80
%
%% R8TO_MTV multiplies a vector by a R8TO matrix.
%
%  Discussion:
%
%    The R8TO storage format is used for a Toeplitz matrix, which is constant
%    along diagonals.  Thus, in an N by N Toeplitz matrix, there are at most 
%    2*N-1 distinct entries.  The format stores the N elements of the first
%    row, followed by the N-1 elements of the first column (skipping the
%    entry in the first row).
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 August 2015
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer N, the order of the matrix.
%
%    Input, real A(2*N-1), the R8TO matrix.
%
%    Input, real X(N), the vector to be multiplied by A.
%
%    Output, real B(N), the product A' * X.
%
  b = zeros ( n, 1 );

  for i = 1 : n

    for j = 1 : i
      b(i) = b(i) + a(i+1-j) * x(j);
    end

    for j = i + 1 : n
      b(i) = b(i) + a(n-i+j) * x(j);
    end

  end

  return
end
