HOME


sh-3ll 1.0
DIR:/usr/local/lib64/python3.6/site-packages/numpy/core/__pycache__/
Upload File :
Current File : //usr/local/lib64/python3.6/site-packages/numpy/core/__pycache__/getlimits.cpython-36.pyc
3

���h�J�@sjdZddgZddlZddlmZddlmZddlmZdd	lm	Z
dd
lmZmZddl
mZmZddlm
Z
d
d�Zdd�ZGdd�d�Ze
je
je
je
je
je
jiZdZe
jee
jdejd�d�e
jee
jdejd�d�e
j ee
j!dejd�d�e
j"ee
j#dejd�d�iZ$iZ%dd�Z&iZ'dd �Z(d!d"�Z)d#d$�Z*ed%�Gd&d�d��Z+ed%�Gd'd�d��Z,dS)(zJMachine limits for Float32 and Float64 and (long double) if available...

�finfo�iinfo�N�)�MachAr)�
set_module)�numeric)�numerictypes)�array�inf)�log10�exp2)�umathcCs|jdkr|j�}d|_|S)zfix rank-0 --> rank-1rr)r)�ndim�copy�shape)�a�r�5/tmp/pip-build-5_djhm0z/numpy/numpy/core/getlimits.py�_fr0s
rcCs|jdkr|j�}f|_|S)zfix rank > 0 --> rank-0r)�sizerr)rrrr�_fr1s
rc@seZdZdZdd�ZdS)�
MachArLikez$ Object to simulate MachAr instance c
s�t���fdd���fdd�}��fdd�}	�d|_||�|_|_||�|_||�|_|_||�|_|_�d|�|_	|j
j|�tt
|j��|_|�d�|j�|_|	|j�|_|	|j�|_|	|j�|_|	|j�|_|	|j�|_dS)Ncst|g��S)N)r	)�v)�ftyperr�<lambda>'sz%MachArLike.__init__.<locals>.<lambda>cst�|��S)N)r)r)�
float_convrrr(scs�dtt|�d��S)N�fmtr)r	r)r)r�paramsrrr)s�title�itype�
)�_MACHAR_PARAMSr�epsilon�eps�epsnegZxmax�hugeZxmin�tiny�ibeta�__dict__�update�intr�	precision�
resolution�_str_eps�_str_epsneg�	_str_xmin�	_str_xmax�_str_resolution)
�selfrr#r$r%r&r'�kwargsZfloat_to_floatZfloat_to_strr)rrrr�__init__#s$

zMachArLike.__init__N)�__name__�
__module__�__qualname__�__doc__r4rrrrr srz(numpy {} precision floating point numberz%24.16e�double)rrrz%15.7e�singlez%szlong doublez%12.5e�halfcCs|t|<dS)N)�_KNOWN_TYPES)�macharZbytepatrrr�_register_typeZsr>cCs�tj}t|d0d1d2ddddddt|d3��t|d4��|d�|d6�d	�}t|d
�|td<tj}t|d7d8d9ddddddt|d:��t|d;��|d>dd�t|d?��d	�}t|d�|td<tj}dA}dC}t|dDdEdFdddddddH|d|||d�|d	�}t|d�|td<tj}t|dI��}	t|dJ��}
t	j
d!d"��|d�|	|
|d�}WdQRXt|dKdLdMd$d#d%dddt|dN��|	||
d	�}t|d&�t|d&�|td<t|dO��}
t|dP��}t	j
d!d"��|d�|
||d�}WdQRXt|dQdRdSd$d'd%dddt|dT��|
||d	�}t|d(�|td)<ttd*��rDtj
|t�|d��n|j}t|dUdVdWdd+ddddt|dX��t|dY��|t|dZ��d	�}t|d-�t|d.�|td/<dS)[Nr �����ri�)
�machep�negep�minexp�maxexp�it�iexpr'ZirndZngrdr#r$r%r&sf����~��rs��̽� g@g�J@g�@�4�5i�igJ@g�?�s���������@�qi�?�ignore)�all�pi@�s�����������������?s
����������P�	nextafter�i�js������Y<��������s��������������Y<�ddi����i����i�i����i����i�g?i��i��i����i��i��i��gp>g��?i����g�J�g�<g�gi���i���i���gJ�g�<i����i���i����i����i���i����i����i���i����i����i���i����i����i����i���i����i����i���)�ntypesZfloat16rrr>�	_float_maZfloat32Zfloat64�
longdoublerZerrstate�hasattrr
r[r
r%)Zf16Z
float16_maZf32Z
float32_maZf64Z
epsneg_f64Ztiny_f64Z
float64_ma�ldZepsneg_f128Z	tiny_f128Z	huge_f128Zfloat128_maZ
epsneg_f80Ztiny_f80Zhuge_f80Z
float80_maZhuge_ddZfloat_dd_marrr�_register_known_types^s�






