I am looking at a MATLAB code that times the backslash operator for several cases. I will list the cases below:
Note: all of these are for m = 5000
1) Z = randn(m,m); A = Z'*Z; b = randn(m,1); tic; x = A\b; toc; elapsed time = 1.0368
2) tic; x= A\b; toc; elapsed time = 1.0303
3) A2 = A; A2(m,1) = A2(m,1)/2; tic; x = A2\b; toc; elapsed time = 2.0361
Note that the times above were obtained years ago and today's MATLAB is significantly faster, but the relative trends are still observed.
FOr each case, I would like to know why the experiment was performed and why is the result the way it is. The first 2 are fairly simple and the elapsed times are approximately the same. But in #3, we see the time double. For #3, the lower left element of the matrix is divided by 2, but any idea why this would result in a two times slower computation?