spyrit.misc.walsh_hadamard.sequency_perm_matrix

spyrit.misc.walsh_hadamard.sequency_perm_matrix(n)[source]

Return permutation matrix to get sequency from the natural order

Args:

n (int): Order of the matrix, a power of two.

Returns:

np.ndarray: A n-by-n permutation matrix

Examples:

Permutation matrix of order 8

>>> print(sequency_perm_matrix(8))
[[1. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 1. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 1. 0.]
 [0. 0. 1. 0. 0. 0. 0. 0.]
 [0. 0. 0. 1. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 1.]
 [0. 0. 0. 0. 0. 1. 0. 0.]
 [0. 1. 0. 0. 0. 0. 0. 0.]]