spyrit.misc.walsh_hadamard.iwalsh_S_matrix
- spyrit.misc.walsh_hadamard.iwalsh_S_matrix(n, H=None)[source]
Return the inverse Walsh S-matrix of order n.
- Args:
x(np.ndarray): signals of shape (*,n), where n+1 must be a power of two.H(np.ndarray, optional): Hadamard matrix of order n+1.- Returns:
np.ndarray: Inverse S-matrix of shape (n,n).
- Examples:
Example 1: Inverse Walsh S-matrix of order 7
>>> import spyrit.misc.walsh_hadamard as wh >>> print(wh.iwalsh_S_matrix(7)) [[-0.25 -0.25 -0.25 0.25 0.25 0.25 0.25] [-0.25 0.25 0.25 0.25 0.25 -0.25 -0.25] [-0.25 0.25 0.25 -0.25 -0.25 0.25 0.25] [ 0.25 0.25 -0.25 -0.25 0.25 0.25 -0.25] [ 0.25 0.25 -0.25 0.25 -0.25 -0.25 0.25] [ 0.25 -0.25 0.25 0.25 -0.25 0.25 -0.25] [ 0.25 -0.25 0.25 -0.25 0.25 -0.25 0.25]]
Example 2: Check the inverse of the Walsh S-matrix of order 7
>>> import spyrit.misc.walsh_hadamard as wh >>> print(wh.iwalsh_S_matrix(7) @ wh.walsh_S_matrix(7)) [[1. 0. 0. 0. 0. 0. 0.] [0. 1. 0. 0. 0. 0. 0.] [0. 0. 1. 0. 0. 0. 0.] [0. 0. 0. 1. 0. 0. 0.] [0. 0. 0. 0. 1. 0. 0.] [0. 0. 0. 0. 0. 1. 0.] [0. 0. 0. 0. 0. 0. 1.]]