"
"

 

rdcCs�tj|�}|dkrtt|���|d�jd�j�}tj|�}|dkr^|tjkr^tj|dd��}|dk	rj|St	j
dj||�tdd�t
|�S)a� Get MachAr instance or MachAr-like instance

    Get parameters for floating point type, by first trying signatures of
    various known floating point types, then, if none match, attempting to
    identify parameters by analysis.

    Parameters
    ----------
    ftype : class
        Numpy floating point type class (e.g. ``np.float64``)

    Returns
    -------
    ma_like : instance of :class:`MachAr` or :class:`MachArLike`
        Object giving floating point parameters for `ftype`.

    Warns
    -----
    UserWarning
        If the binary signature of the float type is not in the dictionary of
        known float types.
    Nz-0.1�<r zVSignature {} for {} does not match any known type: falling back to type probe functionrC)�
stacklevel)r!�get�
ValueError�reprZnewbyteorder�tobytesr<r_ra�warnings�warn�format�UserWarning�_discovered_machar)rr�keyZma_likerrr�_get_machar�s


rqcs>t��t�fdd��fdd��fdd���fdd��d�S)zB Create MachAr instance with found information on float types
    cst|g��S)N)r	)r)rrrrsz$_discovered_machar.<locals>.<lambda>cst|j�d��dS)Nrr)rZastype)r)rrrrscstt|�d��S)Nr)r	r)r)rrrrscs�dtt|�d��S)Nrr)r	r)r)rrrrrsr)r!r)rr)rrrros

roZnumpyc@s4eZdZdZiZdd�Zdd�Zdd�Zdd	�Zd
S)ra�

    finfo(dtype)

    Machine limits for floating point types.

    Attributes
    ----------
    bits : int
        The number of bits occupied by the type.
    eps : float
        The difference between 1.0 and the next smallest representable float
        larger than 1.0. For example, for 64-bit binary floats in the IEEE-754
        standard, ``eps = 2**-52``, approximately 2.22e-16.
    epsneg : float
        The difference between 1.0 and the next smallest representable float
        less than 1.0. For example, for 64-bit binary floats in the IEEE-754
        standard, ``epsneg = 2**-53``, approximately 1.11e-16.
    iexp : int
        The number of bits in the exponent portion of the floating point
        representation.
    machar : MachAr
        The object which calculated these parameters and holds more
        detailed information.
    machep : int
        The exponent that yields `eps`.
    max : floating point number of the appropriate type
        The largest representable number.
    maxexp : int
        The smallest positive power of the base (2) that causes overflow.
    min : floating point number of the appropriate type
        The smallest representable number, typically ``-max``.
    minexp : int
        The most negative power of the base (2) consistent with there
        being no leading 0's in the mantissa.
    negep : int
        The exponent that yields `epsneg`.
    nexp : int
        The number of bits in the exponent including its sign and bias.
    nmant : int
        The number of bits in the mantissa.
    precision : int
        The approximate number of decimal digits to which this kind of
        float is precise.
    resolution : floating point number of the appropriate type
        The approximate decimal resolution of this type, i.e.,
        ``10**-precision``.
    tiny : float
        The smallest positive usable number.  Type of `tiny` is an
        appropriate floating point type.

    Parameters
    ----------
    dtype : float, dtype, or instance
        Kind of floating point data-type about which to get information.

    See Also
    --------
    MachAr : The implementation of the tests that produce this information.
    iinfo : The equivalent for integer data types.
    spacing : The distance between a value and the nearest adjacent number
    nextafter : The next floating point value after x1 towards x2

    Notes
    -----
    For developers of NumPy: do not instantiate this at the module level.
    The initial calculation of these parameters is expensive and negatively
    impacts import times.  These objects are cached, so calling ``finfo()``
    repeatedly inside your functions is not a problem.

    cCsytj|�}Wn"tk
r0tjt|��}YnX|jj|d�}|dk	rL|S|g}tj|�}||k	rr|j|�|}t|tj	�s�t
d|��|jj|d�}|dk	r�|St|tj�s�t|}||k	r�|j|�|}|jj|d�}|dk	r�|St
j|�j|�}x|D]}||j|<�q�W|S)Nzdata type %r not inexact)r�dtype�	TypeError�type�_finfo_cachergZ
obj2sctype�append�
issubclassZinexactrhZfloating�_convert_to_float�object�__new__�_init)�clsrr�objZdtypesZnewdtype�dtrrrrzns:



