

def is_invertible(polynomial, threshold=1.0):
    '\n    Determine if a polynomial is invertible.\n\n    Requires all roots of the polynomial lie inside the unit circle.\n\n    Parameters\n    ----------\n    polynomial : array_like or tuple, list\n        Coefficients of a polynomial, in order of increasing degree.\n        For example, `polynomial=[1, -0.5]` corresponds to the polynomial\n        :math:`1 - 0.5x` which has root :math:`2`. If it is a matrix\n        polynomial (in which case the coefficients are coefficient matrices),\n        a tuple or list of matrices should be passed.\n    threshold : number\n        Allowed threshold for `is_invertible` to return True. Default is 1.\n\n    Notes\n    -----\n\n    If the coefficients provided are scalars :math:`(c_0, c_1, \\dots, c_n)`,\n    then the corresponding polynomial is :math:`c_0 + c_1 L + \\dots + c_n L^n`.\n\n\n    If the coefficients provided are matrices :math:`(C_0, C_1, \\dots, C_n)`,\n    then the corresponding polynomial is :math:`C_0 + C_1 L + \\dots + C_n L^n`.\n\n    There are three equivalent methods of determining if the polynomial\n    represented by the coefficients is invertible:\n\n    The first method factorizes the polynomial into:\n\n    .. math::\n\n        C(L) & = c_0 + c_1 L + \\dots + c_n L^n \\\\\n             & = constant (1 - \\lambda_1 L)\n                 (1 - \\lambda_2 L) \\dots (1 - \\lambda_n L)\n\n    In order for :math:`C(L)` to be invertible, it must be that each factor\n    :math:`(1 - \\lambda_i L)` is invertible; the condition is then that\n    :math:`|\\lambda_i| < 1`, where :math:`\\lambda_i` is a root of the\n    polynomial.\n\n    The second method factorizes the polynomial into:\n\n    .. math::\n\n        C(L) & = c_0 + c_1 L + \\dots + c_n L^n \\\\\n             & = constant (L - \\zeta_1) (L - \\zeta_2) \\dots (L - \\zeta_3)\n\n    The condition is now :math:`|\\zeta_i| > 1`, where :math:`\\zeta_i` is a root\n    of the polynomial with reversed coefficients and\n    :math:`\\lambda_i = \\frac{1}{\\zeta_i}`.\n\n    Finally, a companion matrix can be formed using the coefficients of the\n    polynomial. Then the eigenvalues of that matrix give the roots of the\n    polynomial. This last method is the one actually used.\n\n    See Also\n    --------\n    companion_matrix\n    '
    eigvals = np.linalg.eigvals(companion_matrix(polynomial))
    return np.all((np.abs(eigvals) < threshold))

dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/tsa/statespace/tools.py is_invertible/original