Solve linear system with pre-calculated factorization
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I have a matrix A and I need to factorize this matrix every iteration. But I can decompose this matrix in this form:
A=BCD
Now just I need to factorize the matrix C every iteration instead of A (its 20 times faster to factorize C istead of A, because C is quasi-diagonal). And I can store the factorized terms of B and D and find the solution. But the solution using this is more costly, because I have to solve 3 systems now :
B = sparse(B);
C = sparse(C);
D = sparse(D);
[L1,U1,P1,Q1,R1] = lu(B);
[L4,U4,P4,Q4,R4] = lu(D);
% Inside of a loop1:
[L2,U2,P2,Q2,R2] = lu(C);
%loop2:
resp3= Q2*(U2\(L2\(P2*(R2\Q4*(U4\(L4\(P4*(R4\Q1*(U1\(L1\(P1*(R1\b))))))))))));
%
This solution is more costly than factorize the whole matrix A and solve the system :
% Inside of a loop1 :
[L3,U3,P3,Q3,R3] = lu(A);
% Loop2:
resp = Q3*(U3\(L3\(P3*(R3\b))));
%
It is possible to use information of the matrix B and C to solve the linear system more efficiently than use the whole matrix A?
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!