AlkantarClanX12
Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/lib/__pycache__/ |
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/lib/__pycache__/polynomial.cpython-311.pyc |
� �܋fe� � � � d Z g d�ZddlZddlZddlZddlmZ ddlmc m Z ddlmZm Z mZmZmZmZmZmZ ddlmZ ddlmZmZ dd lmZ dd lmZmZmZmZ ddlm Z m!Z!m"Z" ej# ej$ d� � � Z$ ed� � G d� de%� � � � Z&d� Z' e$e'� � d� � � Z(d� Z) e$e)� � d� � � Z*d*d�Z+ e$e+� � d+d�� � Z,d,d�Z- e$e-� � d-d�� � Z.d.d�Z/ e$e/� � d/d�� � Z0d� Z1 e$e1� � d� � � Z2d� Z3 e$e3� � d� � � Z4 e$e3� � d � � � Z5 e$e3� � d!� � � Z6d"� Z7 e$e7� � d#� � � Z8 ej9 d$� � Z:d0d&�Z; ed� � G d'� d(� � � � Z< ej= d)e&� � dS )1z' Functions to operate on polynomials. )�poly�roots�polyint�polyder�polyadd�polysub�polymul�polydiv�polyval�poly1d�polyfit�RankWarning� N� )� set_module)�isscalar�abs�finfo� atleast_1d�hstack�dot�array�ones)� overrides)�diag�vander)� trim_zeros)� iscomplex�real�imag�mintypecode)�eigvals�lstsq�inv�numpy)�modulec � � e Zd ZdZdS )r z� Issued by `polyfit` when the Vandermonde matrix is rank deficient. For more information, a way to suppress the warning, and an example of `RankWarning` being issued, see `polyfit`. N)�__name__� __module__�__qualname__�__doc__� � �K/opt/cloudlinux/venv/lib64/python3.11/site-packages/numpy/lib/polynomial.pyr r s � � � � � �� � �Dr, r c � � | S �Nr+ )�seq_of_zeross r- �_poly_dispatcherr1 ) s � ��r, c �l � t | � � } | j }t |� � dk r.|d |d k r|d dk rt | � � } n\t |� � dk r:| j }|t k r'| � t |j � � � � } nt d� � �t | � � dk rdS | j }t d|�� � }| D ]+}t j |t d| g|�� � d� � � }�,t |j j t j � � r�t j | t$ � � }t j t j |� � t j |� � � � � k � � r|j � � � }|S ) a$ Find the coefficients of a polynomial with the given sequence of roots. .. note:: This forms part of the old polynomial API. Since version 1.4, the new polynomial API defined in `numpy.polynomial` is preferred. A summary of the differences can be found in the :doc:`transition guide </reference/routines.polynomials>`. Returns the coefficients of the polynomial whose leading coefficient is one for the given sequence of zeros (multiple roots must be included in the sequence as many times as their multiplicity; see Examples). A square matrix (or array, which will be treated as a matrix) can also be given, in which case the coefficients of the characteristic polynomial of the matrix are returned. Parameters ---------- seq_of_zeros : array_like, shape (N,) or (N, N) A sequence of polynomial roots, or a square array or matrix object. Returns ------- c : ndarray 1D array of polynomial coefficients from highest to lowest degree: ``c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]`` where c[0] always equals 1. Raises ------ ValueError If input is the wrong shape (the input must be a 1-D or square 2-D array). See Also -------- polyval : Compute polynomial values. roots : Return the roots of a polynomial. polyfit : Least squares polynomial fit. poly1d : A one-dimensional polynomial class. Notes ----- Specifying the roots of a polynomial still leaves one degree of freedom, typically represented by an undetermined leading coefficient. [1]_ In the case of this function, that coefficient - the first one in the returned array - is always taken as one. (If for some reason you have one other point, the only automatic way presently to leverage that information is to use ``polyfit``.) The characteristic polynomial, :math:`p_a(t)`, of an `n`-by-`n` matrix **A** is given by :math:`p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})`, where **I** is the `n`-by-`n` identity matrix. [2]_ References ---------- .. [1] M. Sullivan and M. Sullivan, III, "Algebra and Trigonometry, Enhanced With Graphing Utilities," Prentice-Hall, pg. 318, 1996. .. [2] G. Strang, "Linear Algebra and Its Applications, 2nd Edition," Academic Press, pg. 182, 1980. Examples -------- Given a sequence of a polynomial's zeros: >>> np.poly((0, 0, 0)) # Multiple root example array([1., 0., 0., 0.]) The line above represents z**3 + 0*z**2 + 0*z + 0. >>> np.poly((-1./2, 0, 1./2)) array([ 1. , 0. , -0.25, 0. ]) The line above represents z**3 - z/4 >>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) array([ 1. , -0.77086955, 0.08618131, 0. ]) # random Given a square array object: >>> P = np.array([[0, 1./3], [-1./2, 0]]) >>> np.poly(P) array([1. , 0. , 0.16666667]) Note how in all cases the leading coefficient is always 1. r r � z.input must be 1d or non-empty square 2d array.� �?�r3 ��dtype�full)�mode)r �shape�lenr! r7 �object�astyper �char� ValueErrorr �NX�convolver � issubclass�type�complexfloating�asarray�complex�all�sort� conjugater �copy)r0 �sh�dt�a�zeror s r- r r - s� � �| �l�+�+�L� � �B� �2�w�w�!�|�|��1���A����2�a�5�A�:�:��|�,�,��� �R���A��� � �� ��<�<�'�.�.�{�2�7�/C�/C�D�D�L���I�J�J�J� �<���A����s� � �B��T�����A�� E� E���K��5�!�d�U��2�6�6�6�V�D�D�D����!�'�,�� 2�3�3� �� �<��1�1�� �6�"�'�%�.�.�B�G�E�O�O�,=�,=�$>�$>�>�?�?� ����� � �A��Hr, c � � | S r/ r+ )�ps r- �_roots_dispatcherrQ � s � ��Hr, c � � t | � � } | j dk rt d� � �t j t j | � � � � d }t |� � dk rt j g � � S t | � � |d z dz }| t |d � � t |d � � dz � } t | j j t j t j f� � s| � t � � } t | � � }|dk rWt! t j |dz f| j � � d� � }| dd� | d z |ddd�f<