function b = r8pbl_mv ( n, ml, a, x )

%*****************************************************************************80
%
%% R8PBL_MV multiplies an R8PBL matrix by an R8VEC.
%
%  Discussion:
%
%    The R8PBL storage format is for a symmetric positive definite band matrix.
%
%    To save storage, only the diagonal and lower triangle of A is stored,
%    in a compact diagonal format that preserves columns.
%
%    The diagonal is stored in row 1 of the array.
%    The first subdiagonal in row 2, columns 1 through ML.
%    The second subdiagonal in row 3, columns 1 through ML-1.
%    The ML-th subdiagonal in row ML+1, columns 1 through 1.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    19 July 2016
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer N, the order of the matrix.
%
%    Input, integer ML, the number of subdiagonals in the matrix.
%    ML must be at least 0 and no more than N-1.
%
%    Input, real A(ML+1,N), the R8PBL matrix.
%
%    Input, real X(N), the vector to be multiplied by A.
%
%    Output, real B(N), the result vector A * x.
%
  b = zeros ( n, 1 );
%
%  Multiply X by the diagonal of the matrix.
%
  for i = 1 : n
    b(i) = a(1,i) * x(i);
  end
%
%  Multiply X by the subdiagonals of the matrix.
%
  for k = 1 : ml
    for j = 1 : n - k
      i = j + k;
      aij = a(k+1,j);
      b(i) = b(i) + aij * x(j);
      b(j) = b(j) + aij * x(i);
    end
  end

  return
end
