
A = [1     100   2  0   0; 
     3     1000  1  4   0.1; 
     10    1     9  20  0.01;
     6     0     8  6   0;
     10000 0.1   1  5   1]

 [L,R] = NAME_LR(A)
 err = sum(sum(abs(L*R-A)))
 
 [P,L,R] = NAME_LR_mit_pivot(A)
 err = sum(sum(abs(L*R-P*A)))
 
 d  = 1./sum(A');
 DA = diag(d)*A
 
 [L,R] = NAME_LR(DA)
 err = sum(sum(abs(L*R-DA)))
 
 [P,L,R] = NAME_LR_mit_pivot(DA)
 err =  sum(sum(abs(L*R-P*DA)))

 
 B = A([1 2 3 5], [ 1 2 4 5])
 
 [L,R] = NAME_LR(B)
 err = sum(sum(abs(L*R-B)))
 
 [P,L,R] = NAME_LR_mit_pivot(B)
 err = sum(sum(abs(L*R-P*B)))
 
 d  = 1./sum(B');
 DB = diag(d)*B
 
 [L,R] = NAME_LR(DB)
 err =  sum(sum(abs(L*R-DB)))
 
 [P,L,R] = NAME_LR_mit_pivot(DB)
 err =  sum(sum(abs(L*R-P*DB)))


H=hilb(8)

 [L,R] = NAME_LR(H)
 err = sum(sum(abs(L*R-H)))
 
 [P,L,R] = NAME_LR_mit_pivot(H)
 err = sum(sum(abs(L*R-P*H)))

 d  = 1./sum(H');
 DH = diag(d)*H

 [L,R] = NAME_LR(DH)
 err =  sum(sum(abs(L*R-DH)))
 
 [P,L,R] = NAME_LR_mit_pivot(DH)
 err =  sum(sum(abs(L*R-P*DH)))
