14-Oct-2022 08:51:21 bvec_test(): MATLAB/Octave version 4.2.2 Test bvec(). bvec_add_test(): bvec_add() adds binary vectors representing integers; I J I + J BVEC_ADD -81 -16 -97 -97 49 66 115 115 90 -66 24 24 48 69 117 117 -100 48 -52 -52 12 -1 11 11 38 -66 -28 -28 -96 -100 -196 -196 10 -59 -49 -49 48 23 71 71 bvec_complement2_test(): bvec_complement2() returns the two's complement of a (signed) binary vector; I = 86 J = -86 0001010110 1110101010 I = -56 J = 56 1111001000 0000111000 I = -54 J = 54 1111001010 0000110110 I = -46 J = 46 1111010010 0000101110 I = 72 J = -72 0001001000 1110111000 bvec_mul_test(): bvec_mul() multiplies binary vectors representing integers; I J I * J BVEC_MUL -63 88 -5544 -5544 -72 -68 4896 4896 -79 37 -2923 -2923 13 -27 -351 -351 -97 67 -6499 -6499 -44 -67 2948 2948 51 -87 -4437 -4437 -85 56 -4760 -4760 -31 24 -744 -744 -44 -66 2904 2904 bvec_next_test(): bvec_next() computes the "next" BVEC. 0000 1000 0100 1100 0010 1010 0110 1110 0001 1001 0101 1101 0011 1011 0111 1111 0000 bvec_next_grlex_test(): bvec_next_grlex() computes 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 bvec_print_test(): bvec_print() prints a binary vector. BVEC: 0011101001 bvec_sub_test(): bvec_sub() subtracts binary vectors representing integers; I J I - J BVEC_SUB 97 -8 105 105 -61 -87 26 26 -31 -30 -1 -1 -26 -32 6 6 -98 0 -98 -98 -4 1 -5 -5 98 8 90 90 58 6 52 52 72 -62 134 134 28 -1 29 29 bvec_to_i4_test(): bvec_to_i4() converts a signed binary vector to an integer; I --> BVEC --> I -3 1011111111 -3 -2 0111111111 -2 -1 1111111111 -1 0 0000000000 0 1 1000000000 1 2 0100000000 2 3 1100000000 3 4 0010000000 4 5 1010000000 5 6 0110000000 6 7 1110000000 7 8 0001000000 8 9 1001000000 9 10 0101000000 10 bvec_uniform_test(): bvec_uniform() computes a random binary vector bvec = 1 0 0 1 0 0 1 0 1 0 0101001001 bvec = 1 0 1 1 0 0 1 0 1 1 1101001101 bvec = 0 1 0 1 1 1 1 1 1 0 0111111010 bvec = 1 1 1 1 0 1 1 1 0 0 0011101111 bvec = 1 1 0 1 1 1 1 1 1 1 1111111011 bvec = 0 1 0 1 1 0 0 0 1 1 1100011010 bvec = 0 1 0 1 0 1 0 1 0 0 0010101010 bvec = 0 1 1 0 0 0 0 1 1 1 1110000110 bvec = 1 0 0 0 1 1 1 0 0 0 0001110001 bvec = 1 1 1 1 0 1 1 0 0 0 0001101111 i4_bclr_test(): i4_bclr() sets a given bit to 0. Working on I4 = 101 Pos Digit I4_BCLR 0 1 100 1 0 101 2 1 97 3 0 101 4 0 101 5 1 69 6 1 37 7 0 101 8 0 101 9 0 101 10 0 101 11 0 101 12 0 101 13 0 101 14 0 101 15 0 101 16 0 101 17 0 101 18 0 101 19 0 101 20 0 101 21 0 101 22 0 101 23 0 101 24 0 101 25 0 101 26 0 101 27 0 101 28 0 101 29 0 101 30 0 101 31 0 101 Working on I4 = -31 Pos Digit I4_BCLR 0 1 -32 1 0 -31 2 0 -31 3 0 -31 4 0 -31 5 1 -63 6 1 -95 7 1 -159 8 1 -287 9 1 -543 10 1 -1055 11 1 -2079 12 1 -4127 13 1 -8223 14 1 -16415 15 1 -32799 16 1 -65567 17 1 -131103 18 1 -262175 19 1 -524319 20 1 -1048607 21 1 -2097183 22 1 -4194335 23 1 -8388639 24 1 -16777247 25 1 -33554463 26 1 -67108895 27 1 -134217759 28 1 -268435487 29 1 -536870943 30 1 -1073741855 31 1 2147483617 i4_bset_test(): i4_bset() sets a given bit to 0. Working on I4 = 101 Pos Digit I4_BSET 0 1 101 1 0 103 2 1 101 3 0 109 4 0 117 5 1 101 6 1 101 7 0 229 8 0 357 9 0 613 10 0 1125 11 0 2149 12 0 4197 13 0 8293 14 0 16485 15 0 32869 16 0 65637 17 0 131173 18 0 262245 19 0 524389 20 0 1048677 21 0 2097253 22 0 4194405 23 0 8388709 24 0 16777317 25 0 33554533 26 0 67108965 27 0 134217829 28 0 268435557 29 0 536871013 30 0 1073741925 31 0 -2147483547 Working on I4 = -31 Pos Digit I4_BSET 0 1 -31 1 0 -29 2 0 -27 3 0 -23 4 0 -15 5 1 -31 6 1 -31 7 1 -31 8 1 -31 9 1 -31 10 1 -31 11 1 -31 12 1 -31 13 1 -31 14 1 -31 15 1 -31 16 1 -31 17 1 -31 18 1 -31 19 1 -31 20 1 -31 21 1 -31 22 1 -31 23 1 -31 24 1 -31 25 1 -31 26 1 -31 27 1 -31 28 1 -31 29 1 -31 30 1 -31 31 1 -31 i4_btest_test(): i4_btest() reports whether a given bit is 0 or 1. Analyze the integer I4 = 101 Pos Digit I4_BTEST 0 1 1 1 0 0 2 1 1 3 0 0 4 0 0 5 1 1 6 1 1 7 0 0 8 0 0 9 0 0 10 0 0 11 0 0 12 0 0 13 0 0 14 0 0 15 0 0 16 0 0 17 0 0 18 0 0 19 0 0 20 0 0 21 0 0 22 0 0 23 0 0 24 0 0 25 0 0 26 0 0 27 0 0 28 0 0 29 0 0 30 0 0 31 0 0 Analyze the integer I4 = -31 Pos Digit I4_BTEST 0 1 1 1 0 0 2 0 0 3 0 0 4 0 0 5 1 1 6 1 1 7 1 1 8 1 1 9 1 1 10 1 1 11 1 1 12 1 1 13 1 1 14 1 1 15 1 1 16 1 1 17 1 1 18 1 1 19 1 1 20 1 1 21 1 1 22 1 1 23 1 1 24 1 1 25 1 1 26 1 1 27 1 1 28 1 1 29 1 1 30 1 1 31 1 1 i4_to_bvec_test(): i4_to_bvec() converts an integer to a signed binary vector; I --> BVEC --> I -3 1011111111 -3 -2 0111111111 -2 -1 1111111111 -1 0 0000000000 0 1 1000000000 1 2 0100000000 2 3 1100000000 3 4 0010000000 4 5 1010000000 5 6 0110000000 6 7 1110000000 7 8 0001000000 8 9 1001000000 9 10 0101000000 10 bvec_test(): Normal end of execution. 14-Oct-2022 08:51:21