403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.19.244.133
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib64/python3.7/site-packages/numpy/lib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib64/python3.7/site-packages/numpy/lib/__pycache__/stride_tricks.cpython-37.pyc
B

��FdQ"�@spdZddlmZmZmZddlZddgZGdd�de�Z	dd	�Z
ddd
�Zdd�Zddd�Z
dd�Zdd�ZdS)z�
Utilities that manipulate strides to achieve desirable effects.

An explanation of strides can be found in the "ndarray.rst" file in the
NumPy reference guide.

�)�division�absolute_import�print_functionN�broadcast_to�broadcast_arraysc@seZdZdZddd�ZdS)�
DummyArrayz�Dummy object that just exists to hang __array_interface__ dictionaries
    and possibly keep alive a reference to a base array.
    NcCs||_||_dS)N)�__array_interface__�base)�self�	interfacer	�r�J/opt/alt/python37/lib64/python3.7/site-packages/numpy/lib/stride_tricks.py�__init__szDummyArray.__init__)N)�__name__�
__module__�__qualname__�__doc__rrrrr
rsrcCs4t|�t|�k	r0|jt|�d�}|jr0|�|�|S)N)�type)r�viewZ__array_finalize__)Zoriginal_arrayZ	new_arrayrrr
�_maybe_view_as_subclasss

rFTcCs~tj|d|d�}t|j�}|dk	r.t|�|d<|dk	rBt|�|d<t�t||d��}|j|_t||�}|j	j
rz|szd|j	_
|S)a�
    Create a view into the array with the given shape and strides.

    .. warning:: This function has to be used with extreme care, see notes.

    Parameters
    ----------
    x : ndarray
        Array to create a new.
    shape : sequence of int, optional
        The shape of the new array. Defaults to ``x.shape``.
    strides : sequence of int, optional
        The strides of the new array. Defaults to ``x.strides``.
    subok : bool, optional
        .. versionadded:: 1.10

        If True, subclasses are preserved.
    writeable : bool, optional
        .. versionadded:: 1.12

        If set to False, the returned array will always be readonly.
        Otherwise it will be writable if the original array was. It
        is advisable to set this to False if possible (see Notes).

    Returns
    -------
    view : ndarray

    See also
    --------
    broadcast_to: broadcast an array to a given shape.
    reshape : reshape an array.

    Notes
    -----
    ``as_strided`` creates a view into the array given the exact strides
    and shape. This means it manipulates the internal data structure of
    ndarray and, if done incorrectly, the array elements can point to
    invalid memory and can corrupt results or crash your program.
    It is advisable to always use the original ``x.strides`` when
    calculating new strides to avoid reliance on a contiguous memory
    layout.

    Furthermore, arrays created with this function often contain self
    overlapping memory, so that two elements are identical.
    Vectorized write operations on such arrays will typically be
    unpredictable. They may even give different results for small, large,
    or transposed arrays.
    Since writing to these arrays has to be tested and done with great
    care, you may want to use ``writeable=False`` to avoid accidental write
    operations.

    For these reasons it is advisable to avoid ``as_strided`` when
    possible.
    F)�copy�subokN�shape�strides)r	)�np�array�dictr�tupleZasarrayrZdtyper�flags�	writeable)�xrrrrrrrrrr
�
as_strided&s9

r!c	Cs�t�|�rt|�n|f}tj|d|d�}|s:|jr:td��tdd�|D��rTtd��|o`|jj}|rldgng}|rxdnd	}tj	|fd
ddg||g|d
d�j
d}t||�}|r�|jjs�d|j_|S)NF)rrz/cannot broadcast a non-scalar to a scalar arraycss|]}|dkVqdS)rNr)�.0�sizerrr
�	<genexpr>xsz _broadcast_to.<locals>.<genexpr>z4all elements of broadcast shape must be non-negativeZ	reduce_okZ	readwrite�readonlyZmulti_indexZrefs_okZzerosize_ok�C)rZop_flagsZ	itershape�orderrT)r�iterablerrr�
ValueError�anyrrZnditerZitviewsr)	rrrr%Zneeds_writeable�extrasZop_flag�	broadcast�resultrrr
�
_broadcast_toss 

r.cCst|||dd�S)a�Broadcast an array to a new shape.

    Parameters
    ----------
    array : array_like
        The array to broadcast.
    shape : tuple
        The shape of the desired array.
    subok : bool, optional
        If True, then sub-classes will be passed-through, otherwise
        the returned array will be forced to be a base-class array (default).

    Returns
    -------
    broadcast : array
        A readonly view on the original array with the given shape. It is
        typically not contiguous. Furthermore, more than one element of a
        broadcasted array may refer to a single memory location.

    Raises
    ------
    ValueError
        If the array is not compatible with the new shape according to NumPy's
        broadcasting rules.

    Notes
    -----
    .. versionadded:: 1.10.0

    Examples
    --------
    >>> x = np.array([1, 2, 3])
    >>> np.broadcast_to(x, (3, 3))
    array([[1, 2, 3],
           [1, 2, 3],
           [1, 2, 3]])
    T)rr%)r.)rrrrrr
r�s&cGsb|sdStj|dd��}x@tdt|�d�D],}td|j�}tj|f|||d���}q,W|jS)ztReturns the shape of the arrays that would result from broadcasting the
    supplied arrays against each other.
    rN� �r)rr,�range�lenrr)�args�b�posrrr
�_broadcast_shape�s r6csn|�dd��|r&td�|��d����fdd�|D�}t|��t�fdd�|D��rZ|S��fd	d�|D�S)
a�
    Broadcast any number of arrays against each other.

    Parameters
    ----------
    `*args` : array_likes
        The arrays to broadcast.

    subok : bool, optional
        If True, then sub-classes will be passed-through, otherwise
        the returned arrays will be forced to be a base-class array (default).

    Returns
    -------
    broadcasted : list of arrays
        These arrays are views on the original arrays.  They are typically
        not contiguous.  Furthermore, more than one element of a
        broadcasted array may refer to a single memory location.  If you
        need to write to the arrays, make copies first.

    Examples
    --------
    >>> x = np.array([[1,2,3]])
    >>> y = np.array([[1],[2],[3]])
    >>> np.broadcast_arrays(x, y)
    [array([[1, 2, 3],
           [1, 2, 3],
           [1, 2, 3]]), array([[1, 1, 1],
           [2, 2, 2],
           [3, 3, 3]])]

    Here is a useful idiom for getting contiguous copies instead of
    non-contiguous views.

    >>> [np.array(a) for a in np.broadcast_arrays(x, y)]
    [array([[1, 2, 3],
           [1, 2, 3],
           [1, 2, 3]]), array([[1, 1, 1],
           [2, 2, 2],
           [3, 3, 3]])]

    rFz:broadcast_arrays() got an unexpected keyword argument {!r}rcsg|]}tj|d�d��qS)F)rr)rr)r"�_m)rrr
�
<listcomp>�sz$broadcast_arrays.<locals>.<listcomp>c3s|]}|j�kVqdS)N)r)r"r)rrr
r$�sz#broadcast_arrays.<locals>.<genexpr>csg|]}t|��dd��qS)F)rr%)r.)r"r)rrrr
r8s)�pop�	TypeError�format�keysr6�all)r3�kwargsr)rrr
r�s0)NNFT)F)r�
__future__rrr�numpyr�__all__�objectrrr!r.rr6rrrrr
�<module>s

M
)

Youez - 2016 - github.com/yon3zu
LinuXploit