% time00 - Prelude to the first example 
%
% This example along with time01 demonstrate
% the performance of matrix algebra

% N = 10
N = 100
M = 12
tic
for loop = 1:M
    A = rand(N);
    B = rand(N);
    C = zeros(N);
    % C = A*B - B*A;
    for i=1:N
        for j=1:N
            for k=1:N
                C(i,j) = C(i,j) + A(i,k)*B(k,j);
            end
            for k=1:N
                C(i,j) = C(i,j) - B(i,k)*A(k,j);
            end
        end
    end 
end
toc
fprintf('%12.4e fmults %12.4e fadds\n',M*(2*N^3),M*(2*N^3+N^2))
if N < 20
    C
else
    UR = C(1,N)
    LL = C(N,1)
end
