komm.FibonacciCode
Fibonacci code. It is an integer code. For the definition of this code, see Wikipedia: Fibonacci coding.
encode()
Encode the input integer array.
Parameters:
-
input
(ArrayLike
) –The input integer array. It must be a one-dimensional array.
Returns:
-
output
(NDArray[integer]
) –The sequence of bits corresponding to the input integer array.
Examples:
>>> code = komm.FibonacciCode()
>>> code.encode([4, 1, 3])
array([1, 0, 1, 1, 1, 1, 0, 0, 1, 1])
decode()
Decode the input bit array.
Parameters:
-
input
(ArrayLike
) –The input bit array. It must be a one-dimensional array.
Returns:
-
output
(NDArray[integer]
) –The sequence of integers corresponding to the input bit array.
Examples:
>>> code = komm.FibonacciCode()
>>> code.decode([1, 0, 1, 1, 1, 1, 0, 0, 1, 1])
array([4, 1, 3])