wht#
- diffsptk.WHT#
alias of
WalshHadamardTransform
- class diffsptk.WalshHadamardTransform(wht_length: int, wht_type: str | int = 'natural')[source]#
Walsh-Hadamard Transform module.
- Parameters:
- wht_lengthint >= 1
The WHT length, \(L\), must be a power of 2.
- wht_type[‘sequency’, ‘natural’, ‘dyadic’]
The order of the coefficients in the Walsh matrix.
References
[1]K. Usha et al., “Generation of Walsh codes in two different orderings using 4-bit Gray and Inverse Gray codes,” Indian Journal of Science and Technology, vol. 5, no. 3, pp. 2341-2345, 2012.
- forward(x: Tensor) Tensor [source]#
Apply WHT to the input.
- Parameters:
- xTensor [shape=(…, L)]
The input.
- Returns:
- outTensor [shape=(…, L)]
The WHT output.
Examples
>>> x = diffsptk.ramp(3) >>> wht = diffsptk.WHT(4) >>> y = wht(x) >>> y tensor([ 3., -1., -2., 0.]) >>> z = wht(y) >>> z tensor([0., 1., 2., 3.])
- diffsptk.functional.wht(x: Tensor, wht_type: str = 'natural') Tensor [source]#
Apply WHT to the input.
- Parameters:
- xTensor [shape=(…, L)]
The input.
- wht_type[‘sequency’, ‘natural’, ‘dyadic’]
The order of the coefficients in the Walsh matrix.
- Returns:
- outTensor [shape=(…, L)]
The WHT output.
See also