13 June 2018 04:08:11 PM

UBVEC_TEST
  C version
  Test the UBVEC library.

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_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

KSUBSET_ENUM_TEST
  KSUBSET_ENUM enumerates K subsets of an N set.

      N:      0       1       2       3       4       5
   M
   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
   6:         1       6      15      20      15       6
   7:         1       7      21      35      35      21
   8:         1       8      28      56      70      56
   9:         1       9      36      84     126     126
  10:         1      10      45     120     210     252

KSUBSET_COLEX_UNRANK_TEST
  KSUBSET_COLEX_UNRANK unranks
  K-subsets of an N set,
  using the colexicographic ordering:

  The element of rank 5

           5           3           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)


  UI1, UI2, UI3 in decimal:

    218    957    871
  I1, I2, I3 in binary:

  00000000000000000000000011011010
  00000000000000000000001110111101
  00000000000000000000001101100111

  UI1, UI2, UI3 in decimal:

    830    562    268
  I1, I2, I3 in binary:

  00000000000000000000001100111110
  00000000000000000000001000110010
  00000000000000000000000100001100

  UI1, UI2, UI3 in decimal:

    415     66    477
  I1, I2, I3 in binary:

  00000000000000000000000110011111
  00000000000000000000000001000010
  00000000000000000000000111011101

  UI1, UI2, UI3 in decimal:

    257    110    367
  I1, I2, I3 in binary:

  00000000000000000000000100000001
  00000000000000000000000001101110
  00000000000000000000000101101111

  UI1, UI2, UI3 in decimal:

     43    634    593
  I1, I2, I3 in binary:

  00000000000000000000000000101011
  00000000000000000000001001111010
  00000000000000000000001001010001

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_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
  0001
  0010
  0011
  0100
  0101
  0110
  0111
  1000
  1001
  1010
  1011
  1100
  1101
  1110
  1111

UBVEC_NEXT_GRAY_TEST
  UBVEC_NEXT_GRAY returns the next UBVEC in the Gray code.

   K  UBVEC

   4:  0000
   4:  0001
   4:  0011
   4:  0010
   4:  0110
   4:  0111
   4:  0101
   4:  0100
   4:  1100
   4:  1101
   4:  1111
   4:  1110
   4:  1010
   4:  1011
   4:  1001
   4:  1000

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:
  1001011100

UBVEC_RANDOM_TEST
  UBVEC_RANDOM randomizes an unsigned binary vector.

  10001
  11110
  11100
  10111
  00111

UBVEC_RANK_GRAY_TEST
  UBVEC_RANK_GRAY ranks a UBVEC in the Gray ordering.

  UBVEC   Rank

  00000   0
  00001   1
  00010   3
  00011   2
  00100   7
  00101   6
  00110   4
  00111   5
  01000  15
  01001  14
  01010  12
  01011  13
  01100   8
  01101   9
  01110  11
  01111  10
  10000  31
  10001  30
  10010  28
  10011  29
  10100  24
  10101  25
  10110  27
  10111  26
  11000  16
  11001  17
  11010  19
  11011  18
  11100  23
  11101  22
  11110  20
  11111  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;

  I --> UBVEC  -->  I

  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  00000
   1  00001
   2  00011
   3  00010
   4  00110
   5  00111
   6  00101
   7  00100
   8  01100
   9  01101
  10  01111
  11  01110
  12  01010
  13  01011
  14  01001
  15  01000
  16  11000
  17  11001
  18  11011
  19  11010
  20  11110
  21  11111
  22  11101
  23  11100
  24  10100
  25  10101
  26  10111
  27  10110
  28  10010
  29  10011
  30  10001
  31  10000

UBVEC_UNRANK_GRLEX_TEST
  UBVEC_UNRANK_GRLEX returns the UBVEC of given rank
  in the graded lexicographical ordering.
  --  --------
   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

UBVEC_XOR_TEST
  UBVEC_XOR exclusive-ors two unsigned binary vectors 
  representing unsigned integers;

        I        J        K = I XOR J

        22        96       118
        83        56       139
        41         6        47
        26        11        37
         4        64        68
         6        45        51
        40        76       116
        80         0        80
        90        35       125
         9         1        10

UI4_RANK_GRAY_TEST
  UI4_RANK_GRAY ranks an unsigned I4 in the Gray ordering.

 UI4  Rank  (binary)

   0     0  00000
   1     1  00001
   2     3  00010
   3     2  00011
   4     7  00100
   5     6  00101
   6     4  00110
   7     5  00111
   8    15  01000
   9    14  01001
  10    12  01010
  11    13  01011
  12     8  01100
  13     9  01101
  14    11  01110
  15    10  01111
  16    31  10000
  17    30  10001
  18    28  10010
  19    29  10011
  20    24  10100
  21    25  10101
  22    27  10110
  23    26  10111
  24    16  11000
  25    17  11001
  26    19  11010
  27    18  11011
  28    23  11100
  29    22  11101
  30    20  11110
  31    21  11111

UI4_TO_UBVEC_TEST
  UI4_TO_UBVEC converts an unsigned integer to an 
  unsigned binary vector;

  I --> UBVEC  -->  I

  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

UI4_UNRANK_GRAY_TEST
  UI4_UNRANK_GRAY unranks a Gray code.

  Rank   I  (binary)

   0     0  00000
   1     1  00001
   2     3  00011
   3     2  00010
   4     6  00110
   5     7  00111
   6     5  00101
   7     4  00100
   8    12  01100
   9    13  01101
  10    15  01111
  11    14  01110
  12    10  01010
  13    11  01011
  14     9  01001
  15     8  01000
  16    24  11000
  17    25  11001
  18    27  11011
  19    26  11010
  20    30  11110
  21    31  11111
  22    29  11101
  23    28  11100
  24    20  10100
  25    21  10101
  26    23  10111
  27    22  10110
  28    18  10010
  29    19  10011
  30    17  10001
  31    16  10000

UBVEC_TEST
  Normal end of execution.

13 June 2018 04:08:11 PM