
    ohB'                    D   d dl mZ d dlmZmZmZmZmZ erddlm	Z	m
Z
mZmZmZ d dlmZ ddlmZ d dlZd Zdddd		 	 	 	 	 	 	 	 	 d!d
Z	 	 d"ddd	 	 	 	 	 	 	 	 	 	 	 d#dZddd	 	 	 	 	 	 	 d$dZddd	 	 	 	 	 	 	 d%dZ	 d&d ddd	 	 	 	 	 	 	 	 	 	 	 d'dZd(dZddd	 	 	 	 	 	 	 	 	 d)dZddd	 	 	 	 	 	 	 	 	 d*dZdddd	 	 	 	 	 	 	 	 	 	 	 	 	 d+dZddd,dZddd	 	 	 	 	 	 	 d$dZddd	 	 	 	 	 	 	 d%dZ d dd-dZ!d dd-dZ"ddd	 	 	 	 	 	 	 d$dZ#ddd	 	 	 	 	 	 	 d%d Z$y).    )annotations)TYPE_CHECKINGListOptionalTupleUnion   )ArrayDeviceDtypeNestedSequenceSupportsBufferProtocol)Sequence)_all_dtypesNc                @    dt         z   D ]  }| |u s y  t        d      )NNz)dtype must be one of the supported dtypes)r   
ValueError)dtypeds     ]/var/www/html/engine/venv/lib/python3.12/site-packages/numpy/array_api/_creation_functions.py_check_valid_dtyper      s0    
 {" A: @
AA    )r   devicecopyc                 ddl m} t        |       |dvrt        d|      |dt        j
                  j                  fv rt        d      t        | |      re|| j                  |k7  rd}|dt        j
                  j                  fv r2 |j                  t	        j                  | j                  d|            S | S |%t        | t              r| d	kD  s| d
k  rt        d      t	        j                   | |      } |j                  |      S )z~
    Array API compatible wrapper for :py:func:`np.asarray <numpy.asarray>`.

    See its docstring for more information.
    r	   r
   cpuNUnsupported device Fz!copy=False is not yet implementedT)r   r   l            l         z&Integer out of bounds for array dtypesr   )_array_objectr
   r   r   np	_CopyMode	IF_NEEDEDNotImplementedError
isinstancer   ALWAYS_newarray_arrayintOverflowErrorasarray)objr   r   r   r
   ress         r   r-   r-      s    , %u]".vj9::r||--..!"EFF#ue!3DD",,--..5::bhhszzEJKK
}C-3=C*DT DEE
**S
&C5::c?r   )r   r   c                  ddl m} t        |       |dvrt        d|       |j                  t        j                  | |||            S )z|
    Array API compatible wrapper for :py:func:`np.arange <numpy.arange>`.

    See its docstring for more information.
    r	   r   r   r   )stopstepr   )r!   r
   r   r   r(   r"   arange)startr1   r2   r   r   r
   s         r   r3   r3   K   sJ     %u]".vj9::5::biiDt5IJJr   c                   ddl m} t        |       |dvrt        d|       |j                  t        j                  | |            S )zz
    Array API compatible wrapper for :py:func:`np.empty <numpy.empty>`.

    See its docstring for more information.
    r	   r   r   r   r    )r!   r
   r   r   r(   r"   emptyshaper   r   r
   s       r   r6   r6   a   F     %u]".vj9::5::bhhuE233r   c                  ddl m} t        |       |dvrt        d|       |j                  t        j                  | j                  |            S )z
    Array API compatible wrapper for :py:func:`np.empty_like <numpy.empty_like>`.

    See its docstring for more information.
    r	   r   r   r   r    )r!   r
   r   r   r(   r"   
empty_liker*   xr   r   r
   s       r   r;   r;   t   J     %u]".vj9::5::bmmAHHE:;;r   )kr   r   c                  ddl m} t        |       |dvrt        d|       |j                  t        j                  | |||            S )zv
    Array API compatible wrapper for :py:func:`np.eye <numpy.eye>`.

    See its docstring for more information.
    r	   r   r   r   )Mr?   r   )r!   r
   r   r   r(   r"   eye)n_rowsn_colsr?   r   r   r
   s         r   rB   rB      sJ     %u]".vj9::5::bffVv%@AAr   c               X    ddl m}  |j                  t        j                  |             S )Nr	   r   )r!   r
   r(   r"   from_dlpack)r=   r
   s     r   rF   rF      s    $5::bnnQ'((r   c               $   ddl m} t        |       |dvrt        d|      t	        ||      r|j
                  dk(  r|j                  }t        j                  | ||      }|j                  t        vrt        d       |j                  |      S )zx
    Array API compatible wrapper for :py:func:`np.full <numpy.full>`.

    See its docstring for more information.
    r	   r   r   r   r   r    zInvalid input to full)r!   r
   r   r   r&   ndimr*   r"   fullr   r   	TypeErrorr(   )r8   
fill_valuer   r   r
   r/   s         r   rI   rI      s     %u]".vj9::*e$A)=&&

''%5
1C
yy# /005::c?r   c                  ddl m} t        |       |dvrt        d|      t	        j
                  | j                  ||      }|j                  t        vrt        d       |j                  |      S )z
    Array API compatible wrapper for :py:func:`np.full_like <numpy.full_like>`.

    See its docstring for more information.
    r	   r   r   r   r    zInvalid input to full_like)r!   r
   r   r   r"   	full_liker*   r   r   rJ   r(   )r=   rK   r   r   r
   r/   s         r   rM   rM      sj     %u]".vj9::
