%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/
Upload File :
Create Path :
Current File : //proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyo

�
�9Zc	@`s�dZddlmZmZmZdddgZdZddlZddlm	Z	d	d
l
mZd	dl
mZmZmZmZmZmZd	dlmZmZmZmZd	d
lmZd	dlmZejddkrejZejd	Z nej!Zej!d	Z d�Z"da#da$da%e&a'da(da)da*da,ddddddddd�Z-d�Z.d�Z/d�Z0d�Z1dddd�Z2d�Z3ddddde4dd�Z5d �Z6d!�Z7d"e8fd#��YZ9d$�Z:d%e8fd&��YZ;d'e8fd(��YZ<d)e8fd*��YZ=d+e8fd,��YZ>d-e8fd.��YZ?d/e8fd0��YZ@dS(1sXArray printing function

$Id: arrayprint.py,v 1.9 2005/09/13 13:58:44 teoliphant Exp $

i(tdivisiontabsolute_importtprint_functiontarray2stringtset_printoptionstget_printoptionstrestructuredtextN(treducei(tnumerictypes(tmaximumtminimumtabsolutet	not_equaltisnantisinf(tarraytformat_longfloattdatetime_as_stringt
datetime_data(travel(tasarrayicC`s||S(N((txty((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pytproduct"si�iiKtnantinfcC`s�|dk	r|an|dk	r*|an|dk	r?|an|dk	rT|an|dk	rk|an|dk	r�|an|dk	r�|an|adS(sv

    Set printing options.

    These options determine the way floating point numbers, arrays and
    other NumPy objects are displayed.

    Parameters
    ----------
    precision : int, optional
        Number of digits of precision for floating point output (default 8).
    threshold : int, optional
        Total number of array elements which trigger summarization
        rather than full repr (default 1000).
    edgeitems : int, optional
        Number of array items in summary at beginning and end of
        each dimension (default 3).
    linewidth : int, optional
        The number of characters per line for the purpose of inserting
        line breaks (default 75).
    suppress : bool, optional
        Whether or not suppress printing of small floating point values
        using scientific notation (default False).
    nanstr : str, optional
        String representation of floating point not-a-number (default nan).
    infstr : str, optional
        String representation of floating point infinity (default inf).
    formatter : dict of callables, optional
        If not None, the keys should indicate the type(s) that the respective
        formatting function applies to.  Callables should return a string.
        Types that are not specified (by their corresponding keys) are handled
        by the default formatters.  Individual types for which a formatter
        can be set are::

            - 'bool'
            - 'int'
            - 'timedelta' : a `numpy.timedelta64`
            - 'datetime' : a `numpy.datetime64`
            - 'float'
            - 'longfloat' : 128-bit floats
            - 'complexfloat'
            - 'longcomplexfloat' : composed of two 128-bit floats
            - 'numpy_str' : types `numpy.string_` and `numpy.unicode_`
            - 'str' : all other strings

        Other keys that can be used to set a group of types at once are::

            - 'all' : sets all types
            - 'int_kind' : sets 'int'
            - 'float_kind' : sets 'float' and 'longfloat'
            - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat'
            - 'str_kind' : sets 'str' and 'numpystr'

    See Also
    --------
    get_printoptions, set_string_function, array2string

    Notes
    -----
    `formatter` is always reset with a call to `set_printoptions`.

    Examples
    --------
    Floating point precision can be set:

    >>> np.set_printoptions(precision=4)
    >>> print(np.array([1.123456789]))
    [ 1.1235]

    Long arrays can be summarised:

    >>> np.set_printoptions(threshold=5)
    >>> print(np.arange(10))
    [0 1 2 ..., 7 8 9]

    Small results can be suppressed:

    >>> eps = np.finfo(float).eps
    >>> x = np.arange(4.)
    >>> x**2 - (x + eps)**2
    array([ -4.9304e-32,  -4.4409e-16,   0.0000e+00,   0.0000e+00])
    >>> np.set_printoptions(suppress=True)
    >>> x**2 - (x + eps)**2
    array([-0., -0.,  0.,  0.])

    A custom formatter can be used to display array elements as desired:

    >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)})
    >>> x = np.arange(3)
    >>> x
    array([int: 0, int: -1, int: -2])
    >>> np.set_printoptions()  # formatter gets reset
    >>> x
    array([0, 1, 2])

    To put back the default options, you can use:

    >>> np.set_printoptions(edgeitems=3,infstr='inf',
    ... linewidth=75, nanstr='nan', precision=8,
    ... suppress=False, threshold=1000, formatter=None)
    N(	tNonet_line_widtht_summaryThresholdt_summaryEdgeItemst_float_output_precisiont_float_output_suppress_smallt_nan_strt_inf_strt
_formatter(t	precisiont	thresholdt	edgeitemst	linewidthtsuppresstnanstrtinfstrt	formatter((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyR0sm						cC`s=tdtdtdtdtdtdtdtdt�}|S(	s	
    Return the current print options.

    Returns
    -------
    print_opts : dict
        Dictionary of current print options with keys

          - precision : int
          - threshold : int
          - edgeitems : int
          - linewidth : int
          - suppress : bool
          - nanstr : str
          - infstr : str
          - formatter : dict of callables

        For a full description of these options, see `set_printoptions`.

    See Also
    --------
    set_printoptions, set_string_function

    R#R$R%R&R'R(R)R*(	tdictRRRRRR R!R"(td((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyR�s	cC`sAddlm}|jdkr_t|�dtkrV|j|t |tf�}q=|}n�t|�dtkr�gttt|�t��D]}t||�^q�}|j	gttt|�t�dd�D]}t||�^q��n2gtdt|��D]}t||�^q}|jt
