
    
9j                    N    S SK Jr  S SKJr  S SKJr  S
S jrS rS rSS jr	S	 r
g)    )annotations)_core)_routines_manipulationc                0    [         R                  " XU5      $ )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starts      V/home/wildlama/miniconda3/lib/python3.13/site-packages/cupy/_manipulation/transpose.pyr   r      s     >>!5))    c                $    U R                  X5      $ )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axis2s      r   r   r      s     ::e##r   c                    [        US5      (       d(  [        US5      (       d  [        R                  " XU5      $ [        R                  " XU5      $ )a  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destinations      r   r   r   *   sA    , FI&&'+y*I*I%77;OO>>![11r   Nc                $    U R                  U5      $ )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   axess     r   r   r   E   s     ;;tr   c               l    U R                   S:  a  [        SU R                    35      e[        U SS5      $ )a  
Transposes a matrix (or a stack of matrices) ``x``.

This function is Array API compatible.

Parameters
----------
x : ndarray
    Input array having shape (..., M, N) and whose two innermost
    dimensions form ``MxN`` matrices.

Returns
-------
out : ndarray
    An array containing the transpose for each matrix and having shape
    (..., N, M).

See Also
--------
transpose : Generic transpose method.
numpy.matrix_transpose

   z6Input array must be at least 2-dimensional, but it is )ndim
ValueErrorr   )xs    r   matrix_transposer"   W   s;    0 	vvzDQVVHM
 	
 Ar2r   )r   )N)
__future__r   cupyr   
cupy._corer   r   r   r   r   r"    r   r   <module>r'      s'    "  -*"$$26$r   