Talk:LU decomposition: Difference between revisions
No edit summary |
|||
Line 19: | Line 19: | ||
I noticed this too. In the implementations it appears that the max pivot values are taken from the original A matrix without swapping. When the max pivot is being found for row 3 of A the choices presented are row 3 [3, 7, 18, 1] and row 4 [2, 5, 7, 1], since row 3 contains the largest pivot value the third row of the current permutation matrix is swapped with itself, which contains [0, 1, 0, 0] from the initial swap with row 2. It's strange, but a lot of the algorithm implementations seem to follow that trend and multiplying by the permutation matrix instead of swapping inline with the permutation matrix. |
I noticed this too. In the implementations it appears that the max pivot values are taken from the original A matrix without swapping. When the max pivot is being found for row 3 of A the choices presented are row 3 [3, 7, 18, 1] and row 4 [2, 5, 7, 1], since row 3 contains the largest pivot value the third row of the current permutation matrix is swapped with itself, which contains [0, 1, 0, 0] from the initial swap with row 2. It's strange, but a lot of the algorithm implementations seem to follow that trend and multiplying by the permutation matrix instead of swapping inline with the permutation matrix. |
||
I think the permutation matrix you proposed makes more sense as well. |
Revision as of 02:44, 16 December 2015
Python example contains error
The Python example has a divide by zero error for the matrix
b = [[1, 1, 1, 1], [1, 1, -1, -1], [1, -1, 0, 0], [0, 0, 1, -1]]
although a LUP decomposition exists: [1]
The permutation matrix has to be updated at each step, but that will make the code a lot more complicated.
Example 2 pivot matrix seems to be wrong
The pivot matrix in example 2 should also swap the last two rows of the current resulting pivoted matrix: A'(3, 3) = 2 while there is a 7 right beneath it. Here is the result of the multiplication of the two matrices on wolfram alpha
The pivot matrix I propose is {{1,0,0,0},{0,0,1,0},{0,0,0,1},{0,1,0,0}}.
I did not change the article because it seemed very strange that I would be the first to see this and I therefore wonder if I'm not wrong.
Re: Example 2 pivot matrix seems to be wrong
I noticed this too. In the implementations it appears that the max pivot values are taken from the original A matrix without swapping. When the max pivot is being found for row 3 of A the choices presented are row 3 [3, 7, 18, 1] and row 4 [2, 5, 7, 1], since row 3 contains the largest pivot value the third row of the current permutation matrix is swapped with itself, which contains [0, 1, 0, 0] from the initial swap with row 2. It's strange, but a lot of the algorithm implementations seem to follow that trend and multiplying by the permutation matrix instead of swapping inline with the permutation matrix.
I think the permutation matrix you proposed makes more sense as well.