%-----------------------------------------------------------------------
function C = MatMatDot(A,B)
% C = MatMatDot(A,B)
% computes matrix*matrix product C = A*B (via dot 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
   for i = 1:m
      C(i,j) = A(i,:)*B(:,j);
   end
end
%     3  6             8          3  6
%  /------\   / -------- \     /--$---\
%  |------|   | -------- |     |--$---|
%  |------|   | -------- |     |--$---|
% 4|--$---| = | $$$$$$$$ |4    |--$---|
%  |------|   | -------- |  *  |--$---|
%  |------|   | -------- |     |--$---|
% 7\------/  7\ -------- /     |--$---|
%                             8\--$---/