|��}|S(Ni(tnumericiii����(tR-tndimtlenRtconcatenatetrangetmint_leading_trailingtextendttuple(tat_nctbtitl((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyR4�s
	2=2cC`s|r
dSdSdS(Ns TruetFalse((R((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyt_boolFormatter�scC`s
t|�S(N(trepr(R((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pytrepr_format�st R.c	C`s|dkrt}n|dkr*t}n|dkr?t}n|dkrTt}n|jtkrxd}t|�}nd}tt	|��}i
t
d6t|�d6t|||�d6t
|�d6t|||�d6t|�d6t|�d	6t|�d
6td6td6}	|dk	r�g|j�D]}
||
dk	r+|
^q+}d
|kr�x%|	j�D]}|d
|	|<qfWnd|kr�x"dgD]}|d|	|<q�Wnd|kr�x%ddgD]}|d|	|<q�Wnd|krx%ddgD]}|d|	|<q�Wnd|krNx%ddgD]}|d|	|<q3Wnx4|	j�D]#}||kr[|||	|<q[q[Wn|jj}
t|
tj�r�|	d}nt|
tj�r�t|
tj�r�|	d
}q�|	d}n�t|
tj�r,t|
tj�r|	d}q�|	d}n�t|
tj�rjt|
tj�r]|	d}q�|	d}nQt|
tj tj!f�r�|	d}n)t|
tj"�r�|	d	}n
|	d}d}|dt#|�7}t$||t#|j%�|||t&|�d }|S(Ns..., R.tbooltinttfloatt	longfloattcomplexfloattlongcomplexfloattdatetimet	timedeltatnumpystrtstrtalltint_kindt
float_kindtcomplex_kindtstr_kindR@i����('RRRRR"tsizeRR4RRR=t
IntegerFormattFloatFormattLongFloatFormatt
ComplexFormattLongComplexFormattDatetimeFormattTimedeltaFormatR?RJtkeystdtypettypet
issubclasst_nttbool_tintegerttimedelta64tfloatingRDtcomplexfloatingt
clongfloattunicode_tstring_t
datetime64R0t_formatArraytshapeR(R7tmax_line_widthR#tsuppress_smallt	separatortprefixR*tsummary_inserttdatat
formatdicttktfkeystkeytdtypeobjtformat_functiontnext_line_prefixtlst((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyt
_array2string�s�				


	




/









cC`s}ddlm}g}xZ|D]R}t||j�rD|j�}nt|t�rbt|�}n|j|�qWt|�S(Ni(R-(R.R-t
isinstancetndarrayttolistR6t_convert_arraystappend(tobjR8tnewtupRo((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyRzHs
c
	C`s�|jdkrH|j�}t|t�r9t|�}n||�}	nBtt|j�dkrid}	n!t||||||d|�}	|	S(s�
    Return a string representation of an array.

    Parameters
    ----------
    a : ndarray
        Input array.
    max_line_width : int, optional
        The maximum number of columns the string should span. Newline
        characters splits the string appropriately after array elements.
    precision : int, optional
        Floating point precision. Default is the current printing
        precision (usually 8), which can be altered using `set_printoptions`.
    suppress_small : bool, optional
        Represent very small numbers as zero. A number is "very small" if it
        is smaller than the current printing precision.
    separator : str, optional
        Inserted between elements.
    prefix : str, optional
        An array is typically printed as::

          'prefix(' + array2string(a) + ')'

        The length of the prefix string is used to align the
        output correctly.
    style : function, optional
        A function that accepts an ndarray and returns a string.  Used only
        when the shape of `a` is equal to ``()``, i.e. for 0-D arrays.
    formatter : dict of callables, optional
        If not None, the keys should indicate the type(s) that the respective
        formatting function applies to.  Callables should return a string.
        Types that are not specified (by their corresponding keys) are handled
        by the default formatters.  Individual types for which a formatter
        can be set are::

            - 'bool'
            - 'int'
            - 'timedelta' : a `numpy.timedelta64`
            - 'datetime' : a `numpy.datetime64`
            - 'float'
            - 'longfloat' : 128-bit floats
            - 'complexfloat'
            - 'longcomplexfloat' : composed of two 128-bit floats
            - 'numpy_str' : types `numpy.string_` and `numpy.unicode_`
            - 'str' : all other strings

        Other keys that can be used to set a group of types at once are::

            - 'all' : sets all types
            - 'int_kind' : sets 'int'
            - 'float_kind' : sets 'float' and 'longfloat'
            - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat'
            - 'str_kind' : sets 'str' and 'numpystr'

    Returns
    -------
    array_str : str
        String representation of the array.

    Raises
    ------
    TypeError
        if a callable in `formatter` does not return a string.

    See Also
    --------
    array_str, array_repr, set_printoptions, get_printoptions

    Notes
    -----
    If a formatter is specified for a certain type, the `precision` keyword is
    ignored for that type.

    This is a very flexible function; `array_repr` and `array_str` are using
    `array2string` internally so keywords with the same name should work
    identically in all three functions.

    Examples
    --------
    >>> x = np.array([1e-16,1,2,3])
    >>> print(np.array2string(x, precision=2, separator=',',
    ...                       suppress_small=True))
    [ 0., 1., 2., 3.]

    >>> x  = np.arange(3.)
    >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x})
    '[0.00 1.00 2.00]'

    >>> x  = np.arange(3)
    >>> np.array2string(x, formatter={'int':lambda x: hex(x)})
    '[0x0L 0x1L 0x2L]'

    is[]R*((RgtitemRwR6RzRRRv(
R7RhR#RiRjRktstyleR*RRu((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyRTsa	cC`sYt|j��t|j��|krE||j�d7}|}n||7}||fS(Ns
(R0trstrip(tstlinetwordtmax_line_lenRt((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyt_extendLine�s
(	
cC`sd|dkr@|j�}t|t�r6t|�}nt|�S|rqd|t|�krq|}	|}
|}nd}	t|�}
d}|dkr�d}|}
xFt|	�D]8}|||�|}t||
|||�\}}
q�W|rt||
|||�\}}
nxMt|
dd�D]9}|||�|}t||
|||�\}}
q$W||d�}t||
|||�\}}
||
d7}d|t|�}n�d}|j�}x�t|	�D]{}|dkr�||7}n|t	||||d|d||||�7}|j�|j�d	t
|dd�}q�W|rm|||d	7}nx�t|
dd�D]�}|	s�||
kr�||7}n|t	||||d|d||||�7}|j�|j�d	t
|dd�}q�W|	s|
dkr%||7}n|t	|d||d|d||||�j�d7}|S(
sgformatArray is designed for two modes of operation:

    1. Full output

    2. Summarized output

    iiR.ii����s]
t[R@s
(R~RwR6RzRJR0R2R�R�Rftmax(R7RstrankR�RtRjt
edge_itemsRlR|t
leading_itemsttrailing_itemstsummary_insert1R�R�R:R�tsep((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyRf�sf	
	"!"


/


/

RRcB`s)eZed�Zd�Zed�ZRS(cC`se||_||_||_t|_t|_d|_y|j|�Wntt	fk
r`nXdS(Ni(
R#RitsignR<t
exp_formattlarge_exponenttmax_str_lent
fillFormatt	TypeErrortNotImplementedError(tselfRmR#RiR�((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyt__init__s						cC`s�ddlm}|jdd���t|�t|�B}t|d�|@}t|j|��}t|�dkr�d}d}nht	j
|�}tj
|�}|dkr�t|_
n|jr�|dks�||d	kr�t|_
nWdQX|j
r�d|kod
knp|dk|_d|j|_|jrP|jd7_n|jrbd
}nd}|d|j|jf}n�d|jf}t|�r�tg|D]}	t|	|j|�^q��}
nd}
t|j|
�}
ttt|���|
d|_|j|�rGt|jtt�tt�d�|_n|jrYd}nd}|d|j|
f}d|jf|_||_dS(Ni(R-RKtignoreigg�חAg-C��6?g@�@g>��N}a+g}Ô%�I�Tis%+t%s%d.%des%%.%dfis%#+s%#s%d.%dfs%%%ds(R.R-terrstateR
RRRtcompressR0R	RR
tTrueR�RiR�R#R�R�R�t_digitsR3RJRBtanyR R!tspecial_fmttformat(R�RmR8tspecialtvalidtnon_zerotmax_valtmin_valR�RR#((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyR�sR		+			+#				cC`s�ddlm}|jdd���t|�r[|jrJ|jdtfS|jtfSnYt|�r�|dkr�|jr�|jdtfS|jtfSq�|jdtfSnWdQX|j	|}|j
r|d}|dks�|dkr||dd	!d
|d	}q|nk|jrF|dd
kr|d|d |d	}q|n6|r||jd
�}|dt
|�t
|�}n|S(Ni(R-tinvalidR�t+it-i����i����t0R@(R.R-R�R
R�R�R RR!R�R�R�R�R0(R�Rtstrip_zerosR8R�texpsigntz((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyt__call__Rs0		
	
	!(t__name__t
__module__R<R�R�R�R�(((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyRRs	3cC`s1||}|jd�}|t|�t|�S(NR�(R�R0(RR#R�R�R�((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyR�ts
RQcB`seZd�Zd�ZRS(cC`s�yTttttj|���tttj|����}dt|�d|_Wn'ttfk
rmnt	k
r}nXdS(NR�R,(
R�R0RJR	RR
R�R�R�t
ValueError(R�RmR�((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyR�{s
cC`s3t|kotknr'|j|Sd|SdS(Ns%s(t_MININTt_MAXINTR�(R�R((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyR��s(R�R�R�R�(((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyRQzs	
RScB`seZed�Zd�ZRS(cC`s||_||_dS(N(R#R�(R�R#R�((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyR��s	cC`s�t|�r(|jrdtSdtSn�t|�rg|dkr\|jrQdtSdtSq�dtSnP|dkr�|jr�dt||j�Sdt||j�Snt||j�SdS(NR�R@iR�(R
R�R RR!RR#(R�R((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyR��s			(R�R�R<R�R�(((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyRS�sRUcB`seZd�Zd�ZRS(cC`s(t|�|_t|dt�|_dS(NR�(RStreal_formatR�timag_format(R�R#((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyR��scC`s0|j|j�}|j|j�}||dS(Ntj(R�trealR�timag(R�RtrR:((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyR��s(R�R�R�R�(((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyRU�s	RTcB`seZd�Zd�ZRS(cC`s:t|j||�|_t|j||dt�|_dS(NR�(RRR�R�R�R�R�(R�RR#Ri((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyR��scC`s�|j|jdt�}|j|jdt�}|jjsp|jd�}|ddt|�t|�}n
|d}||S(NR�R�R�R@(R�R�R<R�R�R�R�R0(R�RR�R:R�((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyR��s%
(R�R�R�R�(((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyRT�s	RVcB`s#eZdddd�Zd�ZRS(t	same_kindcC`sq|dkr=|jjdkr4t|j�d}q=d}n|dkrRd}n||_||_||_dS(NtMiR�tnaive(RRYtkindRttimezonetunittcasting(R�RR�R�R�((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyR��s				c	C`s)dt|d|jd|jd|j�S(Ns'%s'R�R�R�(RR�R�R�(R�R((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyR��s		N(R�R�RR�R�(((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyRV�sRWcB`seZd�Zd�ZRS(cC`s�|jjdkr�tdgd|j�d}|t||�jd�}t|�dkr�ttttj	|���ttt
j	|����}nd}t|�t|�kr�t|d�}ndt|�d|_d	j|�|_
ndS(
NtmtNaTRYiti8iR�R,s'NaT'(RYR�RRtviewR0R�RJR	RR
R�trjustt_nat(R�Rmt	nat_valuetvR�((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyR��s!cC`s/|d|kr|jS|j|jd�SdS(NiR�(R�R�tastype(R�R((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyR��s(R�R�R�R�(((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyRW�s	(At__doc__t
__future__RRRt__all__t
__docformat__tsyst	functoolsRR.RR\tumathR	R
RRR
Rt
multiarrayRRRRtfromnumericRR-Rtversion_infotmaxsizeR�R�tmaxintRRRRR<RRR R!RR"RRR4R=R?RvRzR>RR�RftobjectRRR�RQRSRURTRVRW(((sH/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/arrayprint.pyt<module>s`	."				z	#			Z		l		Fd	

Zerion Mini Shell 1.0