spyrit.misc.walsh_hadamard.walsh_G_matrix

spyrit.misc.walsh_hadamard.walsh_G_matrix(n, H=None)[source]

Return Walsh-ordered Hadamard G-matrix of order n

Args:

n (int): Matrix order. n+1 should be a power of two. H (np.ndarray, optional): Hadamard matrix of order n+1.

Returns:

np.ndarray: G-matrix of shape (n,n)

Examples:

Walsh-ordered Hadamard G-matrix of order 7

>>> import spyrit.misc.walsh_hadamard as wh
>>> print(wh.walsh_G_matrix(7))
[[ 1  1  1 -1 -1 -1 -1]
 [ 1 -1 -1 -1 -1  1  1]
 [ 1 -1 -1  1  1 -1 -1]
 [-1 -1  1  1 -1 -1  1]
 [-1 -1  1 -1  1  1 -1]
 [-1  1 -1 -1  1 -1  1]
 [-1  1 -1  1 -1  1 -1]]