comnum.pack_symbols#

comnum.pack_symbols(bits, m)#

Pack bits into symbols of m bits, the most significant first.

Parameters:
  • bits (array_like) – a multiple of m bits.

  • m (int) – bits per symbol, 1 to 16.

Returns:

the symbols (int64).

Return type:

numpy.ndarray

Raises:

ValueError – for an invalid parameter or input (the message names it).

Examples

>>> import comnum
>>> comnum.pack_symbols([1, 0, 1, 1, 1, 1, 0, 0], 4).tolist()
[11, 12]