z
finfo.__new__cCs�tj|�|_t|�}xdD]}t||t||��qWx$d
D]}t||t||�jd
�q:W|jjd|_|jjd
|_	|j	|_
|jjd
|_|j|_
|j|_||_|jj�|_|jj�|_|jj�|_|jj�|_|jj�|_|S)Nr+rIrGrFrErDr&r,r$rrN)r+rIrGrFrErD)r&r,r$)rrrrq�setattr�getattrZflat�itemsize�bitsr%�max�minr#rIZnexprHZnmantr=r/�stripZ	_str_tinyr0Z_str_maxr.r-r1)r2rrr=�wordrrrr{�s*

zfinfo._initcCsd}||jS)Na�Machine parameters for %(dtype)s
---------------------------------------------------------------
precision = %(precision)3s   resolution = %(_str_resolution)s
machep = %(machep)6s   eps =        %(_str_eps)s
negep =  %(negep)6s   epsneg =     %(_str_epsneg)s
minexp = %(minexp)6s   tiny =       %(_str_tiny)s
maxexp = %(maxexp)6s   max =        %(_str_max)s
nexp =   %(nexp)6s   min =        -max
---------------------------------------------------------------
)r()r2rrrr�__str__�s
z
finfo.__str__cCs"|jj}|jj�}||d<d|S)N�klasszZ%(klass)s(resolution=%(resolution)s, min=-%(_str_max)s, max=%(_str_max)s, dtype=%(dtype)s))�	__class__r5r(r)r2�c�drrr�__repr__�s

zfinfo.__repr__N)	r5r6r7r8rurzr{r�r�rrrrr#sG!c@sHeZdZdZiZiZdd�Zedd��Zedd��Z	dd	�Z
d
d�ZdS)
ral
    iinfo(type)

    Machine limits for integer types.

    Attributes
    ----------
    bits : int
        The number of bits occupied by the type.
    min : int
        The smallest integer expressible by the type.
    max : int
        The largest integer expressible by the type.

    Parameters
    ----------
    int_type : integer type, dtype, or instance
        The kind of integer data type to get information about.

    See Also
    --------
    finfo : The equivalent for floating point data types.

    Examples
    --------
    With types:

    >>> ii16 = np.iinfo(np.int16)
    >>> ii16.min
    -32768
    >>> ii16.max
    32767
    >>> ii32 = np.iinfo(np.int32)
    >>> ii32.min
    -2147483648
    >>> ii32.max
    2147483647

    With instances:

    >>> ii32 = np.iinfo(np.int32(10))
    >>> ii32.min
    -2147483648
    >>> ii32.max
    2147483647

    cCs~ytj|�|_Wn$tk
r4tjt|��|_YnX|jj|_|jjd|_d|j|jf|_|jdkrztd|jf��dS)NrNz%s%d�iuzInvalid integer data type %r.)	rrrrsrt�kindr�r�rprh)r2Zint_typerrrr4�s

ziinfo.__init__cCs\|jdkrdSytj|j}Wn4tk
rRtd|jd>�}|tj|j<YnX|SdS)zMinimum value of given dtype.�urrN)r�r�	_min_valsrp�KeyErrorr*r�)r2�valrrrr��s
z	iinfo.mincCsjytj|j}WnTtk
rd|jdkr>td|j>d�}ntd|jd>d�}|tj|j<YnX|S)zMaximum value of given dtype.r�r)r�	_max_valsrpr�r�r*r�)r2r�rrrr�
s
z	iinfo.maxcCsd}||j|j|jd�S)zString representation.z�Machine parameters for %(dtype)s
---------------------------------------------------------------
min = %(min)s
max = %(max)s
---------------------------------------------------------------
)rrr�r�)rrr�r�)r2rrrrr�sz
iinfo.__str__cCsd|jj|j|j|jfS)Nz%s(min=%s, max=%s, dtype=%s))r�r5r�r�rr)r2rrrr�"sziinfo.__repr__N)r5r6r7r8r�r�r4�propertyr�r�r�r�rrrrr�s0

)-r8�__all__rkr=rZ	overridesr�rrr_r	r
r
rrrrrZcsingler:Zcomplex_Zfloat_Z
clongfloatZ	longfloatrxZ
_title_fmtr9�dictZint64rmZint32raZlonglongr;Zint16r!r<r>r`rdrqrorrrrrr�<module>sT+