
    
9j                        S SK Jr  S SKrS SKJr  S SKJs  Jr  S S S S S S	 S
.rS rS r	S r
S r\R                  rS rS rS rSS jrg)    )annotationsN)_corec                    gN)    shapes    Q/home/wildlama/miniconda3/lib/python3.13/site-packages/cupy/_manipulation/dims.py<lambda>r      s    $    c                    g)N)r   r   r   r	   s    r   r   r      s    &r   c                    SU -   $ r   r   r	   s    r   r   r      s    $,r   c                    g)N)r   r   r   r   r	   s    r   r   r      s    )r   c                    SU -   S-   $ r   r   r	   s    r   r   r      s    $,-r   c                    U S-   $ r   r   r	   s    r   r   r      s    %$,r   ))r   r   )   r   )r   r   )   r   )r   r   )r   r   c                   / nU Hm  n[         R                  " U5      nUR                  U :  a3  [        XR                  4   " UR                  5      nUR
                  " U6 nUR                  U5        Mo     [        U5      S:X  a  Uu  nU$ )z)Helper function for atleast_nd functions.r   )cupyasarrayndim_atleast_nd_shape_mapr
   reshapeappendlen)narysresa	new_shapes        r   _atleast_nd_helperr"      sv     CLLO66A:-q&&k:177CI		9%A

1  3x1}Jr   c                     [        SU 5      $ )a  Converts arrays to arrays with dimensions >= 1.

Args:
    arys (tuple of arrays): Arrays to be converted. All arguments must be
        :class:`cupy.ndarray` objects. Only zero-dimensional array is
        affected.

Returns:
    If there are only one input, then it returns its converted version.
    Otherwise, it returns a list of converted arrays.

.. seealso:: :func:`numpy.atleast_1d`

r   r"   r   s    r   
atleast_1dr&   $   s     a&&r   c                     [        SU 5      $ )a  Converts arrays to arrays with dimensions >= 2.

If an input array has dimensions less than two, then this function inserts
new axes at the head of dimensions to make it have two dimensions.

Args:
    arys (tuple of arrays): Arrays to be converted. All arguments must be
        :class:`cupy.ndarray` objects.

Returns:
    If there are only one input, then it returns its converted version.
    Otherwise, it returns a list of converted arrays.

.. seealso:: :func:`numpy.atleast_2d`

r   r$   r%   s    r   
atleast_2dr(   6   s    " a&&r   c                     [        SU 5      $ )a  Converts arrays to arrays with dimensions >= 3.

If an input array has dimensions less than three, then this function
inserts new axes to make it have three dimensions. The place of the new
axes are following:

- If its shape is ``()``, then the shape of output is ``(1, 1, 1)``.
- If its shape is ``(N,)``, then the shape of output is ``(1, N, 1)``.
- If its shape is ``(M, N)``, then the shape of output is ``(M, N, 1)``.
- Otherwise, the output is the input array itself.

Args:
    arys (tuple of arrays): Arrays to be converted. All arguments must be
        :class:`cupy.ndarray` objects.

Returns:
    If there are only one input, then it returns its converted version.
    Otherwise, it returns a list of converted arrays.

.. seealso:: :func:`numpy.atleast_3d`

r   r$   r%   s    r   
atleast_3dr*   J   s    . a&&r   c                 8    [        [        U 6 R                  5      $ )zBroadcasts given arrays.

Args:
    args (tuple of arrays): Arrays to broadcast for each other.

Returns:
    list: A list of broadcasted arrays.

.. seealso:: :func:`numpy.broadcast_arrays`

)tuple	broadcastvalues)argss    r   broadcast_arraysr0   g   s     D!(())r   c                .    [         R                  " X5      $ )zBroadcast an array to a given shape.

Args:
    array (cupy.ndarray): Array to broadcast.
    shape (tuple of int): The shape of the desired array.

Returns:
    cupy.ndarray: Broadcasted view.

.. seealso:: :func:`numpy.broadcast_to`

)r   broadcast_to)arrayr
   s     r   r2   r2   v   s     e++r   c                f    [        U5      [        [        4;  a  U4n[        R                  " X5      $ )a  Expands given arrays.

Args:
    a (cupy.ndarray): Array to be expanded.
    axis (int): Position where new axis is to be inserted.

Returns:
    cupy.ndarray: The number of dimensions is one greater than that of
    the input array.

.. seealso:: :func:`numpy.expand_dims`

)typer,   list_manipulation_expand_dimsr    axiss     r   expand_dimsr;      s,     Dz%&u%%a..r   c                $    U R                  U5      $ )a  Removes size-one axes from the shape of an array.

Args:
    a (cupy.ndarray): Array to be reshaped.
    axis (int or tuple of ints): Axes to be removed. This function removes
        all size-one axes by default. If one of the specified axes is not
        of size one, an exception is raised.

Returns:
    cupy.ndarray: An array without (specified) size-one axes.

.. seealso:: :func:`numpy.squeeze`

)squeezer9   s     r   r=   r=      s      99T?r   )N)
__future__r   r   r   !cupy._core._routines_manipulation_routines_manipulationr7   r   r"   r&   r(   r*   r-   r0   r2   r;   r=   r   r   r   <module>rA      sc    "   9 9  &#-&  '$'('4 OO	*, /&r   