B = 2.6. )divisionabsolute_importprint_function)ABCMetaabstractmethodabstractproperty)NumberN) polyutils ABCPolyBasec@seZdZdZeZdZdZdZe ddZ e ddZ e dd Z e d d Ze d d Ze ddZe ddZe ddZe ddZe ddZe ddZe ddZe ddZe ddZe d d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zdd,d-Zd.d/Z d0d1Z!d2d3Z"d4d5Z#d6d7Z$d8d9Z%d:d;Z&dd?Z(d@dAZ)dBdCZ*dDdEZ+dFdGZ,dHdIZ-dJdKZ.dLdMZ/dNdOZ0dPdQZ1dRdSZ2dTdUZ3dVdWZ4dXdYZ5dZd[Z6d\d]Z7d^d_Z8d`daZ9dbdcZ:dddeZ;dfdgZddmdnZ?dodpZ@ddqdrZAdsdtZBdugdfdvdwZCddxdyZDdzd{ZEdd|d}ZFeGdddZHeGgdfddZIeGdddZJeGdddZKeGdddZLdS)r aAn abstract base class for series classes. ABCPolyBase provides the standard Python numerical methods '+', '-', '*', '//', '%', 'divmod', '**', and '()' along with the methods listed below. .. versionadded:: 1.9.0 Parameters ---------- coef : array_like Series coefficients in order of increasing degree, i.e., ``(1, 2, 3)`` gives ``1*P_0(x) + 2*P_1(x) + 3*P_2(x)``, where ``P_i`` is the basis polynomials of degree ``i``. domain : (2,) array_like, optional Domain to use. The interval ``[domain[0], domain[1]]`` is mapped to the interval ``[window[0], window[1]]`` by shifting and scaling. The default value is the derived class domain. window : (2,) array_like, optional Window, see domain for its use. The default value is the derived class window. Attributes ---------- coef : (N,) ndarray Series coefficients in order of increasing degree. domain : (2,) ndarray Domain that is mapped to window. window : (2,) ndarray Window that domain is mapped to. Class Attributes ---------------- maxpower : int Maximum power allowed, i.e., the largest number ``n`` such that ``p(x)**n`` is allowed. This is to limit runaway polynomial size. domain : (2,) ndarray Default domain of the class. window : (2,) ndarray Default window of the class. NdcCsdS)N)selfr r M/opt/alt/python37/lib64/python3.7/site-packages/numpy/polynomial/_polybase.pydomainIszABCPolyBase.domaincCsdS)Nr )rr r rwindowMszABCPolyBase.windowcCsdS)Nr )rr r rnicknameQszABCPolyBase.nicknamecCsdS)Nr )rr r r_addUszABCPolyBase._addcCsdS)Nr )rr r r_subYszABCPolyBase._subcCsdS)Nr )rr r r_mul]szABCPolyBase._mulcCsdS)Nr )rr r r_divaszABCPolyBase._divcCsdS)Nr )rr r r_poweszABCPolyBase._powcCsdS)Nr )rr r r_valiszABCPolyBase._valcCsdS)Nr )rr r r_intmszABCPolyBase._intcCsdS)Nr )rr r r_derqszABCPolyBase._dercCsdS)Nr )rr r r_fituszABCPolyBase._fitcCsdS)Nr )rr r r_lineyszABCPolyBase._linecCsdS)Nr )rr r r_roots}szABCPolyBase._rootscCsdS)Nr )rr r r _fromrootsszABCPolyBase._fromrootscCs6t|jt|jkrdSt|j|jks.dSdSdS)aGCheck if coefficients match. .. versionadded:: 1.6.0 Parameters ---------- other : class instance The other class must have the ``coef`` attribute. Returns ------- bool : boolean True if the coefficients are the same, False otherwise. FTN)lencoefnpall)rotherr r r has_samecoefs zABCPolyBase.has_samecoefcCst|j|jkS)a?Check if domains match. .. versionadded:: 1.6.0 Parameters ---------- other : class instance The other class must have the ``domain`` attribute. Returns ------- bool : boolean True if the domains are the same, False otherwise. )r!r"r)rr#r r rhas_samedomainszABCPolyBase.has_samedomaincCst|j|jkS)a?Check if windows match. .. versionadded:: 1.6.0 Parameters ---------- other : class instance The other class must have the ``window`` attribute. Returns ------- bool : boolean True if the windows are the same, False otherwise. )r!r"r)rr#r r rhas_samewindowszABCPolyBase.has_samewindowcCs t||jS)aCheck if types match. .. versionadded:: 1.7.0 Parameters ---------- other : object Class instance. Returns ------- bool : boolean True if other is same class as self ) isinstance __class__)rr#r r r has_sametypeszABCPolyBase.has_sametypecCs`t|tr\t||js tdn6t|j|jks= 1.11.0 a list of integers specifying the degrees of the terms to include may be used instead. domain : {None, [beg, end], []}, optional Domain to use for the returned series. If ``None``, then a minimal domain that covers the points `x` is chosen. If ``[]`` the class domain is used. The default value was the class domain in NumPy 1.4 and ``None`` in later versions. The ``[]`` option was added in numpy 1.5.0. rcond : float, optional Relative condition number of the fit. Singular values smaller than this relative to the largest singular value will be ignored. The default value is len(x)*eps, where eps is the relative precision of the float type, about 2e-16 in most cases. full : bool, optional Switch determining nature of return value. When it is False (the default) just the coefficients are returned, when True diagnostic information from the singular value decomposition is also returned. w : array_like, shape (M,), optional Weights. If not None the contribution of each point ``(x[i],y[i])`` to the fit is weighted by `w[i]`. Ideally the weights are chosen so that the errors of the products ``w[i]*y[i]`` all have the same variance. The default value is None. .. versionadded:: 1.5.0 window : {[beg, end]}, optional Window to use for the returned series. The default value is the default class domain .. versionadded:: 1.6.0 Returns ------- new_series : series A series that represents the least squares fit to the data and has the domain specified in the call. [resid, rank, sv, rcond] : list These values are only returned if `full` = True resid -- sum of squared residuals of the least squares fit rank -- the numerical rank of the scaled Vandermonde matrix sv -- singular values of the scaled Vandermonde matrix rcond -- value of `rcond`. For more details, see `linalg.lstsq`. Nr)wrcondfull)rr) r. getdomainrSlistrrrrtr) clsrxryrjrr{r|rzrZxnewrVr Zstatusr r rfitsG zABCPolyBase.fitc Cstj|gdd\}|dkr&t|}nt|tkrDt|dkrD|j}|dkrR|j}t|}t||\}}|||}| |||}||||dS)a+Return series instance that has the specified roots. Returns a series representing the product ``(x - r[0])*(x - r[1])*...*(x - r[n-1])``, where ``r`` is a list of roots. Parameters ---------- roots : array_like List of roots. domain : {[], None, array_like}, optional Domain for the resulting series. If None the domain is the interval from the smallest root to the largest. If [] the domain is the class domain. The default is []. window : {None, array_like}, optional Window for the returned series. If None the class window is used. The default is None. Returns ------- new_series : series Series with the specified roots. F)r,Nr)rr) r.r/r}rSr~rrrr@r) rrurrrjrBrCZrnewr r r r fromroots,s  zABCPolyBase.fromrootscCsD|dkr|j}|dkr|j}t||\}}|||}||||S)a6Identity function. If ``p`` is the returned series, then ``p(x) == x`` for all values of x. Parameters ---------- domain : {None, array_like}, optional If given, the array must be of the form ``[beg, end]``, where ``beg`` and ``end`` are the endpoints of the domain. If None is given then the class domain is used. The default is None. window : {None, array_like}, optional If given, the resulting array must be if the form ``[beg, end]``, where ``beg`` and ``end`` are the endpoints of the window. If None is given then the class window is used. The default is None. Returns ------- new_series : series Series of representing the identity. N)rrr.r@r)rrrrBrCr r r rrnUs zABCPolyBase.identitycCsT|dkr|j}|dkr|j}t|}||ks4|dkr= 0. domain : {None, array_like}, optional If given, the array must be of the form ``[beg, end]``, where ``beg`` and ``end`` are the endpoints of the domain. If None is given then the class domain is used. The default is None. window : {None, array_like}, optional If given, the resulting array must be if the form ``[beg, end]``, where ``beg`` and ``end`` are the endpoints of the window. If None is given then the class window is used. The default is None. Returns ------- new_series : series A series with the coefficient of the `deg` term set to one and all others zero. Nrz deg must be non-negative integerr )rrrlr0)rrjrrZidegr r rbasisvszABCPolyBase.basiscCs*|dkr|j}|dkr|j}||||S)aConvert series to series of this class. The `series` is expected to be an instance of some polynomial series of one of the types supported by by the numpy.polynomial module, but could be some other class that supports the convert method. .. versionadded:: 1.7.0 Parameters ---------- series : series The series instance to be converted. domain : {None, array_like}, optional If given, the array must be of the form ``[beg, end]``, where ``beg`` and ``end`` are the endpoints of the domain. If None is given then the class domain is used. The default is None. window : {None, array_like}, optional If given, the resulting array must be if the form ``[beg, end]``, where ``beg`` and ``end`` are the endpoints of the window. If None is given then the class window is used. The default is None. Returns ------- new_series : series A series of the same kind as the calling class and equal to `series` when evaluated. See Also -------- convert : similar instance method N)rrro)rZseriesrrr r rcasts $zABCPolyBase.cast)NN)r)NNN)r )r N)NNFNN)NN)NN)NN)Mr5 __module__ __qualname____doc__rZ __metaclass____hash__Z__array_ufunc__r[rrrrrrrrrrrrrrrrrr$r%r&r)r+r1r8r:r=r?rDrFrGrHrIrMrNrOrQrTrPrWrUr\r]r^r_rarbr`rdrcrfrgr<rhrkr,riror@rrrsrurv classmethodrrrnrrr r r rr s*               $          (!   V(  &)rZ __future__rrrabcrrrZnumbersrZnumpyr!r r.__all__objectr r r r rs