From: utab on
Dear all,

I need the inverse of a sparse 5544X5544 matrix, where I tried some
different options in MATLAB but the results are so different which raised
my attention, especially the one on inv. I used cholesky, lu
decompositions and direct inv in MATLAB,

here is the code to test the inversion timing

clc, clear all;
% test 1
load Mss;
tic;
invMss = inv(Mss);
toc;
% test2
clear Mss, invMss;
load Mss;
tic;
L = chol(Mss, 'lower');
invChol = L'\(L\ speye(size(Mss,1)));
toc;
%
clear Mss
clear invChol
clear L;
load Mss;
tic;
[L, U] = lu(Mss);
invLu = U\(L\speye(size(Mss,1)));
toc;
%
clear Mss;
clear invLu;
clear L;
clear U;
load Mss;
tic;
[L, U, P, Q] = lu(Mss);
invLu = U\(L\speye(size(Mss,1)));
toc;

And

Elapsed time is 13.613957 seconds.
Elapsed time is 142.979129 seconds.
Elapsed time is 221.484886 seconds.
Elapsed time is 52.666728 seconds.

Any comments are appreciated on these results, especially the huge time
differences.

Best regards,
Umut