Updating inverse of a lower triangular matrix
Show older comments
Dear All,
I need to solve a matrix equation Ax=b, where the matrix A is a lower triangular matrix and its dimension is very big (could be 10000 by 10000). Now I need to change a row of A and solve Ax=b again (this change will be many times). In order to speed up the calculation, a good approach is to calculate the inverse of matrix A and use the substitution to solve x. But when a row of matrix A is changed, I need to update the inverse of A. Is there a good idea to update the inverse of matrix A?
Accepted Answer
More Answers (1)
Bei Gou
on 28 Mar 2017
0 votes
3 Comments
John D'Errico
on 28 Mar 2017
Edited: John D'Errico
on 28 Mar 2017
Please use the comment capability to ask questions, rather than adding answers.
But surely this depends on your capability in writing C code. :) Note that these tools are already compiled code. Can you do better than someone who seriously does know what they are doing?
There is ONE way you can gain though. Use linsolve, and tell it that your matrix is lower triangular.
A = tril(rand(10000));
b = rand(10000,1);
opts.LT = true;
timeit(@() linsolve(A,b,opts))
ans =
0.057655
timeit(@() A\b)
ans =
0.12932
The point is if we tell linsolve in advance not to bother checking if the matrix has some special shape like lower triangular, then we can gain some speed. We can't tell backslash that. So backslash takes a fair amount of time just deciding how to solve the problem. If you know in advance something about the matrix, linsolve exists to let you use that information.
Bei Gou
on 28 Mar 2017
Bei Gou
on 30 Mar 2017
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!