LU factorization for rectangular matrix seems incomplete

The following example shows 3x4 maxtrix lu factorization in MATLAB seems incomplete.
MATLAB's answer for u is [1 3 3 2; 0 0 3 3; 0 0 6 6].
The answer in the text book (Gilbert Strang) is [1 3 3 2; 0 0 3 3; 0 0 0 0].
Is thera a way to get the same answer as the one from the text book through MATLAB?
----------------------------------------------------------------------------------------------------------
a =
[ 1, 3, 3, 2]
[ 2, 6, 9, 7]
[ -1, -3, 3, 4]
>> [l,u,p]=lu(a)
l =
[ 1, 0, 0]
[ 2, 1, 0]
[ -1, 0, 1]
u =
[ 1, 3, 3, 2]
[ 0, 0, 3, 3]
[ 0, 0, 6, 6]
p =
1 0 0
0 1 0
0 0 1

6 件のコメント

Bruno Luong
Bruno Luong 2018 年 11 月 18 日
編集済み: Bruno Luong 2018 年 11 月 18 日
Are you runing MATLAB or something else? Your formatting seems not to be MATLAB and your result does not match mine (R2018a).
a
a =
1 3 3 2
2 6 9 7
-1 -3 3 4
>> [l,u,p]=lu(a)
l =
1.000000000000000 0 0
0.500000000000000 1.000000000000000 0
-0.500000000000000 0 1.000000000000000
u =
2.000000000000000 6.000000000000000 9.000000000000000 7.000000000000000
0 0 -1.500000000000000 -1.500000000000000
0 0 7.500000000000000 7.500000000000000
p =
0 1 0
1 0 0
0 0 1
Soo Chang Choe
Soo Chang Choe 2018 年 11 月 18 日
run 'a = sym(a);' before lu() function. You will get the same format.
However, your numerical results also have the same problem. U's last row should be [0 0 0 0], but it is not.
Bruno Luong
Bruno Luong 2018 年 11 月 18 日
Why there is "problem" or "incomplete"? It's upper triangular as advertised.
For your information LU factorization is not unique.
Soo Chang Choe
Soo Chang Choe 2018 年 11 月 19 日
編集済み: Soo Chang Choe 2018 年 11 月 19 日
Mathematically it is not a problem or incomplete. But is there a built-in matlab funciton that gives me the same answer as can be found in the text book? I don't understand why it stopped pivoting at the second row.
Bruno Luong
Bruno Luong 2018 年 11 月 19 日
編集済み: Bruno Luong 2018 年 11 月 19 日
"I don't understand why it stopped pivoting at the second row."
It does NOT stop, at the second step it pivots at the diagonal elements which is 0 for both row 2 and 3 (draw) so it picks row 2. Elements above/on the right the diagonal of u are not supposed to play any role.
In your book it selects row 3, but it is just a choise, without any additional usefulness for what it design for: solving linear system.
Both are equally valid.
Soo Chang Choe
Soo Chang Choe 2018 年 11 月 19 日
Hello Bruno,
I wanted to use MATLAB to check my answer when studying the text book.
It seems that I have to build my own funciton to get the answer that the book expects for now.
As you said, I am convinced that MATLAB is generating valid answers for LU decomposition.
Many thanks for your reply and answer.

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

質問済み:

2018 年 11 月 18 日

コメント済み:

2018 年 11 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by