%-----------------------------------------------------------------------
function C = MatMatVec(A,B)
% C = MatMatVec(A,B)
% computes matrix*matrix product C = A*B (via matrix-vector products) where
% A is an mXp matrix, B a pXn matrix.
[m,p] = size(A);
[p,n] = size(B);
C = zeros(m,n);
for j = 1:n
   % Compute j-th column of C
   C(:,j) = A*B(:,j);
%  this addition is unnecessary, since C contains zeros!
%  C(:,j) = C(:,j) + A*B(:,j);
end
%
%
%        6               8             6
%  /--$---\     / -------- \     /--$---\
%  |--$---|     | -------- |     |--$---|
%  |--$---|     | -------- |     |--$---|
%  |--$---| =   | -------- |     |--$---|
%  |--$---|     | -------- |  *  |--$---|
%  |--$---|     | -------- |     |--$---|
% 7\--$---/    7\ -------- /     |--$---|
%     j=3                       8\--$---/
%                                   j=3
