Why solving (10000 x 10000 ) linear system is slower than solving 100 linear system of size (100 x 100). I thought the time will be the same, but the results say something else.
I am using a linear system of equations in an application where I can use a large linear system or a set of smaller linear systems. The smaller linear systems are totally different than the larger one, meaning, the larger linear system is not divided into smaller.
Please see the following code:
n=10000;
NI=[ 10000, 6250, 5000, 4000, 3125, 2500, 2000 1250 1000 625, 500, 400, 250 200,125, 100, 50, 40, 20, 10, 5]
t2=[]
for j=1:1:length(NI)
t=[]; s=n/NI(j); ni=NI(j);
for i=1:s
A= magic(ni);
b= randperm(2^16,ni);
tic; x=A/b;
t=[t toc];
end
t2=[t2 sum(t)];
end
plot(t2)
Based on my machine, please see this figure that shows the execution time It is larger when a single system of size (10k x 10k) is solved and slow when we solved 2000 linear system where each one is of size (5 x 5)
How can I prove these outcomes? Solving (k) linear system is better than solving a single larger one.