08-Jan-2022 09:19:15 row_echelon_integer_test(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Test row_echelon_integer() I4MAT_IS_INTEGER_TEST I4MAT_IS_INTEGER is TRUE if every entry of an I4MAT is an integer. Example 1: Obviously integer: a = 1 2 3 4 5 6 A is an integer matrix. Example 2: Obviously NOT integer: a = 1.0000 2.0000 3.0000 4.0000 5.0000 6.5000 A is NOT an integer matrix. Example 3: Not Integer, Not obvious: a = 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 A is NOT an integer matrix. Example 4: Not Integer, Not obvious: a = 1.0e+08 * 0.0000 0.0000 3.0000 0.0000 0.0000 0.0000 A is NOT an integer matrix. I4MAT_PRINT_TEST I4MAT_PRINT prints an I4MAT. The I4MAT: Col: 1 2 3 4 Row 1: 11 12 13 14 2: 21 22 23 24 3: 31 32 33 34 4: 41 42 43 44 5: 51 52 53 54 6: 61 62 63 64 I4MAT_PRINT_SOME_TEST I4MAT_PRINT_SOME prints some of an I4MAT. The I4MAT, rows 2:4, cols 1:2: Col: 1 2 Row 2: 21 22 3: 31 32 4: 41 42 I4MAT_REF_TEST I4MAT_REF computes the integer row echelon form of an I4MAT. Input 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 The pseudo-determinant = 6 IREF of A: Col: 1 2 3 4 5 6 7 Row 1: 1 3 0 2 6 3 1 2: 0 0 0 2 4 9 3 3: 0 0 0 0 0 3 1 4: 0 0 0 0 0 0 0 I4MAT_ROW_SWAP_TEST I4MAT_ROW_SWAP swaps two rows of an I4MAT. Input A: Col: 1 2 3 4 Row 1: 11 12 13 14 2: 21 22 23 24 3: 31 32 33 34 4: 41 42 43 44 5: 51 52 53 54 Swap rows 2 and 5 Modified matrix: Col: 1 2 3 4 Row 1: 11 12 13 14 2: 51 52 53 54 3: 31 32 33 34 4: 41 42 43 44 5: 21 22 23 24 I4MAT_RREF_TEST I4MAT_RREF computes the integer reduced row echelon form of an I4MAT. Input 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 The pseudo-determinant = 6 IRREF form: 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 I4MAT_RREF_SOLVE_BINARY_TEST: I4MAT_RREF_SOLVE_BINARY seeks binary solutions of an Integer Row-Reduced Echelon Form (IRREF) system A*x=b when A and b contain integer values. The IRREF matrix A: Col: 1 2 3 4 5 6 7 8 9 10 Row 1: 1 0 0 0 0 0 1 0 -1 0 2: 0 1 0 0 0 0 0 0 1 0 3: 0 0 1 0 0 0 1 0 -1 0 4: 0 0 0 1 0 0 0 0 1 1 5: 0 0 0 0 1 0 0 0 0 1 6: 0 0 0 0 0 1 -1 0 1 0 7: 0 0 0 0 0 0 0 1 0 -1 8: 0 0 0 0 0 0 0 0 0 0 9: 0 0 0 0 0 0 0 0 0 0 The right hand side b: 1: 0 2: 1 3: 0 4: 1 5: 1 6: 1 7: 0 8: 0 9: 0 Binary solution vectors x: Col: 1 2 3 4 Row 1: 0 0 1 0 2: 1 1 0 0 3: 0 0 1 0 4: 1 0 0 0 5: 1 0 1 1 6: 1 1 0 1 7: 0 0 0 1 8: 0 1 0 0 9: 0 0 1 1 10: 0 1 0 0 I4MAT_RREF_SOLVE_BINARY_NZ_TEST(): I4MAT_RREF_SOLVE_BINARY_NZ seeks binary solutions of an Integer Row-Reduced Echelon Form (IRREF) system A*x=b which have exactly NZ nonzeros. The IRREF matrix A: Col: 1 2 3 4 5 6 7 8 9 10 Row 1: 1 0 0 0 0 0 1 0 -1 0 2: 0 1 0 0 0 0 0 0 1 0 3: 0 0 1 0 0 0 1 0 -1 0 4: 0 0 0 1 0 0 0 0 1 1 5: 0 0 0 0 1 0 0 0 0 1 6: 0 0 0 0 0 1 -1 0 1 0 7: 0 0 0 0 0 0 0 1 0 -1 8: 0 0 0 0 0 0 0 0 0 0 9: 0 0 0 0 0 0 0 0 0 0 The right hand side b: 1: 0 2: 1 3: 0 4: 1 5: 1 6: 1 7: 0 8: 0 9: 0 Only consider binary solutions with exactly 4 nonzeros. Binary solution vectors x: Col: 1 2 3 4 Row 1: 0 1 0 0 2: 1 0 1 0 3: 0 1 0 0 4: 1 0 0 0 5: 1 1 0 1 6: 1 0 1 1 7: 0 0 0 1 8: 0 0 1 0 9: 0 1 0 1 10: 0 0 1 0 I4MAT_RREF_SYSTEM_TEST MATLAB version. I4MAT_RREF_SYSTEM computes the linear system associated with an integer reduced row echelon form of an I4MAT. Look at a "wide" matrix: Input A1: 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 The pseudo-determinant = 6 A2, the IRREF of A1: 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 B2, the right hand side: 1: 1 2: 1 3: 1 4: 0 The original system is CONSISTENT. A3, the augmented IRREF: Col: 1 2 3 4 5 6 7 Row 1: 1 3 0 0 2 0 0 2: 0 1 0 0 0 0 0 3: 0 0 1 0 0 0 0 4: 0 0 0 1 2 0 0 5: 0 0 0 0 1 0 0 6: 0 0 0 0 0 3 1 7: 0 0 0 0 0 0 1 B3, the augmented RHS: 1: 1 2: 0 3: 0 4: 1 5: 0 6: 1 7: 0 Indices of degrees of freedom. 1: 2 2: 3 3: 5 4: 7 Look at a "tall" matrix: Input A1: 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 The pseudo-determinant = 32 A2, the IRREF of A1: 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 B2, the right hand side: 1: 1 2: 1 3: 1 4: 1 5: 1 6: 1 7: 1 The original system is INCONSISTENT. A3, the augmented IRREF: 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 1 B3, the augmented RHS: 1: 1 2: 1 3: 1 4: 0 Indices of degrees of freedom. 1: 4 I4MAT_U_SOLVE_TEST I4MAT_U_SOLVE solves an upper triangular system A*x=b, where A and b contain only integer values. Input matrix A: Col: 1 2 3 4 Row 1: 1 2 4 7 2: 0 3 5 8 3: 0 0 6 9 4: 0 0 0 10 Right hand side b: 1: 45 2: 53 3: 54 4: 40 Integer solution x: 1: 1 2: 2 3: 3 4: 4 Norm of A*x-b = 0 I4VEC_BINARY_NEXT_TEST I4VEC_BINARY_NEXT generates the next binary vector. 000 001 010 011 100 101 110 111 I4VEC_IDENTITY_ROW_TEST I4VEC_IDENTITY_ROW returns a row of the identity matrix. 0: 0 0 0 0 0 1: 1 0 0 0 0 2: 0 1 0 0 0 3: 0 0 1 0 0 4: 0 0 0 1 0 5: 0 0 0 0 1 6: 0 0 0 0 0 I4VEC_IS_BINARY_TEST I4VEC_IS_BINARY is TRUE if an I4VEC only contains 0 or 1 entries. X: 0 0 0 X is binary X: 1 0 1 X is binary X: 0 2 1 X is NOT binary. I4VEC_PRINT_TEST I4VEC_PRINT prints an I4VEC The I4VEC: 1: 91 2: 92 3: 93 4: 94 I4VEC_RED_TEST I4VEC_RED divides out any common factors in the entries of an I4VEC. Apply I4VEC_RED to each row of this matrix: Col: 1 2 3 Row 1: 12 88 9 2: 4 8 192 3: -12 88 94 4: 30 18 42 5: 0 4 8 Reduced matrix: Col: 1 2 3 Row 1: 12 88 9 2: 1 2 48 3: -6 44 47 4: 5 3 7 5: 0 1 2 I4VEC_TRANSPOSE_PRINT_TEST I4VEC_TRANSPOSE_PRINT prints an I4VEC with 5 entries to a row, and a title. Output from I4VEC_PRINT: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 11: 11 12: 12 My array: 1 2 3 4 5 6 7 8 9 10 11 12 KSUB_NEXT4_TEST KSUB_NEXT4 generates K subsets of an N set. N = 5 K = 3 Rank Subset 1 1 2 3 2 1 2 4 3 1 3 4 4 2 3 4 5 1 2 5 6 1 3 5 7 2 3 5 8 1 4 5 9 2 4 5 10 3 4 5 R8VEC_IS_INTEGER_TEST R8VEC_IS_INTEGER is TRUE if every entry of an R8VEC is an integer. Example 1: Obviously integer: a = 1 2 3 4 5 6 A is an integer vector. Example 2: Obviously NOT integer: a = 1.0000 2.0000 3.0000 4.0000 5.0000 6.5000 A is NOT an integer vector. Example 3: Not Integer, Not obvious: a = 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 A is NOT an integer vector. Example 4: Not Integer, Not obvious: a = 1.0e+08 * 0.0000 0.0000 3.0000 0.0000 0.0000 0.0000 A is NOT an integer vector. R8VEC_PRINT_TEST R8VEC_PRINT prints an R8VEC. The R8VEC: 1: 123.456 2: 5e-06 3: -1e+06 4: 3.14159 R8VEC_TRANSPOSE_PRINT_TEST R8VEC_TRANSPOSE_PRINT prints an R8VEC "tranposed", that is, placing multiple entries on a line. The vector X: 1 2.2 -3.3 4.45 5.678 600 0.0078 8.123 9.45 10.03 11.1 12.99 row_echelon_integer_test(): Normal end of execution. 08-Jan-2022 09:19:16