o
    Ö°“i	  ã                   @   s@   d dl mZ d dlmZ ddd„Zdd„ Zdd„ Zdd
d„Zd	S )é    )Ú_core)Ú_routines_manipulationc                 C   s   t  | ||¡S )a\  Moves the specified axis backwards to the given place.

    Args:
        a (cupy.ndarray): Array to move the axis.
        axis (int): The axis to move.
        start (int): The place to which the axis is moved.

    Returns:
        cupy.ndarray: A view of ``a`` that the axis is moved to ``start``.

    .. seealso:: :func:`numpy.rollaxis`

    )r   Úrollaxis)ÚaÚaxisÚstart© r   úP/home/ubuntu/.local/lib/python3.10/site-packages/cupy/_manipulation/transpose.pyr      s   r   c                 C   s   |   ||¡S )a-  Swaps the two axes.

    Args:
        a (cupy.ndarray): Array to swap the axes.
        axis1 (int): The first axis to swap.
        axis2 (int): The second axis to swap.

    Returns:
        cupy.ndarray: A view of ``a`` that the two axes are swapped.

    .. seealso:: :func:`numpy.swapaxes`

    )Úswapaxes)r   Úaxis1Úaxis2r   r   r	   r
      s   r
   c                 C   s0   t |dƒst |dƒst | ||¡S t | ||¡S )aG  Moves axes of an array to new positions.

    Other axes remain in their original order.

    Args:
        a (cupy.ndarray): Array whose axes should be reordered.
        source (int or sequence of int):
            Original positions of the axes to move. These must be unique.
        destination (int or sequence of int):
            Destination positions for each of the original axes. These must
            also be unique.

    Returns:
        cupy.ndarray:
        Array with moved axes. This array is a view of the input array.

    .. seealso:: :func:`numpy.moveaxis`

    Ú__len__)Úhasattrr   Ú_move_single_axisr   Úmoveaxis)r   ÚsourceÚdestinationr   r   r	   r   (   s   r   Nc                 C   s
   |   |¡S )af  Permutes the dimensions of an array.

    Args:
        a (cupy.ndarray): Array to permute the dimensions.
        axes (tuple of ints): Permutation of the dimensions. This function
            reverses the shape by default.

    Returns:
        cupy.ndarray: A view of ``a`` that the dimensions are permuted.

    .. seealso:: :func:`numpy.transpose`

    )Ú	transpose)r   Úaxesr   r   r	   r   C   s   
r   )r   )N)Úcupyr   Ú
cupy._corer   r   r
   r   r   r   r   r   r	   Ú<module>   s    
