function y = prodELB(A,x)
% PRODELB  Matrix-vector product.  Checks sizes before
%          computing product.  A primitive re-implementation
%          of built-in A*x.  See Kincaid & Cheney CP 4.1 #2b.
% Example: >> A = rand(4,6), x = rand(6,1), y = prodELB(A,x)

[m n] = size(A);
if n ~= size(x,1), error('A and x incompatible sizes'), end

y = zeros(m,1);
for i = 1:m
  for j = 1:n
    y(i) = y(i) + A(i,j) * x(j);
  end
end
