I'm interested in the algorithm of LU decomposition in order to solve a LSE like $Ax=b$, where $A$ is a square matrix.
My question is: When I compute $PA=LU$ do I also need to interchange rows in $L$ whenever I interchange rows in $A$? It is clear, that I get $P$ by interchanging rows in $Id$ whenever I interchange rows in $A$, but is $L$ also affected?
Is it right that after that I need to solve $Lz = Pb$ and $Ux = z$?
To solve $Ax = b$, if $P A = LU$, then $LUx = Pb$:
a) compute $P A = LU$ factorization, saving $P$ info
b) solve $Ly = P b$, using forward substitution
c) solve $Ux = y$, using backward substitution.