wht#

diffsptk.WHT#

alias of WalshHadamardTransform

class diffsptk.WalshHadamardTransform(wht_length, wht_type='natural')[source]#

Walsh-Hadamard Transform module.

Parameters:
wht_lengthint >= 1

WHT length, \(L\), must be a power of 2.

wht_type[‘sequency’, ‘natural’, ‘dyadic’]

Order of coefficients of 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)[source]#

Apply WHT to input.

Parameters:
xTensor [shape=(…, L)]

Input.

Returns:
outTensor [shape=(…, L)]

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, wht_type='natural')[source]#

Compute WHT.

Parameters:
xTensor [shape=(…, L)]

Input signal.

wht_type[‘sequency’, ‘natural’, ‘dyadic’]

Order of coefficients of Walsh matrix.

Returns:
outTensor [shape=(…, L)]

WHT output.

See also

iwht