# Singular

#### D.3.2.12 gaussred_pivot

Procedure from library `linalg.lib` (see linalg_lib).

Usage:
gaussred_pivot(A); A any constant matrix

Return:
list Z: Z[1]=P , Z[2]=U , Z[3]=S , Z[4]=rank(A)
gives a row reduced matrix S, a permutation matrix P and a normalized lower triangular matrix U, with P*A=U*S

Note:
with row pivoting

Example:
 ```LIB "linalg.lib"; ring r=0,(x),dp; matrix A[5][4] = 1, 3,-1,4, 2, 5,-1,3, 1, 3,-1,4, 0, 4,-3,1, -3,1,-5,-2; list Z=gaussred_pivot(A); //construct P,U,S s.t. P*A=U*S print(Z[1]); //P ==> 0,0,0,0,1, ==> 0,1,0,0,0, ==> 0,0,1,0,0, ==> 0,0,0,1,0, ==> 1,0,0,0,0 print(Z[2]); //U ==> 1, 0, 0, 0,0, ==> -2/3,1, 0, 0,0, ==> -1/3,10/17,1, 0,0, ==> 0, 12/17,-1/2,1,0, ==> -1/3,10/17,1, 0,1 print(Z[3]); //S ==> -3,1, -5, -2, ==> 0, 17/3,-13/3,5/3, ==> 0, 0, -2/17,40/17, ==> 0, 0, 0, 1, ==> 0, 0, 0, 0 print(Z[4]); //rank ==> 4 print(Z[1]*A); //P*A ==> -3,1,-5,-2, ==> 2, 5,-1,3, ==> 1, 3,-1,4, ==> 0, 4,-3,1, ==> 1, 3,-1,4 print(Z[2]*Z[3]); //U*S ==> -3,1,-5,-2, ==> 2, 5,-1,3, ==> 1, 3,-1,4, ==> 0, 4,-3,1, ==> 1, 3,-1,4 ```