
nsize = 3235;
A = rand(nsize);
b = rand(nsize,1);
c = zeros(nsize,1);

tot_start = tic;

timer_inner = 0;
timer_outer = 0;

for i = 1: nsize                    % outer loop
    tic;
    A(i,i) = A(i,i) - sum(sum(A));  % modify the diagonal matrix elements
    timer_outer = timer_outer + toc;
    tic;
for j = 1: nsize                    % inner loop
    c(i,1) = c(i,1) + A(i,j)*b(j,1);
end
    timer_inner = timer_inner + toc;
end

  total = toc(tot_start);

  fprintf('\n');
  fprintf('The time elapsed for inner loop is %f seconds\n', timer_inner);
  fprintf('The time elapsed for outer loop is %f seconds\n', timer_outer);
  fprintf('The total elapsed time %f seconds\n', total);
  fprintf('\n');

