UNn × n A xyo= byoi = 1 ... mmetro
V = inv(A);
...
x = V*b;
O ( n3)inv(A)
O ( n2)V*b
metro
>> n = 5000;
>> A = randn(n,n);
>> x = randn(n,1);
>> b = A*x;
>> rcond(A)
ans =
1.3837e-06
>> tic, xm = A\b; toc
Elapsed time is 1.907102 seconds.
>> tic, [L,U] = lu(A); toc
Elapsed time is 1.818247 seconds.
>> tic, xl = U\(L\b); toc
Elapsed time is 0.399051 seconds.
>> tic, [L,U,p] = lu(A,'vector'); toc
Elapsed time is 1.581756 seconds.
>> tic, xp = U\(L\b(p)); toc
Elapsed time is 0.060203 seconds.
>> tic, V=inv(A); toc
Elapsed time is 7.614582 seconds.
>> tic, xv = V*b; toc
Elapsed time is 0.011499 seconds.
>> [norm(xm-x), norm(xp-x), norm(xl-x), norm(xv-x)] ./ norm(x)
ans =
1.0e-11 *
0.1912 0.1912 0.1912 0.6183
UN- 1L Um > 125
Algunas notas
Para un análisis de estabilidad y error, vea los comentarios a esta respuesta diferente , especialmente la de VictorLiu.
m ≪ n
La sincronización se realizó con Matlab R2011b en una computadora de 12 núcleos con un promedio de carga UNIX bastante constante de 5; El mejor tic, toc
momento de tres sondas.