spyrit.core.torch.walsh_matrix_2d
- spyrit.core.torch.walsh_matrix_2d(n)[source]
2D Walsh-ordered Hadamard matrix.
This is the matrix \(A\in\mathbb{R}^{n^2 \times n^2}\) such that \(Ax\) represents the 2D Hadamard transform of the vectorised image \(x\).
- Args:
n(int): Order of the transform \(n\), which must be a power of two.- Raises:
ValueError: If
nis not a positive integer that is a power of 2.- Returns:
torch.Tensor: Matrix \(A\) with shape \((n^2,n^2)\).