How Does mldivide Work for Full, Square, Full Rank, Triangular Matrix?

3 ビュー (過去 30 日間)
Paul
Paul 2024 年 3 月 9 日
コメント済み: Christine Tobler 2024 年 3 月 13 日
How does mldivide work when the input matrix A is full, square, full rank, and triangular? The doc page just say it uses a triangular solver, and I'd like more insight into what that triangular solver is.
An iterative approach can be used, e.g., for a lower triangular A
A = [1 0 0;2 3 0;4 5 6];
b = [1; 2; 3];
% A*x = b
% solve for x(i) iteratively, could be easily done with a for loop
x(1) = b(1)/A(1,1);
x(2) = (b(2) - A(2,1)*x(1)) / A(2,2);
x(3) = (b(3) - A(3,1)*x(1) - A(3,2)*x(2)) / A(3,3);
A*x(:) - b
ans = 3×1
0 0 0
Does mldivide use a solver that's more efficient and/or more numerically robust?
  13 件のコメント
Bruno Luong
Bruno Luong 2024 年 3 月 12 日
編集済み: Bruno Luong 2024 年 3 月 12 日
My guess is that the warning during solving x=A\b is not alway triggered based on matrix conditioning number or matrix norm. Those are not cheap to compute.
Rather it's based first on eventual intermediate quantity computed while the linear solver algorithm does the work: smallest and largest diagonal elements of A if A is triangular form, and diagonal of R if QR decomposition is used (generic full matrix).
This code seems to indicate that
  1. substitution is used directly on T (small is compared to 1 for singularity detection) and
  2. QR is used on Tf (small is compared to norm([1; 1]) = sqrt(2) for singularity detection)
Christine Tobler
Christine Tobler 2024 年 3 月 13 日
Yes, rcond is not computed in x = A\b if A is triangular. This is because computing the approximate rcond value would be several times more expensive than solving the linear system itself. Instead, a heuristic based on the diagonal values of A is used.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by