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

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

Parameters:
n: int

The length of the binary code.

Returns:

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

Examples

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

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

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

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