spyrit.core.torch.walsh_matrix
- spyrit.core.torch.walsh_matrix(n)[source]
Returns a 1D Walsh-ordered Hadamard transform matrix of size \(n \times n\).
- Args:
n (int): Order of the Hadamard matrix. Must be a power of two.
- Raises:
ValueError: If n is not a positive integer or if n is not a power of 2.
- Returns:
torch.tensor: A n-by-n matrix representing the Walsh-ordered Hadamard matrix.