function b = r8sm_mtv ( m, n, a, u, v, x )

%*****************************************************************************80
%
%% R8SM_MTV multiplies a vector by a R8SM matrix.
%
%  Discussion:
%
%    The R8SM storage format is used for an M by N Sherman Morrison matrix B,
%    which is defined by an M by N matrix A, an M vector U, and
%    an N vector V, by B = A - U * V'
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 August 2015
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer M, N, the number of rows and columns of the matrix.
%
%    Input, real A(M,N), the R8SM matrix.
%
%    Input, real U(M), V(N), the R8SM vectors.
%
%    Input, real X(M), the vector to be multiplied.
%
%    Output, real B(N), the product (A-u*v')' * x.
%
  ux = 0.0;
  for i = 1 : m
    ux = ux + u(i) * x(i);
  end

  b = zeros ( n, 1 );
  for j = 1 : n
    for i = 1 : m
      b(j) = b(j) + x(i) * a(i,j);
    end
    b(j) = b(j) - v(j) * ux;
  end

  return
end
