levdur#

class diffsptk.LevinsonDurbin(lpc_order: int, eps: float | None = None, device: device | None = None, dtype: dtype | None = None)[source]#

See this page for details. The implementation is based on a simple matrix inversion.

Parameters:
lpc_orderint >= 0

The order of the LPC coefficients, \(M\).

epsfloat >= 0 or None

A small value to improve numerical stability. If None, automatically set based on the data type.

devicetorch.device or None

The device of this module.

dtypetorch.dtype or None

The data type of this module.

forward(r: Tensor) Tensor[source]#

Solve a Yule-Walker linear system.

Parameters:
rTensor [shape=(…, M+1)]

The autocorrelation.

Returns:
outTensor [shape=(…, M+1)]

The gain and the LPC coefficients.

Examples

>>> import diffsptk
>>> acorr = diffsptk.Autocorrelation(5, 2)
>>> levdur = diffsptk.LevinsonDurbin(2)
>>> x = diffsptk.ramp(1, 5) * 0.1
>>> a = levdur(acorr(x))
>>> a
tensor([ 0.5054, -0.8140,  0.1193])
diffsptk.functional.levdur(r: Tensor, eps: float | None = None) Tensor[source]#

Solve a Yule-Walker linear system.

Parameters:
rTensor [shape=(…, M+1)]

The autocorrelation.

epsfloat >= 0 or None

A small value to improve numerical stability. If None, automatically set based on the input data type.

Returns:
outTensor [shape=(…, M+1)]

The gain and LPC coefficients.

See also

acorr lpc rlevdur