Matrix multiplication

Jan 30, 2007: there is a new Matlab version which was installed Jan 11 2007. When I constructed the lab I used an older version (and I cannot use the lastest version on the teacher's side of the system). The new version is slower on these examples and does not give such a striking difference.

It is more amusing to use an older version or our latest version, so run:

/chalmers/sw/sup/matlab-7.1/bin/matlab
or
/chalmers/sw/sup/matlab-2008b/bin/matlab


Run and explain the following:

A = randn(1000);

tic
  for k = 1:10
    C = A' * A;
  end
toc

tic
  for k = 1:10
    C = A * A';
  end
toc

tic
  for k = 1:10
    C = A * A;
  end
toc


Back