root_pol#

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

See this page for details.

orderint >= 1 [scalar]

Order of coefficients.

out_format[‘rectangular’, ‘polar’]

Output format.

forward(a)[source]#

Find roots of polynomial.

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

Polynomial coefficients.

Returns:
xTensor [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]])

See also

pol_root