pol_root#

class diffsptk.RootsToPolynomial(order)[source]#

This is the opposite module to PolynomialToRoots().

Parameters:
orderint >= 1

Order of polynomial.

forward(x, real=False)[source]#

Convert roots to polynomial coefficients.

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

Complex roots.

realbool

If True, return as real numbers.

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

Polynomial coefficients.

Examples

>>> x = torch.tensor([3, 4, -1])
>>> pol_root = diffsptk.RootsToPolynomial(x.size(-1))
>>> a = pol_root(x)
>>> a
tensor([ 1, -6,  5, 12])
diffsptk.functional.pol_root(x, real=False)[source]#

Compute polynomial coefficients from roots.

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

Complex roots.

realbool

If True, return as real numbers.

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

Polynomial coefficients.

See also

root_pol