Sat Jul 23 15:59:10 2022 i4lib_test(): Python version: 3.6.9 Test i4lib(). gamma_log_values: gamma_log_values stores values of the logarithm of the Gamma function. X gamma_log(X) 0.200000 1.5240638224307841 0.400000 0.7966778177017837 0.600000 0.3982338580692348 0.800000 0.1520596783998375 1.000000 0.0000000000000000 1.100000 -0.0498724412598397 1.200000 -0.0853740900033158 1.300000 -0.1081748095078604 1.400000 -0.1196129141723712 1.500000 -0.1207822376352452 1.600000 -0.1125917656967557 1.700000 -0.0958076974070659 1.800000 -0.0710838729143722 1.900000 -0.0389842759230833 2.000000 0.0000000000000000 3.000000 0.6931471805599453 4.000000 1.7917594692280550 10.000000 12.8018274800814691 20.000000 39.3398841871994946 30.000000 71.2570389671680147 i4_abs_test(): i4_abs computes the absolute value of an I4. A B=i4_abs(A) 45 45 1 1 95 95 -79 79 45 45 -53 53 -100 100 -49 49 -79 79 -23 23 i4_and_test(): i4_and returns the AND of two I4's. I J i4_and I&J 56 85 16 16 30 32 0 0 8 89 8 8 72 67 64 64 26 29 24 24 67 39 3 3 68 85 68 68 26 25 24 24 48 3 0 0 49 13 1 1 i4_bclr_test(): i4_bclr sets a given bit to 0. Working on I4 = 101 Pos i4_bclr(I4,Pos) 0 100 1 101 2 97 3 101 4 101 5 69 6 37 7 101 8 101 9 101 10 101 11 101 12 101 13 101 14 101 15 101 16 101 17 101 18 101 19 101 20 101 21 101 22 101 23 101 24 101 25 101 26 101 27 101 28 101 29 101 30 101 31 101 Working on I4 = -31 Pos i4_bclr(I4,Pos) 0 -32 1 -31 2 -31 3 -31 4 -31 5 -63 6 -95 7 -159 8 -287 9 -543 10 -1055 11 -2079 12 -4127 13 -8223 14 -16415 15 -32799 16 -65567 17 -131103 18 -262175 19 -524319 20 -1048607 21 -2097183 22 -4194335 23 -8388639 24 -16777247 25 -33554463 26 -67108895 27 -134217759 28 -268435487 29 -536870943 30 -1073741855 31 2147483617 i4_bit_hi1_test(): i4_bit_hi1 returns the location of the high 1 bit. I i4_bit_hi1(I) 25 5 32 6 21 5 80 7 48 6 3 2 46 6 4 3 27 5 14 4 i4_bit_lo0_test(): i4_bit_lo0 returns the location of the low 0 bit. I i4_bit_lo0(I) 50 1 78 1 21 2 91 3 19 3 100 1 95 6 22 1 93 2 2 1 i4_bit_lo1_test(): i4_bit_lo1 returns the location of the low 1 bit. I i4_bit_lo1(I) 99 1 12 3 7 1 51 1 15 1 22 2 29 1 54 2 85 1 57 1 i4_bit_reverse_test(): i4_bit_reverse bit reverses I with respect to 2^J. I J i4_bit_reverse(I,J) 0 0 0 0 1 0 1 1 1 0 2 0 1 2 2 2 2 1 3 2 3 0 3 0 1 3 4 2 3 2 3 3 6 4 3 1 5 3 5 6 3 3 7 3 7 0 4 0 1 4 8 2 4 4 3 4 12 4 4 2 5 4 10 6 4 6 7 4 14 8 4 1 9 4 9 10 4 5 11 4 13 12 4 3 13 4 11 14 4 7 15 4 15 i4_bset_test(): i4_bset sets a given bit to 1. Working on I4 = 101 Pos i4_bset(I4,Pos) 0 101 1 103 2 101 3 109 4 117 5 101 6 101 7 229 8 357 9 613 10 1125 11 2149 12 4197 13 8293 14 16485 15 32869 16 65637 17 131173 18 262245 19 524389 20 1048677 21 2097253 22 4194405 23 8388709 24 16777317 25 33554533 26 67108965 27 134217829 28 268435557 29 536871013 30 1073741925 31 -2147483547 Working on I4 = -31 Pos i4_bset(I4,Pos) 0 -31 1 -29 2 -27 3 -23 4 -15 5 -31 6 -31 7 -31 8 -31 9 -31 10 -31 11 -31 12 -31 13 -31 14 -31 15 -31 16 -31 17 -31 18 -31 19 -31 20 -31 21 -31 22 -31 23 -31 24 -31 25 -31 26 -31 27 -31 28 -31 29 -31 30 -31 31 -31 i4_btest_test(): i4_btest reports whether a given bit is 0 or 1. Analyze the integer I4 = 101 Pos i4_btest(I4,POS) 0 True 1 False 2 True 3 False 4 False 5 True 6 True 7 False 8 False 9 False 10 False 11 False 12 False 13 False 14 False 15 False 16 False 17 False 18 False 19 False 20 False 21 False 22 False 23 False 24 False 25 False 26 False 27 False 28 False 29 False 30 False 31 False Analyze the integer I4 = -31 Pos i4_btest(I4,POS) 0 True 1 False 2 False 3 False 4 False 5 True 6 True 7 True 8 True 9 True 10 True 11 True 12 True 13 True 14 True 15 True 16 True 17 True 18 True 19 True 20 True 21 True 22 True 23 True 24 True 25 True 26 True 27 True 28 True 29 True 30 True 31 True i4_ceiling_test(): i4_ceiling evaluates the "ceiling" of a real number. R8 i4_ceiling(R8) -57.1524 -57 7.7524 8 31.2944 32 78.2279 79 -89.0847 -89 -39.4735 -39 -56.2887 -56 25.1243 26 84.9191 85 -45.8336 -45 i4_characteristic_test(): i4_characteristic computes the characteristic of an integer Q, which is Q if Q is prime; P, if Q = P^N for some prime P; 0, if Q is negative, 0, 1, or the product of more than 1 distinct prime. I i4_characteristic 1 0 2 2 3 3 4 2 5 5 6 0 7 7 8 2 9 3 10 0 11 11 12 0 13 13 14 0 15 0 16 2 17 17 18 0 19 19 20 0 21 0 22 0 23 23 24 0 25 5 26 0 27 3 28 0 29 29 30 0 31 31 32 2 33 0 34 0 35 0 36 0 37 37 38 0 39 0 40 0 41 41 42 0 43 43 44 0 45 0 46 0 47 47 48 0 49 7 50 0 i4_choose_test(): i4_choose() evaluates C(N,K). N K CNK 0 0 1 1 0 1 1 1 1 2 0 1 2 1 2 2 2 1 3 0 1 3 1 3 3 2 3 3 3 1 4 0 1 4 1 4 4 2 6 4 3 4 4 4 1 i4_choose_check_test(): i4_choose_check checks whether C(N,K) can be computed with integer arithmetic or not. N K CHECK? i4_choose 10 3 1 120 1000 999 1 1000 100 3 1 161700 100 10 0 Not computable i4_choose_log_test(): i4_choose_log evaluates log(C(N,K)). N K lcnk elcnk CNK 0 0 0 1 1 1 0 0 1 1 1 1 0 1 1 2 0 0 1 1 2 1 0.693147 2 2 2 2 0 1 1 3 0 0 1 1 3 1 1.09861 3 3 3 2 1.09861 3 3 3 3 0 1 1 4 0 0 1 1 4 1 1.38629 4 4 4 2 1.79176 6 6 4 3 1.38629 4 4 4 4 0 1 1 i4_div_rounded_test(): i4_div_rounded performs rounded integer division. C0 = real ( a ) / real ( b ) C1 = i4_div_rounded ( A, B ) C2 = nint ( real ( a ) / real ( b ) ) C3 = int ( A / B ) C4 = floor ( real ( a ) / real ( b ) ) C5 = a // b C1 and C2 should be equal; C3 and C4 should be equal. A B C0 C1 C2 C3 C4 C5 -4 -4 1.000000 1 1 1 1 1 81 -2 -40.500000 -40 -40 -40 -41 -41 61 -9 -6.777778 -7 -7 -6 -7 -7 -77 5 -15.400000 -15 -15 -15 -16 -16 -11 2 -5.500000 -5 -6 -5 -6 -6 -49 -2 24.500000 24 24 24 24 24 -56 -4 14.000000 14 14 14 14 14 45 -6 -7.500000 -7 -8 -7 -8 -8 23 -1 -23.000000 -23 -23 -23 -23 -23 -35 -6 5.833333 6 6 5 5 5 -7 2 -3.500000 -3 -4 -3 -4 -4 -34 10 -3.400000 -3 -3 -3 -4 -4 -83 6 -13.833333 -14 -14 -13 -14 -14 85 7 12.142857 12 12 12 12 12 -50 5 -10.000000 -10 -10 -10 -10 -10 66 -1 -66.000000 -66 -66 -66 -66 -66 52 9 5.777778 6 6 5 5 5 -6 -1 6.000000 6 6 6 6 6 74 -9 -8.222222 -8 -8 -8 -9 -9 i4_division_test(): i4_division performs integer division. C0 = real ( a ) / real ( b ) C1 = i4_division ( A, B ) C2 = nint ( real ( a ) / real ( b ) ) C3 = int ( A / B ) C4 = floor ( real ( a ) / real ( b ) ) C5 = a // b C1 and C3 and C4 and C5 should be equal. (They are not, for some negative cases!) C2 may differ; A B C0 C1 C2 C3 C4 C5 94 6 15.666667 15 16 15 15 15 -67 -5 13.400000 13 13 13 13 13 50 -1 -50.000000 -50 -50 -50 -50 -50 0 4 0.000000 0 0 0 0 0 -20 7 -2.857143 -2 -3 -2 -3 -3 19 1 19.000000 19 19 19 19 19 -100 4 -25.000000 -25 -25 -25 -25 -25 73 7 10.428571 10 10 10 10 10 5 -4 -1.250000 -1 -1 -1 -2 -2 -27 1 -27.000000 -27 -27 -27 -27 -27 30 5 6.000000 6 6 6 6 6 -97 -1 97.000000 97 97 97 97 97 -20 2 -10.000000 -10 -10 -10 -10 -10 -45 4 -11.250000 -11 -11 -11 -12 -12 83 -2 -41.500000 -41 -42 -41 -42 -42 97 8 12.125000 12 12 12 12 12 -34 -10 3.400000 3 3 3 3 3 44 1 44.000000 44 44 44 44 44 3 1 3.000000 3 3 3 3 3 i4_divp_test(): i4_divp(A,B) returns the smallest multiplier of J that is less than I A B C D 40 7 6 42 -83 9 -9 -81 89 1 89 89 -51 7 -7 -49 -72 9 -8 -72 22 8 3 24 -63 4 -15 -60 -66 -10 7 -70 79 -7 -11 77 51 -8 -6 48 -90 3 -30 -90 13 5 3 15 -52 2 -26 -52 -53 -8 7 -56 -45 7 -6 -42 -28 4 -7 -28 -78 9 -8 -72 -68 8 -8 -64 -22 -3 8 -24 -70 2 -35 -70 i4_factorial_test(): i4_factorial evaluates the factorial function. N Exact i4_factorial(N) 0 1 1 1 1 1 2 2 2 3 6 6 4 24 24 5 120 120 6 720 720 7 5040 5040 8 40320 40320 9 362880 362880 10 3628800 3628800 11 39916800 39916800 12 479001600 479001600 i4_factorial_log_test(): i4_factorial_log evaluates the log(N!). N lfact elfact fact 0 0 1 1 1 0 1 1 2 0.693147 2 2 3 1.79176 6 6 4 3.17805 24 24 5 4.78749 120 120 6 6.57925 720 720 7 8.52516 5040 5040 8 10.6046 40320 40320 9 12.8018 362880 362880 10 15.1044 3.6288e+06 3628800 11 17.5023 3.99168e+07 39916800 12 19.9872 4.79002e+08 479001600 i4_factorial2_test(): i4_factorial2 evaluates the double factorial function. N Exact i4_factorial2(N) 0 1 1 1 1 1 2 2 2 3 3 3 4 8 8 5 15 15 6 48 48 7 105 105 8 384 384 9 945 945 10 3840 3840 11 10395 10395 12 46080 46080 13 135135 135135 14 645120 645120 15 2027025 2027025 i4_fall_test(): i4_fall evaluates the falling factorial Fall(I,N). M N Exact i4_fall(M,N) 5 0 1 1 5 1 5 5 5 2 20 20 5 3 60 60 5 4 120 120 5 5 120 120 5 6 0 0 50 0 1 1 10 1 10 10 4000 1 4000 4000 10 2 90 90 18 3 4896 4896 4 4 24 24 98 3 912576 912576 1 7 0 0 i4_floor_test(): i4_floor evaluates the "floor" of a real number. R8 i4_floor(R8) 2.2927 2 59.7146 59 45.5927 45 77.8502 77 51.7161 51 -24.2218 -25 -13.0392 -14 61.5612 61 23.5053 23 32.5363 32 i4_gcd_test(): i4_gcd computes the greatest common factor I J i4_gcd 36 30 6 49 -7 7 0 71 71 12 12 12 36 49 1 1 42 1 91 28 7 i4_gcdb_test(): i4_gcdb computes the greatest common factor of the form K^N. I J K i4_gcdb 288 2880 2 32 288 2880 3 9 288 2880 4 16 288 2880 5 1 i4_huge_test(): i4_huge() returns a huge integer. i4_huge() = 2147483647 i4_huge_normalizer_test(): i4_huge_normalizer() returns 1/(i4_huge+1). i4_huge() = 2147483647 i4_huge_normalizer() = 4.65661e-10 i4_huge * i4_huge_normalizer = 1 i4_is_even_test(): i4_is_even() reports whether an I4 is even. I i4_is_even(I) -2 True -1 False 0 True 1 False 2 True 3 False 4 True 5 False 6 True 7 False 8 True 9 False 10 True 11 False 12 True 13 False 14 True 15 False 16 True 17 False 18 True 19 False 20 True 21 False 22 True 23 False 24 True 25 False i4_is_integer_test(): i4_is_integer() is True if the argument has an integer value. arg i4_is_integer(arg) 3.141592653589793 False (1+2j) False (3+0j) True 2.220446049250313e-16 False 3.0 True 0 True -17 True inf False nan False i4_is_odd_test(): i4_is_odd() reports whether an I4 is odd. I i4_is_odd(I) -2 False -1 True 0 False 1 True 2 False 3 True 4 False 5 True 6 False 7 True 8 False 9 True 10 False 11 True 12 False 13 True 14 False 15 True 16 False 17 True 18 False 19 True 20 False 21 True 22 False 23 True 24 False 25 True i4_is_power_of_2_test(): i4_is_power_of_2() reports whether an I4 is a power of 2. I i4_is_power_of_2(I) -4 False -3 False -2 False -1 False 0 False 1 True 2 True 3 False 4 True 5 False 6 False 7 False 8 True 9 False 10 False 11 False 12 False 13 False 14 False 15 False 16 True 17 False 18 False 19 False 20 False 21 False 22 False 23 False 24 False 25 False i4_is_power_of_10_test(): i4_is_power_of_10() reports whether an I4 is a power of 10. I i4_is_power_of_10(I) 97 False 98 False 99 False 100 True 101 False 102 False 103 False i4_is_prime_test(): i4_is_prime() reports whether an I4 is prime. I i4_is_prime(I) -2 False -1 False 0 False 1 False 2 True 3 True 4 False 5 True 6 False 7 True 8 False 9 False 10 False 11 True 12 False 13 True 14 False 15 False 16 False 17 True 18 False 19 True 20 False 21 False 22 False 23 True 24 False 25 False i4_lcm_test(): i4_lcm() computes the least common multiple. I J i4_lcm 36 30 180 49 -7 49 0 71 0 12 12 12 36 49 1764 1 42 42 91 28 364 i4_lcm_12n_test(): i4_lcm_12n() computes the least common multiple of integer 1 through N N i4_lcm_12n 1 1 2 2 3 6 4 12 5 60 6 60 7 420 8 420 9 1260 10 1260 i4_log_10_test(): i4_log_10() returns the whole part of log base 10, X, i4_log_10 0 0 1 0 2 0 3 0 9 0 10 1 11 1 99 1 101 2 -1 0 -2 0 -3 0 -9 0 i4_log_2_test(): i4_log_2() returns the whole part of log base 2. X i4_log_2 0 0 1 0 2 1 3 1 9 3 10 3 11 3 99 6 101 6 -1 0 -2 1 -3 1 -9 3 1000 9 1023 9 1024 10 1025 10 i4_log_i4_test(): i4_log_i4() returns logarithm of I4 base J4, I4 J4 i4_log_i4 0 2 0 1 2 0 2 2 1 3 2 1 4 2 2 5 2 2 6 2 2 7 2 2 8 2 3 9 2 3 10 2 3 0 3 0 1 3 0 2 3 0 3 3 1 4 3 1 5 3 1 6 3 1 7 3 1 8 3 1 9 3 2 10 3 2 0 4 0 1 4 0 2 4 0 3 4 0 4 4 1 5 4 1 6 4 1 7 4 1 8 4 1 9 4 1 10 4 1 0 5 0 1 5 0 2 5 0 3 5 0 4 5 0 5 5 1 6 5 1 7 5 1 8 5 1 9 5 1 10 5 1 i4_log_r8_test(): i4_log_r8() returns whole part of log base B, X B i4_log_r8 16 2.000000 3 16 3.000000 2 16 4.000000 1 16 5.000000 1 16 6.000000 1 16 7.000000 1 16 8.000000 1 16 16.000000 0 16 32.000000 0 16 256.000000 0 i4_mant_test(): i4_mant() decomposes an integer. Number to be decomposed is X = -314.159000 X = -1 * ( 2763371787763843 / 2251799813685248 ) * 2 ^ (8) i4_max_test(): i4_max() computes the maximum of two I4's. A B C=i4_max(A,B) 75 -41 75 -24 -77 -24 -27 43 43 16 32 32 83 81 83 41 62 62 63 44 63 -88 69 69 -68 17 17 2 -84 2 i4_min_test(): i4_min() computes the minimum of two I4's. A B C=i4_min(A,B) 85 15 15 24 12 12 -12 -73 -73 -44 -50 -50 87 24 24 -67 -51 -67 -51 0 -51 95 20 20 -30 72 -30 -20 82 -20 i4_moddiv_test(): i4_moddiv() factors a number into a multiple M and a remainder R. Number Divisor Multiple Remainder 107 50 2 7 107 -50 -3 -43 -107 50 -3 43 -107 -50 2 -7 Repeat using Python % Operator: 107 50 2 7 107 -50 -3 -43 -107 50 -3 43 -107 -50 2 -7 i4_modp_test(): i4_modp() factors a number into a multiple M and a positive remainder R. Number Divisor Multiple Remainder 107 50 2 7 107 -50 -2 7 -107 50 -3 43 -107 -50 3 43 Repeat using Python % Operator: 107 50 2 7 107 -50 -3 -43 -107 50 -3 43 -107 -50 2 -7 i4_mop_test(): i4_mop() computes a minus-one-power (-1)^I. I4 i4_mop(I4) -414448 1 -189377 -1 -660572 1 40692 1 471210 1 862156 1 -871545 -1 -171248 1 -202859 -1 579593 -1 i4_not_test(): i4_not() returns the NOT of an I4 with respect to a value J. I J i4_not ~I+J+1 81 255 174 174 43 255 212 212 66 255 189 189 58 255 197 197 16 255 239 239 88 255 167 167 21 255 234 234 77 255 178 178 95 255 160 160 94 255 161 161 i4_or_test(): i4_or() returns the bitwise inclusive OR of two I4's. I J i4_or I|J 33 38 39 39 37 94 127 127 42 92 126 126 17 37 53 53 19 22 23 23 41 32 41 41 4 9 13 13 58 26 58 58 65 29 93 93 52 84 116 116 i4_power_test(): i4_power() computes I^J I J i4_power(I,J) 0 1 0 1 2 1 2 3 8 3 3 27 10 3 1000 -1 4 1 -2 5 -32 i4_rise_test(): i4_rise() evaluates the rising factorial Fall(I,N). M N Exact i4_rise(M,N) 5 0 1 1 5 1 5 5 5 2 30 30 5 3 210 210 5 4 1680 1680 5 5 15120 15120 5 6 151200 151200 50 0 1 1 10 1 10 10 4000 1 4000 4000 10 2 110 110 18 3 6840 6840 4 4 840 840 98 3 970200 970200 1 7 5040 5040 i4_sign_test(): i4_sign() returns the sign of an I4. I4 i4_sign(I4) -10 -1 -7 -1 0 1 5 1 9 1 i4_sign3_test(): i4_sign3() returns the three-way sign of an I4. I4 i4_sign3(I4) -10 -1 -7 -1 0 0 5 1 9 1 i4_swap_test(): i4_swap() swaps two I4's. Before swapping: I = 1 J = 202 After swapping: I = 202 J = 1 i4_swap3_test(): i4_swap3() swaps three I4's. Starting with (I,J,K), swap 3 times. 1 202 3003003 202 3003003 1 3003003 1 202 1 202 3003003 i4_to_angle_test(): i4_to_angle() converts an I4 to an angle in degrees. The angles sample the circle at finer levels. I4 ANGLE 0 0 1 120 2 240 3 60 4 180 5 300 6 30 7 90 8 150 9 210 10 270 11 330 12 15 13 45 14 75 15 105 i4_to_halton_test(): i4_to_halton() computes a Halton sequence. The user specifies all data explicitly. In this test, we call i4_to_halton repeatedly. We use distinct primes as bases. I R(0) R(1) R(2) 0 0.0000 0.0000 0.0000 1 0.6667 0.3750 0.2083 2 0.3333 0.7500 0.4167 3 1.0000 0.1250 0.6250 4 0.1667 0.5000 0.8333 5 0.8333 0.8750 0.0417 6 0.5000 0.2500 0.2500 7 1.1667 0.6250 0.4583 8 0.0833 1.0000 0.6667 9 0.7500 0.0417 0.8750 10 0.4167 0.4167 0.0833 i4_to_isbn_test(): i4_to_isbn() converts an I4 digit to an ISBN symbol. I4 S 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 X i4_to_l4_test(): i4_to_l4 converts an I4 to an L4. I4 L4 -5 True -4 True -3 True -2 True -1 True 0 False 1 True 2 True 3 True 4 True 5 True i4_to_pascal_test(): i4_to_pascal converts a linear index to Pascal triangle indices. K => I J 1 0 0 2 1 0 3 0 1 4 2 0 5 1 1 6 0 2 7 3 0 8 2 1 9 1 2 10 0 3 11 4 0 12 3 1 13 2 2 14 1 3 15 0 4 16 5 0 17 4 1 18 3 2 19 2 3 20 1 4 i4_to_pascal_degree_test(): i4_to_pascal_degree converts a linear index to the degree of the corresponding Pascal triangle indices. K => D 1 0 2 1 3 1 4 2 5 2 6 2 7 3 8 3 9 3 10 3 11 4 12 4 13 4 14 4 15 4 16 5 17 5 18 5 19 5 20 5 i4_to_triangle_lower_test(): i4_to_triangle_lower converts a linear index to a lower triangular one. K ==> ( I J ) 1 1 1 2 2 1 3 2 2 4 3 1 5 3 2 6 3 3 7 4 1 8 4 2 9 4 3 10 4 4 11 5 1 12 5 2 13 5 3 14 5 4 15 5 5 16 6 1 17 6 2 18 6 3 19 6 4 20 6 5 i4_to_triangle_upper_test(): i4_to_triangle_upper converts a linear index to an upper triangular one. K ==> ( I J ) 1 1 1 2 1 2 3 2 2 4 1 3 5 2 3 6 3 3 7 1 4 8 2 4 9 3 4 10 4 4 11 1 5 12 2 5 13 3 5 14 4 5 15 5 5 16 1 6 17 2 6 18 3 6 19 4 6 20 5 6 i4_uniform_ab_test(): i4_uniform_ab computes pseudorandom values in an interval [A,B]. The lower endpoint A = -100 The upper endpoint B = 200 The initial seed is 123456789 1 -35 2 187 3 149 4 69 5 25 6 -81 7 -23 8 -67 9 -87 10 90 11 -82 12 35 13 20 14 127 15 139 16 -100 17 170 18 5 19 -72 20 -96 i4_unswap3_test(): i4_unswap3 swaps three I4's. It can also reverse the effect of i4_swap3. Starting with (I,J,K), unswap 3 times. 1 202 3003003 3003003 1 202 202 3003003 1 1 202 3003003 Start with (I,J,K), swap, then unswap. 1 202 3003003 202 3003003 1 1 202 3003003 i4_walsh_1d_test(): i4_walsh_1d evaluates 1D Walsh functions. X +2 +1 0 -1 -2 -3 0.000000 0 0 0 0 0 0 0.250000 0 0 0 0 1 0 0.500000 0 0 0 1 0 0 0.750000 0 0 0 1 1 0 1.000000 0 0 1 0 0 0 1.250000 0 0 1 0 1 0 1.500000 0 0 1 1 0 0 1.750000 0 0 1 1 1 0 2.000000 0 1 0 0 0 0 2.250000 0 1 0 0 1 0 2.500000 0 1 0 1 0 0 2.750000 0 1 0 1 1 0 3.000000 0 1 1 0 0 0 3.250000 0 1 1 0 1 0 3.500000 0 1 1 1 0 0 3.750000 0 1 1 1 1 0 4.000000 1 0 0 0 0 0 4.250000 1 0 0 0 1 0 4.500000 1 0 0 1 0 0 4.750000 1 0 0 1 1 0 5.000000 1 0 1 0 0 0 5.250000 1 0 1 0 1 0 5.500000 1 0 1 1 0 0 5.750000 1 0 1 1 1 0 6.000000 1 1 0 0 0 0 6.250000 1 1 0 0 1 0 6.500000 1 1 0 1 0 0 6.750000 1 1 0 1 1 0 7.000000 1 1 1 0 0 0 7.250000 1 1 1 0 1 0 7.500000 1 1 1 1 0 0 7.750000 1 1 1 1 1 0 8.000000 0 0 0 0 0 0 i4_width_test(): i4_width determines the printing "width" of an I4. I4 i4_width 0 1 1 1 2 1 3 1 9 1 10 2 11 2 99 2 101 3 -1 2 -2 2 -3 2 -9 2 i4_wrap_test(): i4_wrap forces an integer to lie within given limits. ILO = 4 IHI = 8 I i4_wrap(I) -10 5 -9 6 -8 7 -7 8 -6 4 -5 5 -4 6 -3 7 -2 8 -1 4 0 5 1 6 2 7 3 8 4 4 5 5 6 6 7 7 8 8 9 4 10 5 11 6 12 7 13 8 14 4 15 5 16 6 17 7 18 8 19 4 20 5 i4_xor_test(): i4_xor returns the bitwise exclusive OR of two I4s. I J i4_xor I^J 16 92 76 76 74 7 77 77 19 79 92 92 14 34 44 44 54 50 4 4 1 5 4 4 14 14 0 0 29 72 85 85 54 3 53 53 24 80 72 72 i4mat_flip_cols_test: i4mat_flip_cols reverses the order of matrix columns. The original matrix: Col: 0 1 2 3 4 Row 0: 11 12 13 14 15 1: 21 22 23 24 25 2: 31 32 33 34 35 3: 41 42 43 44 45 4: 51 52 53 54 55 5: 61 62 63 64 65 The column-flipped matrix: Col: 0 1 2 3 4 Row 0: 15 14 13 12 11 1: 25 24 23 22 21 2: 35 34 33 32 31 3: 45 44 43 42 41 4: 55 54 53 52 51 5: 65 64 63 62 61 i4mat_flip_rows_test: i4mat_flip_rows reverses the order of matrix rows. The original matrix: Col: 0 1 2 3 4 Row 0: 11 12 13 14 15 1: 21 22 23 24 25 2: 31 32 33 34 35 3: 41 42 43 44 45 4: 51 52 53 54 55 5: 61 62 63 64 65 The row-flipped matrix: Col: 0 1 2 3 4 Row 0: 61 62 63 64 65 1: 51 52 53 54 55 2: 41 42 43 44 45 3: 31 32 33 34 35 4: 21 22 23 24 25 5: 11 12 13 14 15 i4mat_indicator_test(): i4mat_indicator() creates an "indicator" I4MAT. The indicator matrix: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 i4mat_is_binary_test(): i4mat_is_binary() is TRUE if an I4MAT only contains 0 or 1 entries. X: Col: 0 1 2 Row 0: 0 1 0 1: 1 0 1 X is binary X: Col: 0 1 2 Row 0: 1 1 1 1: 1 1 1 X is binary X: Col: 0 1 2 Row 0: 0 1 0 1: 1 2 1 X is NOT binary. i4mat_is_integer_test(): i4mat_is_integer() is TRUE if every entry of an I4MAT is an integer. Example 1: Obviously integer: [[1 2 3] [4 5 6]] A is an integer matrix. Example 2: Obviously NOT integer: [[1. 2. 3. ] [4. 5. 6.5]] A is NOT an integer matrix. Example 3: Not Integer, Not obvious: [[1. 2. 3.] [4. 5. 6.]] A is NOT an integer matrix. Example 4: Not Integer, Not obvious: [[1.e+00 2.e+00 3.e+08] [4.e+00 5.e+00 6.e+00]] A is NOT an integer matrix. i4mat_is_ternary_test(): i4mat_is_ternary() is TRUE if an I4MAT only contains -1, 0 and +1 entries. X: Col: 0 1 2 Row 0: 0 -1 0 1: 1 0 1 X is ternary X: Col: 0 1 2 Row 0: 1 1 1 1: 1 1 1 X is ternary X: Col: 0 1 2 Row 0: 0 1 0 1: -1 2 -1 X is NOT ternary. i4mat_max_test(): i4mat_max() returns the maximum entry. The matrix: Col: 0 1 2 3 4 5 6 Row 0: 0 10 2 4 1 1 3 1: 1 0 4 3 9 1 8 2: 10 5 3 0 4 6 9 3: 9 6 10 2 2 10 10 4: 0 4 0 0 5 4 7 Maximum entry = 10 i4mat_min_test(): i4mat_min() returns the minimum entry. The matrix: Col: 0 1 2 3 4 5 6 Row 0: 3 9 7 9 4 0 5 1: 7 9 4 0 7 4 3 2: 0 10 10 6 7 2 9 3: 4 7 6 3 0 2 8 4: 6 10 9 3 7 10 5 Minimum entry = 0 i4mat_mm_test(): i4mat_mm() multiplies two I4MAT's Matrix A: Col: 0 1 Row 0: 11 12 1: 21 22 2: 31 32 Matrix B: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 C = A*B: Col: 0 1 2 3 Row 0: 373 396 419 442 1: 693 736 779 822 2: 1013 1076 1139 1202 i4mat_print_test: i4mat_print() prints an I4MAT. A 5 x 6 integer matrix: Col: 0 1 2 3 4 5 Row 0: 11 12 13 14 15 16 1: 21 22 23 24 25 26 2: 31 32 33 34 35 36 3: 41 42 43 44 45 46 4: 51 52 53 54 55 56 i4mat_print_some_test(): i4mat_print_some() prints some of an I4MAT. Here is I4MAT, rows 0:2, cols 3:5: Col: 3 4 5 Row 0: 14 15 16 1: 24 25 26 2: 34 35 36 i4mat_product_elementwise_test(): i4mat_product_elementwise() computes the elementwise product of two I4MATs. A: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 B: Col: 0 1 2 Row 0: 1 3 5 1: 2 4 6 Elementwise product = 86 i4mat_rank_test(): i4mat_rank computes the rank of an integer matrix. Matrix A1: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 2: 7 8 9 The rank is 2 Matrix A2: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 2: 7 8 0 The rank is 3 Matrix A3: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 2: 7 8 0 3: 10 11 12 The rank is 3 Matrix A4: Col: 0 1 2 3 Row 0: 1 2 3 7 1: 4 5 6 8 2: 7 8 0 3 The rank is 3 Matrix A5: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 2: 7 8 9 3: 10 11 12 4: 3 3 3 The rank is 2 Matrix A6: Col: 0 1 Row 0: 0 0 1: 0 0 2: 0 0 The rank is 0 i4mat_ref_test(): i4mat_ref() computes the integer row echelon form of an I4MAT. Input A: Col: 0 1 2 3 4 5 6 Row 0: 1 3 0 2 6 3 1 1: -2 -6 0 -2 -8 3 1 2: 3 9 0 0 6 6 2 3: -1 -3 0 1 0 9 3 The pseudo-determinant = 6 IREF of A: Col: 0 1 2 3 4 5 6 Row 0: 1 3 0 2 6 3 1 1: 0 0 0 2 4 9 3 2: 0 0 0 0 0 3 1 3: 0 0 0 0 0 0 0 i4mat_row_reduce_test(): i4mat_row_reduce() divides out any common factors in the entries of a row of an I4MAT. Original matrix: Col: 0 1 2 Row 0: 12 88 9 1: 4 8 192 2: -12 99 94 3: 30 18 42 4: 0 4 8 After reducing a row: Col: 0 1 2 Row 0: 12 88 9 1: 4 8 192 2: -12 99 94 3: 30 18 42 4: 0 1 2 After reducing a row: Col: 0 1 2 Row 0: 12 88 9 1: 4 8 192 2: -12 99 94 3: 5 3 7 4: 0 1 2 After reducing a row: Col: 0 1 2 Row 0: 12 88 9 1: 4 8 192 2: -12 99 94 3: 5 3 7 4: 0 1 2 After reducing a row: Col: 0 1 2 Row 0: 12 88 9 1: 1 2 48 2: -12 99 94 3: 5 3 7 4: 0 1 2 After reducing a row: Col: 0 1 2 Row 0: 12 88 9 1: 1 2 48 2: -12 99 94 3: 5 3 7 4: 0 1 2 i4mat_row_swap_test: i4mat_row_swap() swaps two rows in an I4MAT. The original matrix: Col: 0 1 2 3 4 Row 0: 11 12 13 14 15 1: 21 22 23 24 25 2: 31 32 33 34 35 3: 41 42 43 44 45 4: 51 52 53 54 55 5: 61 62 63 64 65 After swapping rows 1 and 4: Col: 0 1 2 3 4 Row 0: 11 12 13 14 15 1: 51 52 53 54 55 2: 31 32 33 34 35 3: 41 42 43 44 45 4: 21 22 23 24 25 5: 61 62 63 64 65 i4mat_rref_test(): i4mat_rref() computes the integer reduced row echelon form (IRREF) of an I4MAT. Input A: Col: 0 1 2 3 4 5 6 Row 0: 1 3 0 2 6 3 1 1: -2 -6 0 -2 -8 3 1 2: 3 9 0 0 6 6 2 3: -1 -3 0 1 0 9 3 The pseudo-determinant = 6 IRREF form: Col: 0 1 2 3 4 5 6 Row 0: 1 3 0 0 2 0 0 1: 0 0 0 1 2 0 0 2: 0 0 0 0 0 3 1 3: 0 0 0 0 0 0 0 i4mat_rref_solve_binary_test(): i4mat_rref_solve_binary() seeks binary solutions of an Integer Reduced Row Echelon Form (IRREF) system A*x=b when A and b contain integer values. The IRREF matrix A: Col: 0 1 2 3 4 5 6 7 8 9 Row 0: 1 0 0 0 0 0 1 0 -1 0 1: 0 1 0 0 0 0 0 0 1 0 2: 0 0 1 0 0 0 1 0 -1 0 3: 0 0 0 1 0 0 0 0 1 1 4: 0 0 0 0 1 0 0 0 0 1 5: 0 0 0 0 0 1 -1 0 1 0 6: 0 0 0 0 0 0 0 1 0 -1 7: 0 0 0 0 0 0 0 0 0 0 8: 0 0 0 0 0 0 0 0 0 0 The right hand side b: 0 0 1 1 2 0 3 1 4 1 5 1 6 0 7 0 8 0 Binary solution vectors x: Col: 0 1 2 3 Row 0: 0 0 1 0 1: 1 1 0 0 2: 0 0 1 0 3: 1 0 0 0 4: 1 0 1 1 5: 1 1 0 1 6: 0 0 0 1 7: 0 1 0 0 8: 0 0 1 1 9: 0 1 0 0 i4mat_rref_solve_binary_nz_test(): i4mat_rref_solve_binary_nz() seeks binary solutions of an Integer Reduced Row Echelon Form (IRREF) system A*x=b which have exactly NZ nonzeros. The IRREF matrix A: Col: 0 1 2 3 4 5 6 7 8 9 Row 0: 1 0 0 0 0 0 1 0 -1 0 1: 0 1 0 0 0 0 0 0 1 0 2: 0 0 1 0 0 0 1 0 -1 0 3: 0 0 0 1 0 0 0 0 1 1 4: 0 0 0 0 1 0 0 0 0 1 5: 0 0 0 0 0 1 -1 0 1 0 6: 0 0 0 0 0 0 0 1 0 -1 7: 0 0 0 0 0 0 0 0 0 0 8: 0 0 0 0 0 0 0 0 0 0 The right hand side b: 0 0 1 1 2 0 3 1 4 1 5 1 6 0 7 0 8 0 Only consider binary solutions with exactly 4 nonzeros. Binary solution vectors x: Col: 0 1 2 3 Row 0: 0 1 0 0 1: 1 0 1 0 2: 0 1 0 0 3: 1 0 0 0 4: 1 1 0 1 5: 1 0 1 1 6: 0 0 0 1 7: 0 0 1 0 8: 0 1 0 1 9: 0 0 1 0 i4mat_sum_test(): i4mat_sum() sums the entries in an I4MAT. The matrix: Col: 0 1 2 Row 0: 5 5 0 1: 4 1 2 2: 0 3 4 3: 5 3 4 Sum of entries = 36 i4mat_transpose_test: i4mat_transpose transposes an I4MAT. The original matrix: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 The transposed matrix: Col: 0 1 2 3 4 Row 0: 11 21 31 41 51 1: 12 22 32 42 52 2: 13 23 33 43 53 3: 14 24 34 44 54 i4mat_transpose_print_test: i4mat_transpose_print() prints an I4MAT, tranposed. A 5 x 3 integer matrix: Row: 0 1 2 3 4 Col 0: 11 21 31 41 51 1: 12 22 32 42 52 2: 13 23 33 43 53 i4mat_transpose_print_some_test(): i4mat_transpose_print_some() prints some of an I4MAT, transposed. Here is I4MAT, rows 0:2, cols 3:5: Row: 0 1 2 Col 3: 14 24 34 4: 15 25 35 5: 16 26 36 i4mat_u_solve_test(): i4mat_u_solve() solves an upper triangular system. Input matrix A: Col: 0 1 2 3 Row 0: 1 2 4 7 1: 0 3 5 8 2: 0 0 6 9 3: 0 0 0 10 Right hand side b: 0 45 1 53 2 54 3 40 Computed solution x: 0: 1 1: 2 2: 3 3: 4 Norm of A*x-b = 0 i4mat_u1_inverse_test(): i4mat_u1_inverse() inverts a unit upper triangular matrix. The original matrix: Col: 0 1 2 3 4 5 Row 0: 1 2 0 5 0 75 1: 0 1 0 0 0 0 2: 0 0 1 3 0 0 3: 0 0 0 1 0 6 4: 0 0 0 0 1 4 5: 0 0 0 0 0 1 The inverse matrix: Col: 0 1 2 3 4 5 Row 0: 1 -2 0 -5 0 -45 1: 0 1 0 0 0 0 2: 0 0 1 -3 0 18 3: 0 0 0 1 0 -6 4: 0 0 0 0 1 -4 5: 0 0 0 0 0 1 The product: Col: 0 1 2 3 4 5 Row 0: 1 0 0 0 0 0 1: 0 1 0 0 0 0 2: 0 0 1 0 0 0 3: 0 0 0 1 0 0 4: 0 0 0 0 1 0 5: 0 0 0 0 0 1 i4mat_uniform_ab_test(): i4mat_uniform_ab() computes a random R8MAT. -1 <= X <= 5 Initial seed is 123456789 Random I4MAT: Col: 0 1 2 3 Row 0: 0 -1 -1 -1 1: 5 0 2 5 2: 4 -1 1 1 3: 2 -1 4 -1 4: 1 3 4 -1 i4mat_width_test(): i4mat_width() determines the printing width of an I4MAT. A1: Col: 0 1 2 Row 0: 11 211 3111 1: 12 222 3222 2: 13 233 3333 The printing width of A1 is 4 A2: Col: 0 1 2 Row 0: 10 23 45 1: 42 -1000 63 2: 77 63 90 The printing width of A2 is 5 i4row_max_test(): i4row_max() computes maximums of an I4ROW. The matrix: Col: 0 1 2 3 Row 0: 1 2 3 4 1: 5 6 7 8 2: 9 10 11 12 Row maximums: 0 4 1 8 2 12 i4row_mean_test(): i4row_mean() computes row means of an I4ROW. The matrix: Col: 0 1 2 3 Row 0: 1 2 3 4 1: 5 6 7 8 2: 9 10 11 12 The row means: 0: 2.5 1: 6.5 2: 10.5 i4row_min_test(): i4row_min() computes minimums of an I4ROW. The matrix: Col: 0 1 2 3 Row 0: 1 2 3 4 1: 5 6 7 8 2: 9 10 11 12 Row minimums: 0 1 1 5 2 9 i4row_variance_test(): i4row_variance() computes variances of an I4ROW. The matrix: Col: 0 1 2 3 Row 0: 1 2 3 4 1: 5 6 7 8 2: 9 10 11 12 The row variances: 0: 1.66667 1: 1.66667 2: 1.66667 i4rows_to_i4mat_test(): i4rows_to_i4mat() allows an I4MAT to be initialized by data stored ROW-WISE in a vector. The data vector: 0 11 1 12 2 13 3 14 4 21 5 22 6 23 7 24 8 31 9 32 10 33 11 34 The data copied into an array: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 i4vec_add_test(): i4vec_add adds two I4VECs. I A B C 0 -5 5 0 1 5 7 12 2 -4 7 3 3 -1 4 3 4 -1 -9 -10 5 9 -2 7 6 5 8 13 7 -1 0 -1 8 -3 7 4 9 -3 -2 -5 i4vec_amax_test(): i4vec_amax computes the largest of the magnitudes of the entries of an I4VEC. Vector A: 0 -4 1 -3 2 -4 3 -3 4 4 5 -8 6 2 7 -1 8 1 9 -3 Largest magnitude of entries of A = 8 i4vec_amin_test(): i4vec_amin computes the smallest of the magnitudes of the entries of an I4VEC. Vector A: 0 -4 1 -5 2 1 3 -3 4 -7 5 3 6 3 7 -5 8 2 9 3 Smallest magnitude of entries of A = 1 i4vec_binary_next_test(): i4vec_binary_next generates the next binary vector. 000 001 010 011 100 101 110 111 i4vec_concatenate_test(): i4vec_concatenate concatenates two I4VECs Array 1: 0 91 1 31 2 71 3 51 4 31 Array 2: 0 42 1 22 2 12 Array 3 = Array 1 + Array 2: 0 91 1 31 2 71 3 51 4 31 5 42 6 22 7 12 i4vec_copy_test(): i4vec_copy copies an I4VEC. Array 1: 0 91 1 31 2 71 3 51 4 31 Array 2: 0 91 1 31 2 71 3 51 4 31 i4vec_cum_test(): i4vec_cum: cumulative sum of I4VEC entries; Input vector: 0 5 1 10 2 1 3 6 4 8 5 9 6 2 7 1 8 4 9 4 Cumulative sums: 0 5 1 15 2 16 3 22 4 30 5 39 6 41 7 42 8 46 9 50 i4vec_cum0_test(): i4vec_cum0: zero-based cumulative sum of I4VEC entries; Input vector: 0 9 1 3 2 8 3 5 4 10 5 9 6 7 7 9 8 8 9 9 Cumulative sums: 0 0 1 9 2 12 3 20 4 25 5 35 6 44 7 51 8 60 9 68 10 77 i4vec_decrement_test(): i4vec_decrement decrements an I4VEC. The I4VEC: 0 -3 1 5 2 5 3 -5 The I4VEC after decrementing: 0 -4 1 4 2 4 3 -6 i4vec_dot_product_test(): i4vec_dot_product() computes the dot product of two I4VECs. The vector A: 0 8 1 0 2 4 3 10 4 8 The vector B: 0 3 1 8 2 9 3 2 4 8 The dot product is 144 i4vec_frac_test(): i4vec_frac() returns the K-th smallest integer vector entry. The array to search: 0 7 1 2 2 18 3 9 4 12 5 5 6 4 7 20 8 8 9 20 Fractile Value 1 2 4 7 7 12 10 20 i4vec_heap_d_test(): i4vec_heap_d() puts an I4VEC into descending heap form. Unsorted array: 0 1 1 5 2 0 3 1 4 7 5 4 6 2 7 5 8 10 9 6 Descending heap form: 0 10 1 7 2 4 3 5 4 6 5 0 6 2 7 5 8 1 9 1 i4vec_gcd_test(): i4vec_gcd() computes the greatest common divisor of the entries in an I4VEC. The I4VEC: 0 120120 1 90090 2 750750 3 330330 GCD = 30030 i4vec_identity_row_test(): i4vec_identity_row() returns a row of the identity matrix. -1: 0 0 0 0 0 0: 1 0 0 0 0 1: 0 1 0 0 0 2: 0 0 1 0 0 3: 0 0 0 1 0 4: 0 0 0 0 1 5: 0 0 0 0 0 i4vec_increment_test(): i4vec_increment() increments an I4VEC. The I4VEC: 0 -1 1 9 2 -5 3 3 The I4VEC after incrementing: 0 0 1 10 2 -4 3 4 i4vec_index_test(): i4vec_index(): first index of given value; Input vector: 0 -10 1 -3 2 -7 3 -5 4 7 5 -5 6 -7 7 -4 8 3 9 -10 Index of first occurrence of -5 is 3 Index of first occurrence of -4 is 7 i4vec_indicator0_test(): i4vec_indicator0() returns an indicator vector. The indicator0 vector: 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 i4vec_indicator1_test(): i4vec_indicator1() returns an indicator vector. The indicator1 vector: 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 i4vec_is_ascending_test(): i4vec_is_ascending() determines if an I4VEC ascends. Test vector: 1 3 2 4 i4vec_is_ascending = False Test vector: 2 2 2 2 i4vec_is_ascending = True Test vector: 1 2 2 4 i4vec_is_ascending = True Test vector: 1 2 3 4 i4vec_is_ascending = True Test vector: 4 4 3 1 i4vec_is_ascending = False Test vector: 9 7 3 0 i4vec_is_ascending = False i4vec_is_binary_test(): Python version: 3.6.9 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_is_coprime_test(): Python version: 3.6.9 i4vec_is_coprime() determines if a vector of integers is pairwise prime. Row Vector Coprime? 1 3 2 4 False 2 2 2 2 False 5 7 12 29 True 1 13 1 11 True 1 4 9 16 False 6 35 13 77 False i4vec_is_descending_test(): Python version: 3.6.9 i4vec_is_descending determines if an I4VEC descends. Test vector: 1 3 2 4 i4vec_is_descending = False Test vector: 2 2 2 2 i4vec_is_descending = True Test vector: 1 2 2 4 i4vec_is_descending = False Test vector: 1 2 3 4 i4vec_is_descending = False Test vector: 4 4 3 1 i4vec_is_descending = True Test vector: 9 7 3 0 i4vec_is_descending = True i4vec_is_distinct_test(): Python version: 3.6.9 i4vec_is_distinct computes the maximum entry in an I4VEC. Input vector: 0 1 1 2 2 5 3 3 4 4 Array entries are distinct. Input vector: 0 1 1 2 2 5 3 2 4 4 Array entries are NOT distinct. i4vec_is_equal_test(): Python version: 3.6.9 i4vec_is_equal is TRUE if two I4VECs are equal. Vectors A and B: 0 1 1 1 3 3 2 2 2 3 4 4 i4vec_is_equal(A,B) = True Vectors A and B: 0 2 2 1 2 2 2 2 1 3 2 2 i4vec_is_equal(A,B) = False Vectors A and B: 0 1 4 1 2 1 2 2 1 3 4 3 i4vec_is_equal(A,B) = False Vectors A and B: 0 1 1 1 2 2 2 3 3 3 4 4 i4vec_is_equal(A,B) = True i4vec_is_even_all_test(): Python version: 3.6.9 i4vec_is_even_all is TRUE if an I4VEC only contains even entries. X: 1 5 19 X is NOT only even values. X: 3 2 77 X is NOT only even values. X: 2 4 88 X is only even values. i4vec_is_even_any_test(): Python version: 3.6.9 i4vec_is_even_all is TRUE if an I4VEC contains any even entries. X: 1 5 19 X contains NO even values. X: 3 2 77 X contains at least one even value. X: 2 4 88 X contains at least one even value. i4vec_is_binary_test(): Python version: 3.6.9 i4vec_is_binary is TRUE if an I4VEC only contains 0 or 1 entries. X: 0 0 0 Y: 1 2 3 Some X is < some Y. X: 3 2 1 Y: 1 2 3 Some X is < some Y. X: 2 3 4 Y: 1 2 3 NO X is < any Y. i4vec_is_negative_any_test(): i4vec_is_negative_any() is TRUE if an I4VEC contains at least one negative entry. X: -1 -2 0 X has at least one negative entry. X: -1 0 1 X has at least one negative entry. X: 1 3 99 X has no negative entries. i4vec_is_nonpositive_all_test(): Python version: 3.6.9 i4vec_is_nonpositive_all is TRUE if an I4VEC only contains nonpositive entries. X: -1 -2 0 X is only nonpositives. X: -1 0 1 X is NOT only nonpositives. X: -1 -3 -99 X is only nonpositives. i4vec_is_nonzero_any_test(): Python version: 3.6.9 i4vec_is_nonzero_any is TRUE if an I4VEC contains at least one nonzero entry. X: 0 0 0 X has no nonzero entries. X: 0 -1 0 X has at least one nonzero entry. X: 1 3 99 X has at least one nonzero entry. i4vec_is_odd_all_test(): Python version: 3.6.9 i4vec_is_odd_all is TRUE if an I4VEC only contains odd entries. X: 1 5 19 X is only odd values. X: 3 2 77 X is NOT only odd values. X: 2 4 88 X is NOT only odd values. i4vec_is_odd_any_test(): Python version: 3.6.9 i4vec_is_odd_all is TRUE if an I4VEC contains any odd entries. X: 1 5 19 X contains at least one odd value. X: 3 2 77 X contains at least one odd value. X: 2 4 88 X contains NO odd values. i4vec_is_one_test(): Python version: 3.6.9 i4vec_is_one is TRUE if an I4VEC only contains 1 entries. X: 0 0 0 X is NOT only ones. X: 0 1 2 X is NOT only ones. X: 1 1 1 X is only ones. i4vec_is_zero_test(): Python version: 3.6.9 i4vec_is_zero is TRUE if an I4VEC only contains 0 entries. X: 0 0 0 X is only zeros. X: 0 1 2 X is NOT only zeros. X: 1 1 1 X is NOT only zeros. i4vec_lcm_test() i4vec_lcm() computes the least common multiple of the entries in an I4VEC. i4vec: [120120 90090 750750 330330] i4vec_lcm = 99099000 i4vec_max_test(): Python version: 3.6.9 i4vec_max returns the maximum entry in an I4VEC. The vector: 0 5 1 17 2 27 3 8 4 17 5 5 6 23 7 4 8 16 9 23 Maximum entry = 27 i4vec_max_index_last_test(): Python version: 3.6.9 i4vec_max_index_last: last maximal index Input vector: 0 2 1 0 2 1 3 2 4 0 5 0 6 1 7 3 8 3 9 1 10 1 11 3 12 3 13 2 14 0 Last maximum index: 12 i4vec_max_last_test(): i4vec_max_last identifies the largest element in an I4VEC, and moves it to the final entry. Input vector: 0 14 1 8 2 7 3 19 4 25 5 10 6 13 7 23 8 18 9 3 Maximum: 25 Output vector: 0 8 1 7 2 14 3 19 4 10 5 13 6 23 7 18 8 3 9 25 i4vec_mean_test(): Python version: 3.6.9 i4vec_mean computes the mean of an I4VEC. The vector: 0 4 1 10 2 8 3 8 4 4 The mean value is 6.8 i4vec_mean_i4_test(): Python version: 3.6.9 i4vec_mean_i4 computes the I4 mean of an I4VEC. The vector: 0 6 1 4 2 1 3 10 4 10 The I4 mean value is 6 i4vec_min_test(): Python version: 3.6.9 i4vec_min returns the minimum entry in an I4VEC. The vector: 0 15 1 19 2 21 3 19 4 17 5 13 6 15 7 9 8 9 9 6 Minimum entry = 6 i4vec_permute_test(): Python version: 3.6.9 i4vec_permute reorders an I4VEC according to a given permutation. A[*], before rearrangement: 0 8 1 7 2 11 3 5 4 7 5 6 6 9 7 0 8 7 9 5 10 11 11 2 Permutation vector P[*]: 0 8 1 2 2 0 3 3 4 6 5 4 6 9 7 10 8 11 9 7 10 1 11 5 A[P[*]]: 0 7 1 11 2 8 3 5 4 9 5 7 6 5 7 11 8 2 9 0 10 7 11 6 i4vec_permute_uniform_test(): Python version: 3.6.9 i4vec_permute_uniform randomly reorders an I4VEC. A, before rearrangement: 0 101 1 102 2 103 3 104 4 105 5 106 6 107 7 108 8 109 9 110 10 111 11 112 A, after rearrangement: 0 112 1 101 2 108 3 110 4 107 5 104 6 111 7 105 8 103 9 106 10 102 11 109 i4vec_print_test(): Python version: 3.6.9 i4vec_print prints an I4VEC. Here is an I4VEC: 0 91 1 92 2 93 3 94 i4vec_print_mask_test(): Python version: 3.6.9 i4vec_print_mask prints the masked elements of an I4VEC. Here is the full vector: 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 Here is the vector mask: 0 0 1 1 2 1 3 0 4 1 5 0 6 1 7 0 8 0 9 0 Here is the masked vector I4VEC: 1 2 2 3 4 5 6 7 i4vec_product_test(): Python version: 3.6.9 i4vec_product computes the product of the entries in an I4VEC. Input vector: 0 5 1 -4 2 -5 3 -5 4 -4 5 2 6 4 7 -5 8 3 9 3 Product of entries = -720000 i4vec_red_test(): Python version: 3.6.9 i4vec_red divides out any common factors in the entries of an I4VEC. Apply i4vec_red to each row of this matrix: Col: 0 1 2 Row 0: 12 88 9 1: 4 8 192 2: -12 88 94 3: 30 18 42 4: 0 4 8 Reduced matrix: Col: 0 1 2 Row 0: 12 88 9 1: 1 2 48 2: -6 44 47 3: 5 3 7 4: 0 1 2 i4vec_reverse_test(): Python version: 3.6.9 i4vec_reverse reverses a list of integers. Original vector: 0 7 1 11 2 8 3 8 4 9 5 0 6 21 7 13 8 27 9 14 Reversed: 0 14 1 27 2 13 3 21 4 0 5 9 6 8 7 8 8 11 9 7 i4vec_run_count_test(): Python version: 3.6.9 i4vec_run_count counts runs in an I4VEC Run Count Sequence 8 0 0 0 1 1 1 1 0 0 0 1 1 0 1 0 0 0 0 1 1 9 0 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 0 0 1 0 10 0 0 1 0 1 1 1 0 0 1 1 1 0 1 1 1 0 0 1 1 12 1 0 0 0 1 1 0 1 0 1 0 1 1 1 0 0 0 0 1 0 12 0 1 0 1 0 0 0 1 0 1 1 1 0 0 1 1 1 1 0 1 9 0 0 1 1 1 0 0 0 0 0 1 1 1 0 0 1 0 1 0 0 14 0 1 0 1 0 0 1 1 0 1 1 0 1 1 0 1 0 0 1 1 8 0 0 0 1 1 1 0 1 1 1 1 0 0 1 1 1 0 0 1 1 8 1 0 0 1 1 0 0 0 0 1 0 0 1 1 1 1 1 1 0 0 12 0 1 0 1 0 1 1 1 0 0 1 0 0 1 0 1 1 1 1 1 i4vec_search_binary_a_test(): Python version: 3.6.9 i4vec_search_binary_a searches a ascending sorted vector. Ascending sorted array: 0 0 1 1 2 1 3 2 4 3 5 4 6 5 7 6 8 7 9 8 Now search for an instance of the value 5 The value occurs at index = 6 i4vec_sort_bubble_a_test(): Python version: 3.6.9 i4vec_sort_bubble_a ascending sorts, Unsorted: 0 23 1 29 2 45 3 34 4 55 5 49 6 2 7 9 8 29 9 41 10 57 11 26 12 22 13 57 14 11 15 1 16 3 17 8 18 33 19 7 Ascending sorted: 0 1 1 2 2 3 3 7 4 8 5 9 6 11 7 22 8 23 9 26 10 29 11 29 12 33 13 34 14 41 15 45 16 49 17 55 18 57 19 57 i4vec_sort_heap_a_test(): Python version: 3.6.9 i4vec_sort_heap_a ascending sorts an I4VEC. Unsorted: 0 39 1 15 2 43 3 59 4 28 5 15 6 18 7 50 8 13 9 38 10 49 11 28 12 49 13 33 14 55 15 19 16 28 17 30 18 57 19 14 Ascending sorted: 0 13 1 14 2 15 3 15 4 18 5 19 6 28 7 28 8 28 9 30 10 33 11 38 12 39 13 43 14 49 15 49 16 50 17 55 18 57 19 59 i4vec_sort_heap_index_a_test(): Python version: 3.6.9 i4vec_sort_heap_index_a creates an ascending sort index for an I4VEC. Unsorted array A: 0 45 1 32 2 57 3 47 4 49 5 27 6 19 7 15 8 21 9 36 10 45 11 26 12 28 13 31 14 5 15 38 16 56 17 3 18 24 19 50 Sort vector INDX: 0 17 1 14 2 7 3 6 4 8 5 18 6 11 7 5 8 12 9 13 10 1 11 9 12 15 13 0 14 10 15 3 16 4 17 19 18 16 19 2 I INDX(I) A(INDX(I)) 0 17 3 1 14 5 2 7 15 3 6 19 4 8 21 5 18 24 6 11 26 7 5 27 8 12 28 9 13 31 10 1 32 11 9 36 12 15 38 13 0 45 14 10 45 15 3 47 16 4 49 17 19 50 18 16 56 19 2 57 i4vec_sort_heap_index_d_test(): Python version: 3.6.9 i4vec_sort_heap_index_d creates a descending sort index for an I4VEC. Unsorted array A: 0 35 1 28 2 16 3 12 4 56 5 29 6 48 7 19 8 54 9 2 10 20 11 10 12 54 13 43 14 36 15 29 16 42 17 41 18 46 19 49 Sort vector INDX: 0 4 1 12 2 8 3 19 4 6 5 18 6 13 7 16 8 17 9 14 10 0 11 5 12 15 13 1 14 10 15 7 16 2 17 3 18 11 19 9 I INDX(I) A(INDX(I)) 0 4 56 1 12 54 2 8 54 3 19 49 4 6 48 5 18 46 6 13 43 7 16 42 8 17 41 9 14 36 10 0 35 11 5 29 12 15 29 13 1 28 14 10 20 15 7 19 16 2 16 17 3 12 18 11 10 19 9 2 i4vec_sort_insert_a_test(): Python version: 3.6.9 i4vec_sort_insert_a sorts an integer array. Unsorted array: 0 9 1 3 2 5 3 8 4 0 5 4 6 7 7 4 8 9 9 6 Sorted array: 0 0 1 3 2 4 3 4 4 5 5 6 6 7 7 8 8 9 9 9 i4vec_sort_insert_d_test(): Python version: 3.6.9 i4vec_sort_insert_d descending sorts an I4VEC. Unsorted array: 0 9 1 1 2 3 3 8 4 9 5 4 6 4 7 2 8 7 9 5 Descending sorted array: 0 9 1 9 2 8 3 7 4 5 5 4 6 4 7 3 8 2 9 1 i4vec_sorted_unique_test(): Python version: 3.6.9 i4vec_sorted_unique finds unique entries in a sorted array. Input vector: 0 0 1 1 2 1 3 2 4 3 5 5 6 9 7 9 8 10 9 11 10 11 11 13 12 13 13 14 14 15 15 15 16 15 17 17 18 20 19 20 Unique entries: 0 0 1 1 2 2 3 3 4 5 5 9 6 10 7 11 8 13 9 14 10 15 11 17 12 20 i4vec_sorted_unique_count_test(): Python version: 3.6.9 i4vec_sorted_unique_count counts unique entries in a sorted I4VEC. Input vector: 0 0 1 0 2 3 3 4 4 4 5 5 6 6 7 7 8 11 9 12 10 13 11 13 12 14 13 15 14 16 15 16 16 17 17 18 18 19 19 20 Number of unique entries is 16 i4vec_sum_test(): Python version: 3.6.9 i4vec_sum sums the entries of an I4VEC. The vector: 0 2 1 9 2 6 3 6 4 1 The vector entries sum to 24 i4vec_transpose_print_test(): Python version: 3.6.9 i4vec_transpose_print prints an I4VEC with 5 entries to a row, and an optional title. My array: 1 2 3 4 5 6 7 8 9 10 11 12 i4vec_uniform_ab_test(): Python version: 3.6.9 i4vec_uniform_ab computes pseudorandom values in an interval [A,B]. The lower endpoint A = -100 The upper endpoint B = 200 The initial seed is 123456789 The random vector: 0 -35 1 187 2 149 3 69 4 25 5 -81 6 -23 7 -67 8 -87 9 90 10 -82 11 35 12 20 13 127 14 139 15 -100 16 170 17 5 18 -72 19 -96 i4vec_unique_count_test(): Python version: 3.6.9 i4vec_unique_count counts unique entries in an I4VEC. Input vector: 0 5 1 2 2 18 3 6 4 7 5 11 6 6 7 12 8 19 9 10 10 4 11 15 12 7 13 20 14 7 15 9 16 16 17 7 18 8 19 20 Number of unique entries is 15 i4vec_variance_test(): Python version: 3.6.9 i4vec_variance computes the variance of an I4VEC. Input vector: 0 1 1 1 2 2 3 -2 4 -3 5 -2 6 -2 7 3 8 -2 9 4 Value = 6.22222 i4vec_width_test(): Python version: 3.6.9 i4vec_width determines the printing "width" of an I4VEC. The vector 0 0 1 1 2 2 3 3 4 9 5 10 6 11 7 99 8 101 9 -1 10 -2 11 -3 12 -9 The printing width is 3 i4vec2_compare_test(): i4vec2_compare() order-compares two I4VEC2s; I: A1 A2 0 1 4 1 1 0 2 2 1 3 2 2 4 3 2 Comparison matrix: [[ 0. 1. -1. -1. -1.] [-1. 0. -1. -1. -1.] [ 1. 1. 0. -1. -1.] [ 1. 1. 1. 0. -1.] [ 1. 1. 1. 1. 0.]] i4vec2_print_test(): i4vec2_print() prints a pair of I4VECs I, sum of I, sum of I^2: 0 0 0 1 1 1 2 3 5 3 6 14 4 10 30 5 15 55 6 21 91 7 28 140 8 36 204 9 45 285 10 55 385 i4vec2_sort_insert_a_test(): i4vec2_sort_insert_a() uses insertion to perform an ascending sort of a pair of I4VECs; The array: 0 3 2 1 2 1 2 3 2 3 3 2 4 2 1 5 1 3 6 3 2 7 3 3 8 3 2 9 1 3 After ascending insertion sort: 0 1 3 1 1 3 2 2 1 3 2 1 4 3 2 5 3 2 6 3 2 7 3 2 8 3 2 9 3 3 i4vec2_sorted_unique_test(): i4vec2_sorted_unique() returns unique entries in a pair of sorted I4VECs. The sorted array: 0 1 3 1 1 3 2 2 1 3 2 1 4 3 2 5 3 2 6 3 2 7 3 2 8 3 2 9 3 3 The unique values: 0 1 3 1 2 1 2 3 2 3 3 3 i4vec2_sorted_unique_count_test(): i4vec2_sorted_unique_count() counts unique entries in a pair of sorted I4VECs. The sorted array: 0 1 3 1 1 3 2 2 1 3 2 1 4 3 2 5 3 2 6 3 2 7 3 2 8 3 2 9 3 3 Number of unique items is 4 intspace_test(): intspace() returns a set of min(N,B+1-A) equally spaced integers between A and B. a = 5 , b = 10 , n = 20 [ 5 6 7 8 9 10] a = 5 , b = 77 , n = 20 [ 5 9 13 16 20 24 28 32 35 39 43 47 50 54 58 62 66 69 73 77] a = 5 , b = 100 , n = 20 [ 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100] a = 5 , b = 1000 , n = 20 [ 5 57 110 162 214 267 319 372 424 476 529 581 633 686 738 791 843 895 948 1000] 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 l4_to_i4_test(): l4_to_i4() converts an L4 to an I4. L4 I4 False 0 True 1 pascal_to_i4_test(): pascal_to_i4() converts Pascal triangle indices to a linear index. I J => K 0 0 1 1 0 2 0 1 3 2 0 4 1 1 5 0 2 6 3 0 7 2 1 8 1 2 9 0 3 10 4 0 11 3 1 12 2 2 13 1 3 14 0 4 15 perm0_check_test(): perm0_check checks a permutation of 0,...,N-1. Permutation 1: 5 2 3 4 1 perm0_check - Warning! Permutation is missing the value 0. Permutation 2: 4 1 3 0 2 Permutation 3: 0 2 1 3 2 perm0_check - Warning! Permutation is missing the value 4. perm0_uniform_test(): perm0_uniform randomly selects a permutation of 0, ..., N-1. 6 4 8 3 2 1 9 0 7 5 9 8 3 1 4 7 2 6 0 5 1 0 3 2 5 4 8 7 6 9 7 6 0 8 4 2 3 9 5 1 0 8 2 5 9 3 4 7 6 1 perm1_check_test(): perm1_check checks a permutation of 1,...,N. Permutation 1: 5 2 3 4 1 Permutation 2: 4 1 3 0 2 perm1_check - Warning! Permutation is missing the value 5. Permutation 3: 0 2 1 3 2 perm1_check - Warning! Permutation is missing the value 4. perm1_uniform_test(): perm1_uniform randomly selects a permutation of 1, ..., N. 4 8 5 2 3 1 6 9 10 7 2 5 7 3 6 1 9 4 10 8 5 8 3 1 4 6 7 10 2 9 8 5 9 4 6 1 7 2 10 3 1 10 2 3 4 7 6 5 9 8 permutation_symbol_test(): permutation_symbol evaluates the Levi-Civita permutation symbol. Input vector: 1 2 3 4 5 Levi-Civita permutation symbol = 1 Input vector: 4 2 3 1 5 Levi-Civita permutation symbol = -1 Input vector: 1 2 3 4 2 Levi-Civita permutation symbol = 0 prime_test(): prime returns primes from a table. Number of primes stored is 1600 I Prime(I) 1 2 2 3 3 5 4 7 5 11 6 13 7 17 8 19 9 23 10 29 1590 13411 1591 13417 1592 13421 1593 13441 1594 13451 1595 13457 1596 13463 1597 13469 1598 13477 1599 13487 1600 13499 triangle_lower_to_i4_test(): triangle_lower_to_i4 converts a lower triangular index to a linear one. ( I, J ) ==> K 0 0 0 1 0 1 1 1 2 2 0 3 2 1 4 2 2 5 3 0 6 3 1 7 3 2 8 3 3 9 4 0 10 4 1 11 4 2 12 4 3 13 4 4 14 triangle_upper_to_i4_test(): triangle_upper_to_i4() converts an upper triangular index to a linear one. ( I, J ) ==> K 0 0 0 0 1 1 1 1 2 0 2 3 1 2 4 2 2 5 0 3 6 1 3 7 2 3 8 3 3 9 0 4 10 1 4 11 2 4 12 3 4 13 4 4 14 i4lib_test(): Normal end of execution. Sat Jul 23 15:59:11 2022