spyrit.core.torch.walsh2_matrix

spyrit.core.torch.walsh2_matrix(n)[source]

Returns Walsh-ordered Hadamard matrix in 2D.

Args:

n (int): Order of the matrix, which 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*n-by-n*n matrix representing the 2D Walsh-ordered Hadamard matrix.