root_pol#

class diffsptk.DurandKernerMethod(order, n_iter=100, eps=1e-14, out_format='rectangular')[source]#

See this page for details.

orderint >= 1 [scalar]

Order of coefficients.

n_iterint >= 1 [scalar]

Number of iterations.

epsfloat >= 0 [scalar]

Convergence threshold.

out_format[‘rectangular’, ‘polar’]

Output format.

forward(a)[source]#

Find roots of equations.

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

Polynomial coefficients.

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

Complex roots.

is_convergedTensor [shape=(…,)]

True if convergence is reached.

Examples

>>> a = torch.tensor([3, 4, 5])
>>> root_pol = diffsptk.DurandKernerMethod(a.size(-1) - 1)
>>> x, is_converged = root_pol(a)
>>> x
tensor([[-0.6667+1.1055j, -0.6667-1.1055j]])
>>> is_converged
tensor([True])