sdr.binary_code(length: int) NDArray[int_]

Generates a binary code of length \(n = 2^m\).

Parameters:
length: int

The length \(n = 2^m\) of the binary code.

Returns:

A binary code of length \(n = 2^m\).

Examples

In [1]: sdr.binary_code(2)
Out[1]: array([0, 1])

In [2]: sdr.binary_code(4)
Out[2]: array([0, 1, 2, 3])

In [3]: sdr.binary_code(8)
Out[3]: array([0, 1, 2, 3, 4, 5, 6, 7])

In [4]: sdr.binary_code(16)
Out[4]: array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15])