function C = multELB(A,B)
% MULTELB  Matrix-matrix product.  Checks sizes before
%          computing product.  A primitive re-implementation
%          of built-in A*B.  See Kincaid & Cheney CP 4.1 #2c.
% Example:  >> A = rand(4,6), B = rand(6,2), C = multELB(A,B)

[k m] = size(A);
[M n] = size(B);
if m ~= M, error('A and B incompatible sizes'), end

C = zeros(k,n);
for i = 1:k
  for j = 1:n
    for k = 1:m
      C(i,j) = C(i,j) + A(i,k) * B(k,j);
    end
  end
end
