|
"Petr Krysl" <pkryslNOSP@Mucsd.edu> wrote in message <gf040h$q78$1@fred.mathworks.com>...
> I understand that lu can return a psychologically triangular matrix when called with two output arguments. The question is, what does Matlab to to use the psychologically lower triangular matrix efficiently?
>
> In other words, let's say I do
> [L,U] =lu(A);
> to efficiently solve for many different right-hand sides b
> x=U\(L\b)
>
> How efficient is this going to be with L not being strictly lower triangular? Does Matlab somehow recognize that the matrix is psychologically lower triangular, and make note of it someplace for future use?
>
> I know that one could also collect the permutation matrix from Matlab. My question is to the reasoning behind returning just two matrices, with L being possibly not a nice triangular matrix.
>
> Thanks,
>
> Petr
>
When you do L\b, MATLAB looks at L to see if it is lower triangular, or upper, or psychologically lower or upper triangular. This check takes O(n^2) time (less for the sparse case). It does this check each time.
If you want you can use linsolve to save some time, and tell MATLAB what kind of matrix it is. I can't recall if you can tell linsolve that L is psychologically triangular though.
|