n = 5; k =3;
A = rand(n)+5*eye(n)
Atl = A(1:k, 1:k)
LUtl=lu(Atl)
Ltl=tril(LUtl,-1)+eye(k);
Utl=triu(LUtl)
norm( Ltl*Utl - Atl )
LU=lu(A)
L=tril(LU,-1)+eye(n);
U=triu(LU);
Ltl
L
Utl
U
Atr = A(1:k, k+1:end)
Utr = Ltl\Atr
U
Abl = A(k+1:end, 1:k)
Lbl = Abl/Utl
L
Abr = A(k+1:end, k+1:end)
Lbl
Utr
Abr = Abr - Lbl*Utr
lu(Abr)
L(k+1:end, k+1:end)
U(k+1:end, k+1:end)

