pol_root#
- class diffsptk.RootsToPolynomial(order, *, eps=None, in_format='rectangular')[source]#
This is the opposite module to
PolynomialToRoots()
.- Parameters:
- orderint >= 1
The order of the polynomial.
- epsfloat >= 0 or None
If the absolute values of the imaginary parts of the polynomial coefficients are all less than this value, they are considered as real numbers.
- in_format[‘rectangular’, ‘polar’]
The input format.
- forward(x)[source]#
Convert roots to polynomial coefficients.
- Parameters:
- xTensor [shape=(…, M)]
The roots, can be complex.
- Returns:
- outTensor [shape=(…, M+1)]
The 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, *, eps=None, in_format='rectangular')[source]#
Convert roots to polynomial coefficients.
- Parameters:
- xTensor [shape=(…, M)]
The roots, can be complex.
- epsfloat >= 0 or None
If the absolute values of the imaginary parts of the polynomial coefficients are all less than this value, they are considered as real numbers.
- in_format[‘rectangular’, ‘polar’]
The input format.
- Returns:
- outTensor [shape=(…, M+1)]
The polynomial coefficients.
See also