Quote:
Originally Posted by Ether
Ryan, could you please re-run this, without iterating? I want to eliminate the possibility that Matlab is optimizing out the iteration.
|
I had tried this originally, and the results were consistent with the iterated/averaged result, but I was getting some variation in timing so I wanted to take the average case. Interestingly, the average from the iterated trials was consistently higher than any of the trials running single-shot.
Linear solver 0.19269
Invert and multiply 1.8698
Code:
N = dlmread('N.dat');
d = dlmread('d.dat');
tic;
r1 = N \ d;
t1 = toc;
% also save r1 to a file here so the computation is not optimized out.
dlmwrite('r_solver.dat', r1);
disp(['Linear solver ' num2str(t1)]);
tic;
r2 = inv(N) * d;
t2 = toc;
% also save r2 to a file here so the computation is not optimized out.
dlmwrite('r_invmult.dat', r2);
disp(['Invert and multiply ' num2str(t2)]);
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor