spyrit.misc.walsh_hadamard.sequency_perm
- spyrit.misc.walsh_hadamard.sequency_perm(X, ind=None)[source]
Permute the last dimension of a tensor. By defaults this allows the sequency order to be obtained from the natural order.
- Args:
X(np.ndarray): input of shape (*,n).ind: list of index length n. Defaults to indices to get sequency order.- Returns:
np.ndarray: output of shape (*,n)
- Example :
>>> import spyrit.misc.walsh_hadamard as wh >>> x = torch.tensor([1, 3, 0, -1, 7, 5, 1, -2]) >>> x = x[None, None, :] >>> x = wh.sequency_perm(x) >>> print(x) tensor([[[ 1, 7, 1, 0, -1, -2, 5, 3]]]) >>> print(x.shape) torch.Size([1, 1, 8])