10-Feb-2019 17:11:21 ubvec_test MATLAB version Test ubvec. 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_UNIFORM_AB_TEST I4_UNIFORM_AB computes pseudorandom values in an interval [A,B]. The lower endpoint A = -100.000000 The upper endpoint B = 200.000000 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 I4VEC_PRINT_TEST I4VEC_PRINT prints an I4VEC The I4VEC: 1: 91 2: 92 3: 93 4: 94 KSUBSET_COLEX_UNRANK_TEST KSUBSET_COLEX_UNRANK unranks K-subsets of an N set, using the colexicographic ordering: The element of rank 5: The element: 1: 5 2: 3 3: 1 KSUBSET_ENUM_TEST KSUBSET_ENUM enumerates K-subsets of an N set. K: 0 1 2 3 4 5 N 0: 1 1: 1 1 2: 1 2 1 3: 1 3 3 1 4: 1 4 6 4 1 5: 1 5 10 10 5 1 MORSE_THUE_TEST MORSE_THUE computes the Morse-Thue numbers. 0110100110 0101101001 0110011010 0110010110 0110100101 1010011001 0110100101 1001101001 0110100110 0101100110 1 NIM_SUM_TEST NIM_SUM computes the Nim sum of two integers. I J Nim(I+J) I1, I2, I3 in decimal: 218 957 871 I1, I2, I3 in binary: 01011011000000000000000000000000 10111101110000000000000000000000 11100110110000000000000000000000 I1, I2, I3 in decimal: 830 562 268 I1, I2, I3 in binary: 01111100110000000000000000000000 01001100010000000000000000000000 00110000100000000000000000000000 I1, I2, I3 in decimal: 415 66 477 I1, I2, I3 in binary: 11111001100000000000000000000000 01000010000000000000000000000000 10111011100000000000000000000000 I1, I2, I3 in decimal: 257 110 367 I1, I2, I3 in binary: 10000000100000000000000000000000 01110110000000000000000000000000 11110110100000000000000000000000 I1, I2, I3 in decimal: 43 634 593 I1, I2, I3 in binary: 11010100000000000000000000000000 01011110010000000000000000000000 10001010010000000000000000000000 UBVEC_ADD_TEST UBVEC_ADD adds unsigned binary vectors representing unsigned integers; I J K = I + J 22 96 Directly: 118 UBVEC_ADD 118 83 56 Directly: 139 UBVEC_ADD 139 41 6 Directly: 47 UBVEC_ADD 47 26 11 Directly: 37 UBVEC_ADD 37 4 64 Directly: 68 UBVEC_ADD 68 6 45 Directly: 51 UBVEC_ADD 51 40 76 Directly: 116 UBVEC_ADD 116 80 0 Directly: 80 UBVEC_ADD 80 90 35 Directly: 125 UBVEC_ADD 125 9 1 Directly: 10 UBVEC_ADD 10 UBVEC_AND_TEST UBVEC_AND computes the AND of two unsigned binary vectors representing unsigned integers; I J K = I AND J 22 96 0 83 56 16 41 6 0 26 11 10 4 64 0 6 45 4 40 76 8 80 0 0 90 35 2 9 1 1 UBVEC_CHECK_TEST UBVEC_CHECK check an unsigned binary vector. CHECK? UBVEC value = 0 0: 10011 value = 0 value = 5 5: 10019 value = 0 value = 2 2: 13011 UBVEC_COMPLEMENT1_TEST UBVEC_COMPLEMENT1 returns the 1's complement of an unsigned binary vector. UBVEC Comp1 10001 01110 11110 00001 11100 00011 10111 01000 00111 11000 UBVEC_ENUM_TEST UBVEC_ENUM enumerates unsigned binary vectors of N digits N Number 0 1 1 2 2 4 3 8 4 16 5 32 6 64 7 128 8 256 9 512 10 1024 UBVEC_NEXT_TEST UBVEC_NEXT computes the "next" unsigned binary vector. 0000 1000 0100 1100 0010 1010 0110 1110 0001 1001 0101 1101 0011 1011 0111 1111 0000 UBVEC_NEXT_GRAY_TEST UBVEC_NEXT_GRAY returns the next UBVEC in the Gray code. K UBVEC 0 0 0 0 0 1 0 0 0 1 2 0 0 1 1 3 0 0 1 0 4 0 1 1 0 5 0 1 1 1 6 0 1 0 1 7 0 1 0 0 8 1 1 0 0 9 1 1 0 1 10 1 1 1 1 11 1 1 1 0 12 1 0 1 0 13 1 0 1 1 14 1 0 0 1 15 1 0 0 0 UBVEC_NEXT_GRLEX_TEST UBVEC_NEXT_GRLEX computes unsigned binary vectors in GRLEX order. 0: 0000 1: 0001 2: 0010 3: 0100 4: 1000 5: 0011 6: 0101 7: 0110 8: 1001 9: 1010 10: 1100 11: 0111 12: 1011 13: 1101 14: 1110 15: 1111 16: 0000 UBVEC_OR_TEST UBVEC_OR computes the OR of two unsigned binary vectors representing unsigned integers; I J K = I OR J 22 96 118 83 56 123 41 6 47 26 11 27 4 64 68 6 45 47 40 76 108 80 0 80 90 35 123 9 1 9 UBVEC_PRINT_TEST UBVEC_PRINT prints an unsigned binary vector. UBVEC: 0011101001 UBVEC_RANDOM_TEST UBVEC_RANDOM randomizes an unsigned binary vector. 10001 01111 00111 11101 11100 UBVEC_RANK_GRAY_TEST UBVEC_RANK_GRAY ranks a UBVEC in the Gray ordering. UBVEC Rank 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 3 0 0 0 1 1 2 0 0 1 0 0 7 0 0 1 0 1 6 0 0 1 1 0 4 0 0 1 1 1 5 0 1 0 0 0 15 0 1 0 0 1 14 0 1 0 1 0 12 0 1 0 1 1 13 0 1 1 0 0 8 0 1 1 0 1 9 0 1 1 1 0 11 0 1 1 1 1 10 1 0 0 0 0 31 1 0 0 0 1 30 1 0 0 1 0 28 1 0 0 1 1 29 1 0 1 0 0 24 1 0 1 0 1 25 1 0 1 1 0 27 1 0 1 1 1 26 1 1 0 0 0 16 1 1 0 0 1 17 1 1 0 1 0 19 1 1 0 1 1 18 1 1 1 0 0 23 1 1 1 0 1 22 1 1 1 1 0 20 1 1 1 1 1 21 UBVEC_REVERSE_TEST UBVEC_REVERSE reverses an unsigned binary vector. UBVEC Reversed 10001 10001 11110 01111 11100 00111 10111 11101 00111 11100 UBVEC_TO_UI4_TEST UBVEC_TO_UI4 converts an unsigned binary vector to an unsigned integer; UI4 --> UBVEC --> UI4 0 0000000000 0 1 0000000001 1 2 0000000010 2 3 0000000011 3 4 0000000100 4 5 0000000101 5 6 0000000110 6 7 0000000111 7 8 0000001000 8 9 0000001001 9 10 0000001010 10 UBVEC_UNRANK_GRAY_TEST UBVEC_UNRANK_GRAY unranks a UBVEC. Rank UBVEC 0 0 0 0 0 0 1 0 0 0 0 1 2 0 0 0 1 1 3 0 0 0 1 0 4 0 0 1 1 0 5 0 0 1 1 1 6 0 0 1 0 1 7 0 0 1 0 0 8 0 1 1 0 0 9 0 1 1 0 1 10 0 1 1 1 1 11 0 1 1 1 0 12 0 1 0 1 0 13 0 1 0 1 1 14 0 1 0 0 1 15 0 1 0 0 0 16 1 1 0 0 0 17 1 1 0 0 1 18 1 1 0 1 1 19 1 1 0 1 0 20 1 1 1 1 0 21 1 1 1 1 1 22 1 1 1 0 1 23 1 1 1 0 0 24 1 0 1 0 0 25 1 0 1 0 1 26 1 0 1 1 1 27 1 0 1 1 0 28 1 0 0 1 0 29 1 0 0 1 1 30 1 0 0 0 1 31 1 0 0 0 0 UBVEC_UNRANK_GRLEX_TEST UBVEC_UNRANK_GRLEX returns the UBVEC of given rank in the graded lexicographical ordering. -- -------- 0 0 0 0 0 -- -------- 1 0 0 0 1 2 0 0 1 0 3 0 1 0 0 4 1 0 0 0 -- -------- 5 0 0 1 1 6 0 1 0 1 7 0 1 1 0 8 1 0 0 1 9 1 0 1 0 10 1 1 0 0 -- -------- 11 0 1 1 1 12 1 0 1 1 13 1 1 0 1 14 1 1 1 0 -- -------- 15 1 1 1 1 UBVEC_XOR_TEST UBVEC_XOR exclusive-ors unsigned binary vectors representing unsigned integers; I J K = I XOR J 22 96 118 83 56 107 41 6 47 26 11 17 4 64 68 6 45 43 40 76 100 80 0 80 90 35 121 9 1 8 UI4_RANK_GRAY_TEST UI4_RANK_GRAY ranks a UI4 in the Gray ordering. UI4 Rank (binary) 0 0 0 0 0 0 0 1 1 0 0 0 0 1 2 3 0 0 0 1 0 3 2 0 0 0 1 1 4 7 0 0 1 0 0 5 6 0 0 1 0 1 6 4 0 0 1 1 0 7 5 0 0 1 1 1 8 15 0 1 0 0 0 9 14 0 1 0 0 1 10 12 0 1 0 1 0 11 13 0 1 0 1 1 12 8 0 1 1 0 0 13 9 0 1 1 0 1 14 11 0 1 1 1 0 15 10 0 1 1 1 1 16 31 1 0 0 0 0 17 30 1 0 0 0 1 18 28 1 0 0 1 0 19 29 1 0 0 1 1 20 24 1 0 1 0 0 21 25 1 0 1 0 1 22 27 1 0 1 1 0 23 26 1 0 1 1 1 24 16 1 1 0 0 0 25 17 1 1 0 0 1 26 19 1 1 0 1 0 27 18 1 1 0 1 1 28 23 1 1 1 0 0 29 22 1 1 1 0 1 30 20 1 1 1 1 0 31 21 1 1 1 1 1 UI4_TO_UBVEC_TEST UI4_TO_UBVEC converts an unsigned integer to an unsigned binary vector; I --> BVEC 0 0000000000 1 0000000001 2 0000000010 3 0000000011 4 0000000100 5 0000000101 6 0000000110 7 0000000111 8 0000001000 9 0000001001 10 0000001010 UI4_UNRANK_GRAY_TEST UI4_UNRANK_GRAY unranks a Gray code. Rank I (binary) 0 0 0 0 0 0 0 1 1 0 0 0 0 1 2 3 0 0 0 1 1 3 2 0 0 0 1 0 4 6 0 0 1 1 0 5 7 0 0 1 1 1 6 5 0 0 1 0 1 7 4 0 0 1 0 0 8 12 0 1 1 0 0 9 13 0 1 1 0 1 10 15 0 1 1 1 1 11 14 0 1 1 1 0 12 10 0 1 0 1 0 13 11 0 1 0 1 1 14 9 0 1 0 0 1 15 8 0 1 0 0 0 16 24 1 1 0 0 0 17 25 1 1 0 0 1 18 27 1 1 0 1 1 19 26 1 1 0 1 0 20 30 1 1 1 1 0 21 31 1 1 1 1 1 22 29 1 1 1 0 1 23 28 1 1 1 0 0 24 20 1 0 1 0 0 25 21 1 0 1 0 1 26 23 1 0 1 1 1 27 22 1 0 1 1 0 28 18 1 0 0 1 0 29 19 1 0 0 1 1 30 17 1 0 0 0 1 31 16 1 0 0 0 0 ubvec_test Normal end of execution. 10-Feb-2019 17:11:21