07-Jan-2022 16:45:11 bvec_test(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Test bvec(). bvec_add_test(): bvec_add() adds binary vectors representing integers; I J I + J BVEC_ADD 63 82 145 145 -75 83 8 8 27 -81 -54 -54 -45 9 -36 -36 92 93 185 185 -69 95 26 26 92 -3 89 89 60 -72 -12 -12 -16 84 68 68 59 92 151 151 bvec_complement2_test(): bvec_complement2() returns the two's complement of a (signed) binary vector; I = 31 J = -31 0000011111 1111100001 I = -93 J = 93 1110100011 0001011101 I = 70 J = -70 0001000110 1110111010 I = 87 J = -87 0001010111 1110101001 I = 36 J = -36 0000100100 1111011100 bvec_mul_test(): bvec_mul() multiplies binary vectors representing integers; I J I * J BVEC_MUL 52 49 2548 2548 -22 31 -682 -682 -66 41 -2706 -2706 -94 -45 4230 4230 -91 -81 7371 7371 65 39 2535 2535 -37 90 -3330 -3330 -94 -12 1128 1128 -24 53 -1272 -1272 59 -63 -3717 -3717 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 -2 -11 9 9 29 42 -13 -13 51 -45 96 96 36 31 5 5 -68 -77 9 9 0 92 -92 -92 -32 17 -49 -49 -56 51 -107 -107 -49 1 -50 -50 40 79 -39 -39 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 1 0 0 0 1 0 1 0 1 1010100011 bvec = 0 0 0 1 0 0 1 1 1 1 1111001000 bvec = 0 1 1 0 1 0 0 1 1 1 1110010110 bvec = 0 1 0 0 0 0 1 0 1 0 0101000010 bvec = 1 0 1 1 1 0 0 0 1 0 0100011101 bvec = 1 1 1 0 0 0 1 0 1 1 1101000111 bvec = 1 0 0 0 1 0 1 0 0 0 0001010001 bvec = 0 1 1 1 0 1 1 0 1 0 0101101110 bvec = 0 0 0 0 0 0 0 1 1 0 0110000000 bvec = 0 0 1 0 0 1 0 0 0 0 0000100100 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. 07-Jan-2022 16:45:11