
    `in                     b    d dl Z d dl mZ d ZdddddZd ZddddZdddd	Zddddd
ZdS )    N)_corec                 >   t          d | D                       rt          d          t          |           }t          |          D ]F\  }}|j        dk    r|ddt
          j        f         }|||<   ,|j        dk    rt          d          Gt          |d          S )a{  Stacks 1-D and 2-D arrays as columns into a 2-D array.

    A 1-D array is first converted to a 2-D column array. Then, the 2-D arrays
    are concatenated along the second axis.

    Args:
        tup (sequence of arrays): 1-D or 2-D arrays to be stacked.

    Returns:
        cupy.ndarray: A new 2-D array of stacked columns.

    .. seealso:: :func:`numpy.column_stack`

    c              3   L   K   | ]}t          |t          j                   V   d S )N)
isinstancecupyndarray.0as     k/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/cupy/_manipulation/join.py	<genexpr>zcolumn_stack.<locals>.<genexpr>   s1      
8
8qz!T\***
8
8
8
8
8
8    z&Only cupy arrays can be column stacked   N   z4Only 1 or 2 dimensional arrays can be column stacked)axis)	any	TypeErrorlist	enumeratendimr   newaxis
ValueErrorconcatenate)tuplstir   s       r   column_stackr      s     
8
8C
8
8
888 B@AAA
s))C# H H16Q;;!!!T\/"ACFFVq[[FH H H  s####r   	same_kinddtypecastingc                R    |d | D             } d}t          j        | ||||          S )u$  Joins arrays along an axis.

    Args:
        tup (sequence of arrays): Arrays to be joined. All of these should have
            same dimensionalities except the specified axis.
        axis (int or None): The axis to join arrays along.
            If axis is None, arrays are flattened before use.
            Default is 0.
        out (cupy.ndarray): Output array.
        dtype (str or dtype): If provided, the destination array will have this
            dtype. Cannot be provided together with ``out``.
        casting ({‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optional):
            Controls what kind of data casting may occur. Defaults to
            ``'same_kind'``.

    Returns:
        cupy.ndarray: Joined array.

    .. seealso:: :func:`numpy.concatenate`

    Nc                 6    g | ]}|                                 S  )ravelr
   ms     r   
<listcomp>zconcatenate.<locals>.<listcomp>:   s     &&&Qqwwyy&&&r   r   )r   concatenate_methodr   r   outr    r!   s        r   r   r   #   s:    , |&&#&&&#CsE7CCCr   c                 6    t          d | D             d          S )a  Stacks arrays along the third axis.

    Args:
        tup (sequence of arrays): Arrays to be stacked. Each array is converted
            by :func:`cupy.atleast_3d` before stacking.

    Returns:
        cupy.ndarray: Stacked array.

    .. seealso:: :func:`numpy.dstack`

    c                 6    g | ]}t          j        |          S r$   )r   
atleast_3dr&   s     r   r(   zdstack.<locals>.<listcomp>L   "    888q**888r   r   r   )r   s    r   dstackr1   ?   s#     88C888!<<<r   c                j    d | D             }d}|d         j         dk    rd}t          ||||          S )u  Stacks arrays horizontally.

    If an input array has one dimension, then the array is treated as a
    horizontal vector and stacked along the first axis. Otherwise, the array is
    stacked along the second axis.

    Args:
        tup (sequence of arrays): Arrays to be stacked.
        dtype (str or dtype): If provided, the destination array will have this
            dtype.
        casting ({‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optional):
            Controls what kind of data casting may occur. Defaults to
            ``'same_kind'``.

    Returns:
        cupy.ndarray: Stacked array.

    .. seealso:: :func:`numpy.hstack`

    c                 6    g | ]}t          j        |          S r$   )r   
atleast_1dr	   s     r   r(   zhstack.<locals>.<listcomp>d   s"    ,,,1DOA,,,r   r   r   r   )r   r   )r   r    r!   arrsr   s        r   hstackr6   O   sI    * -,,,,DDAw|qtT@@@@r   c                <    t          d | D             d||          S )u  Stacks arrays vertically.

    If an input array has one dimension, then the array is treated as a
    horizontal vector and stacked along the additional axis at the head.
    Otherwise, the array is stacked along the first axis.

    Args:
        tup (sequence of arrays): Arrays to be stacked. Each array is converted
            by :func:`cupy.atleast_2d` before stacking.
        dtype (str or dtype): If provided, the destination array will have this
            dtype.
        casting ({‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optional):
            Controls what kind of data casting may occur. Defaults to
            ``'same_kind'``.

    Returns:
        cupy.ndarray: Stacked array.

    .. seealso:: :func:`numpy.dstack`

    c                 6    g | ]}t          j        |          S r$   )r   
atleast_2dr&   s     r   r(   zvstack.<locals>.<listcomp>   r/   r   r   r   r0   )r   r    r!   s      r   vstackr:   k   s3    , 88C888!"G5 5 5 5r   c                D    t          fd| D             |||          S )uw  Stacks arrays along a new axis.

    Args:
        tup (sequence of arrays): Arrays to be stacked.
        axis (int): Axis along which the arrays are stacked.
        out (cupy.ndarray): Output array.
        dtype (str or dtype): If provided, the destination array will have this
            dtype. Cannot be provided together with ``out``.
        casting ({‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optional):
            Controls what kind of data casting may occur. Defaults to
            ``'same_kind'``.

    Returns:
        cupy.ndarray: Stacked array.

    .. seealso:: :func:`numpy.stack`
    c                 :    g | ]}t          j        |          S r$   )r   expand_dims)r
   xr   s     r   r(   zstack.<locals>.<listcomp>   s&    ???a(D11???r   r   r0   r*   s    `   r   stackr?      s<    $ ????3???s"G5 5 5 5r   )r   N)r   r   r   r   r1   r6   r:   r?   r$   r   r   <module>r@      s          $ $ $<Dk D D D D D8= = =  { A A A A A8 { 5 5 5 5 545$ 5 5 5 5 5 5 5r   