| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Python312/Lib/site-packages/numpy/polynomial/__pycache__/ |
Upload File : |
�
�g�Z � �� � d Z ddlZddlZddlZddlZddlmZmZ ddl m
Z
g d�Zd� Zdd�Z
dd�Zd � Zd
� Zd� Zd� Zd
� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zdd�Zd� Zd� Zdd�Zy)an
Utility classes and functions for the polynomial modules.
This module provides: error and warning objects; a polynomial base class;
and some routines used in both the `polynomial` and `chebyshev` modules.
Functions
---------
.. autosummary::
:toctree: generated/
as_series convert list of array_likes into 1-D arrays of common type.
trimseq remove trailing zeros.
trimcoef remove small trailing coefficients.
getdomain return the domain appropriate for a given set of abscissae.
mapdomain maps points between domains.
mapparms parameters of the linear map between domains.
� N)�dragon4_positional�dragon4_scientific)�RankWarning)� as_series�trimseq�trimcoef� getdomain� mapdomain�mapparms�format_floatc � � t | � dk( s| d dk7 r| S t t | � dz
dd� D ] }| | dk7 s� n | ddz S )a� Remove small Poly series coefficients.
Parameters
----------
seq : sequence
Sequence of Poly series coefficients.
Returns
-------
series : sequence
Subsequence with trailing zeros removed. If the resulting sequence
would be empty, return the first element. The returned sequence may
or may not be a view.
Notes
-----
Do not lose the type info if the sequence contains unknown objects.
r ���� N)�len�range)�seq�is �<C:\Python312\Lib\site-packages\numpy/polynomial/polyutils.pyr r % s^ � �( �3�x�1�}��B��1���
��s�3�x�!�|�R��,� �A��1�v��{�� � �4�A�a�C�y�� c �. � | D �cg c] }t j |dd�� �� }}|D ] }|j dk( s�t d� � t d� |D � � rt d� �|r|D �cg c]
}t |� �� }}t d� |D � � r�g }|D ]� }|j t j t � k7 rQt j t |� t j t � � � }|dd |dd |j |� �z|j |j � � �� |S t j |� }|D �cg c] }t j |d|�� �� }}|S c c}w c c}w # t $ r}t d
� |�d}~ww xY wc c}w )
a-
Return argument as a list of 1-d arrays.
The returned list contains array(s) of dtype double, complex double, or
object. A 1-d argument of shape ``(N,)`` is parsed into ``N`` arrays of
size one; a 2-d argument of shape ``(M,N)`` is parsed into ``M`` arrays
of size ``N`` (i.e., is "parsed by row"); and a higher dimensional array
raises a Value Error if it is not first reshaped into either a 1-d or 2-d
array.
Parameters
----------
alist : array_like
A 1- or 2-d array_like
trim : boolean, optional
When True, trailing zeros are removed from the inputs.
When False, the inputs are passed through intact.
Returns
-------
[a1, a2,...] : list of 1-D arrays
A copy of the input data as a list of 1-d arrays.
Raises
------
ValueError
Raised when `as_series` cannot convert its input to 1-d arrays, or at
least one of the resulting arrays is empty.
Examples
--------
>>> import numpy as np
>>> from numpy.polynomial import polyutils as pu
>>> a = np.arange(4)
>>> pu.as_series(a)
[array([0.]), array([1.]), array([2.]), array([3.])]
>>> b = np.arange(6).reshape((2,3))
>>> pu.as_series(b)
[array([0., 1., 2.]), array([3., 4., 5.])]
>>> pu.as_series((1, np.arange(3), np.arange(2, dtype=np.float16)))
[array([1.]), array([0., 1., 2.]), array([0., 1.])]
>>> pu.as_series([2, [1.1, 0.]])
[array([2.]), array([1.1])]
>>> pu.as_series([2, [1.1, 0.]], trim=False)
[array([2.]), array([1.1, 0. ])]
r N)�ndmin�copyr zCoefficient array is emptyc 3 �: K � | ] }|j d k7 �� � y�w)r N)�ndim��.0�as r � <genexpr>zas_series.<locals>.<genexpr>y s � �� �
'�1�1�6�6�Q�;�
'�s �zCoefficient array is not 1-dc 3 �h K � | ]* }|j t j t � k( �� �, y �w�N)�dtype�np�objectr s r r zas_series.<locals>.<genexpr>~ s"