,,qxx5
9C
yy# 4555::c?r   T)r   r   endpointc         	         ddl m} t        |       |dvrt        d|       |j                  t        j                  | ||||            S )z
    Array API compatible wrapper for :py:func:`np.linspace <numpy.linspace>`.

    See its docstring for more information.
    r	   r   r   r   )r   rN   )r!   r
   r   r   r(   r"   linspace)r4   r1   numr   r   rN   r
   s          r   rP   rP      sL     %u]".vj9::5::bkk%s%(STTr   xy)indexingc                $   ddl m} t        |D ch c]  }|j                   c}      dkD  rt	        d      t        j                  |D cg c]  }|j                   c}d| iD cg c]  } |j                  |       c}S c c}w c c}w c c}w )z
    Array API compatible wrapper for :py:func:`np.meshgrid <numpy.meshgrid>`.

    See its docstring for more information.
    r	   r   z,meshgrid inputs must all have the same dtyperS   )	r!   r
   lenr   r   r"   meshgridr*   r(   )rS   arraysr
   ar)   s        r   rV   rV      s     %
 V$AGG$%)GHH [[V"<188"<PxP 	

5  %
 #=s   BB'Bc                   ddl m} t        |       |dvrt        d|       |j                  t        j                  | |            S )zx
    Array API compatible wrapper for :py:func:`np.ones <numpy.ones>`.

    See its docstring for more information.
    r	   r   r   r   r    )r!   r
   r   r   r(   r"   onesr7   s       r   rZ   rZ      sF     %u]".vj9::5::bgge5122r   c                  ddl m} t        |       |dvrt        d|       |j                  t        j                  | j                  |            S )z
    Array API compatible wrapper for :py:func:`np.ones_like <numpy.ones_like>`.

    See its docstring for more information.
    r	   r   r   r   r    )r!   r
   r   r   r(   r"   	ones_liker*   r<   s       r   r\   r\     sJ     %u]".vj9::5::bll18859::r   r?   c                  ddl m} | j                  dk  rt        d       |j                  t        j                  | j                  |            S )zx
    Array API compatible wrapper for :py:func:`np.tril <numpy.tril>`.

    See its docstring for more information.
    r	   r      z)x must be at least 2-dimensional for trilr]   )r!   r
   rH   r   r(   r"   trilr*   r=   r?   r
   s      r   r`   r`   #  >     %vvzDEE5::bggahh!,--r   c                  ddl m} | j                  dk  rt        d       |j                  t        j                  | j                  |            S )zx
    Array API compatible wrapper for :py:func:`np.triu <numpy.triu>`.

    See its docstring for more information.
    r	   r   r_   z)x must be at least 2-dimensional for triur]   )r!   r
   rH   r   r(   r"   triur*   ra   s      r   rd   rd   1  rb   r   c                   ddl m} t        |       |dvrt        d|       |j                  t        j                  | |            S )zz
    Array API compatible wrapper for :py:func:`np.zeros <numpy.zeros>`.

    See its docstring for more information.
    r	   r   r   r   r    )r!   r
   r   r   r(   r"   zerosr7   s       r   rf   rf   ?  r9   r   c                  ddl m} t        |       |dvrt        d|       |j                  t        j                  | j                  |            S )z
    Array API compatible wrapper for :py:func:`np.zeros_like <numpy.zeros_like>`.

    See its docstring for more information.
    r	   r   r   r   r    )r!   r
   r   r   r(   r"   
zeros_liker*   r<   s       r   rh   rh   R  r>   r   )
r.   zZUnion[Array, bool, int, float, NestedSequence[bool | int | float], SupportsBufferProtocol]r   Optional[Dtype]r   Optional[Device]r   z#Optional[Union[bool, np._CopyMode]]returnr
   )Nr	   )r1   zOptional[Union[int, float]]r2   Union[int, float]r4   rl   r   ri   r   rj   rk   r
   )r8   Union[int, Tuple[int, ...]]r   ri   r   rj   rk   r
   )r=   r
   r   ri   r   rj   rk   r
   r   )rC   r+   rD   zOptional[int]r?   r+   r   ri   r   rj   rk   r
   )r=   objectrk   r
   )
r8   rm   rK   rl   r   ri   r   rj   rk   r
   )
rK   rl   r=   r
   r   ri   r   rj   rk   r
   )rQ   r+   r4   rl   r1   rl   r   ri   r   rj   rN   boolrk   r
   )rW   r
   rS   strrk   zList[Array])r=   r
   r?   r+   rk   r
   )%
__future__r   typingr   r   r   r   r   _typingr
   r   r   r   r   collections.abcr   _dtypesr   numpyr"   r   r-   r3   r6   r;   rB   rF   rI   rM   rP   rV   rZ   r\   r`   rd   rf   rh    r   r   <module>rx      s;   " ? >  )   B, "#04)
) ) ) .) )^ )-	K "#K &K 	KK K K K2 "#	4&4 4 	4
 4( .2d<<*<;K<
<$ !B
 !#BBB
 B B B B,) "#&! 	
  @ "# "
   @ "#U 
	UU
U U U U U. .2 . "#	3&3 3 	3
 3( .2d;;*;;K;
;  #$ . #$ ." "#	4&4 4 	4
 4( .2d<<*<;K<
<r   