root_pol#

class diffsptk.PolynomialToRoots(order, out_format='rectangular')[source]#

See this page for details.

Parameters:
orderint >= 1

Order of polynomial.

out_format[‘rectangular’, ‘polar’]

Output format.

forward(a)[source]#

Find roots of polynomial.

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

Polynomial coefficients.

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

Complex roots.

Examples

>>> a = torch.tensor([3, 4, 5])
>>> root_pol = diffsptk.PolynomialToRoots(a.size(-1) - 1)
>>> x = root_pol(a)
>>> x
tensor([[-0.6667+1.1055j, -0.6667-1.1055j]])
diffsptk.functional.root_pol(a, out_format='rectangular')[source]#

Compute roots of polynomial.

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

Polynomial coefficients.

out_format[‘rectangular’, ‘polar’]

Output format.

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

Roots of polynomial.

See also

pol_root