dht#

diffsptk.DHT#

alias of DiscreteHartleyTransform

class diffsptk.DiscreteHartleyTransform(dht_length, dht_type=2)[source]#

Discrete Hartley transform module.

Parameters:
dht_lengthint >= 1

The DHT length, \(L\).

dht_typeint in [1, 4]

The DHT type.

forward(x)[source]#

Apply DHT to the input.

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

The input.

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

The DHT output.

Examples

>>> x = diffsptk.ramp(3)
>>> dht = diffsptk.DHT(4)
>>> y = dht(x)
>>> y
tensor([ 3.0000, -1.4142, -1.0000, -1.4142])
diffsptk.functional.dht(x, dht_type=2)[source]#

Compute DHT.

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

The input.

dht_typeint in [1, 4]

The DHT type.

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

The DHT output.

See also

idht