07-Jan-2022 21:50:23 i4mat_rref2_test(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 i4mat_rref2() computes the reduced row echelon form of an augmented integer matrix. Test 1, just get the IRREF. Matrix A: Col: 1 2 3 4 5 6 7 Row 1: 1 3 0 2 6 3 1 2: -2 -6 0 -2 -8 3 1 3: 3 9 0 0 6 6 2 4: -1 -3 0 1 0 9 3 A has rank 3 RREF of A: Col: 1 2 3 4 5 6 7 Row 1: 1 3 0 0 2 0 0 2: 0 0 0 1 2 0 0 3: 0 0 0 0 0 3 1 4: 0 0 0 0 0 0 0 Test 2, look for inconsistency. Matrix A: Col: 1 2 3 4 Row 1: 1 -2 3 -1 2: 3 -6 9 -3 3: 0 0 0 0 4: 2 -2 0 1 5: 6 -8 6 0 6: 3 3 6 9 7: 1 1 2 3 RHS b1: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 5 7: 7 RHS b2: 1: 4 2: 12 3: 0 4: 2 5: 12 6: 9 7: 3 A has rank 3 RREF of A Col: 1 2 3 4 Row 1: 16 0 0 29 2: 0 16 0 21 3: 0 0 16 -1 4: 0 0 0 0 5: 0 0 0 0 6: 0 0 0 0 7: 0 0 0 0 A|b1 has rank 4 RREF of A|b1 Col: 1 2 3 4 5 Row 1: 16 0 0 29 0 2: 0 16 0 21 0 3: 0 0 16 -1 0 4: 0 0 0 0 1 5: 0 0 0 0 0 6: 0 0 0 0 0 7: 0 0 0 0 0 Linear system A*x=b1 is INCONSISTENT. A|b2 has rank 3 RREF of A|b2 Col: 1 2 3 4 5 Row 1: 16 0 0 29 16 2: 0 16 0 21 0 3: 0 0 16 -1 16 4: 0 0 0 0 0 5: 0 0 0 0 0 6: 0 0 0 0 0 7: 0 0 0 0 0 Linear system A*x=b1 is CONSISTENT. Right hand side of A_rref*x_rref=b1_rref: 1: 16 2: 0 3: 16 4: 0 5: 0 6: 0 7: 0 Solution of A*x=b2: 1: 1 2: 0 3: 1 4: 0 Test 3, inverse. A_inv * A: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 0 1 0 0 3 : 0 0 1 0 4 : 0 0 0 1 i4mat_rref2_test(): Normal end of execution. 07-Jan-2022 21:50:24