o
    0cB'                     @  s  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d	 Zdddd
dRddZ		dSddddTddZddddUd!d"ZddddVd$d%Z	dWd ddd&dXd,d-ZdYd/d0ZddddZd2d3Zdddd[d4d5Zddd6d7d\d;d<Zd=d>d]dCdDZddddUdEdFZddddVdGdHZ d dId^dJdKZ!d dId^dLdMZ"ddddUdNdOZ#ddddVdPdQZ$dS )_    )annotations)TYPE_CHECKINGListOptionalTupleUnion   )ArrayDeviceDtypeNestedSequenceSupportsBufferProtocol)Sequence)_all_dtypesNc                 C  s$   dt  D ]	}| |u r d S qtd)NNz)dtype must be one of the supported dtypes)r   
ValueError)dtyped r   Y/var/www/html/gps/gps/lib/python3.10/site-packages/numpy/array_api/_creation_functions.py_check_valid_dtype   s
   r   )r   devicecopyobjZUnion[Array, bool, int, float, NestedSequence[bool | int | float], SupportsBufferProtocol]r   Optional[Dtype]r   Optional[Device]r   #Optional[Union[bool, np._CopyMode]]returnr	   c               C  s   ddl m} t| |dvrtd||dtjjfv r!tdt| |rG|dur1| j	|kr1d}|dtjj
fv rE|tj| jd|d	S | S |du r\t| tr\| d
ksX| dk r\tdtj| |d}||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 implementedNT)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)r   r   r   r   r	   resr   r   r   r0      s    
"
r0   )r   r   stopOptional[Union[int, float]]stepUnion[int, float]startc               C  B   ddl m} t| |dvrtd||tj| |||dS )z|
    Array API compatible wrapper for :py:func:`np.arange <numpy.arange>`.

    See its docstring for more information.
    r   r   r    r"   )r2   r4   r   )r$   r	   r   r   r+   r%   arange)r6   r2   r4   r   r   r	   r   r   r   r8   K   
   r8   shapeUnion[int, Tuple[int, ...]]c                C  >   ddl m} t| |dvrtd||tj| |d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r:   r   r   r	   r   r   r   r=   a   
   r=   xc               C  @   ddl m} t| |dvrtd||tj| j|d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-   r@   r   r   r	   r   r   r   rB   t   
   rB   )kr   r   n_rowsr.   n_colsOptional[int]rE   c               C  r7   )zv
    Array API compatible wrapper for :py:func:`np.eye <numpy.eye>`.

    See its docstring for more information.
    r   r   r    r"   )MrE   r   )r$   r	   r   r   r+   r%   eye)rF   rG   rE   r   r   r	   r   r   r   rJ      r9   rJ   objectc                C  s   ddl m} |t| S )Nr   r   )r$   r	   r+   r%   from_dlpack)r@   r	   r   r   r   rL      s   rL   
fill_valuec                C  sp   ddl m} t| |dvrtd|t||r"|jdkr"|j}tj| ||d}|j	t
vr3td||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+   )r:   rM   r   r   r	   r1   r   r   r   rO      s   

rO   c               C  sX   ddl m} t| |dvrtd|tj| j||d}|jtvr't	d|
|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   rP   r+   )r@   rM   r   r   r	   r1   r   r   r   rQ      s   

rQ   T)r   r   endpointnumrR   boolc            	   C  sD   ddl m} t| |dvrtd||tj| ||||dS )z
    Array API compatible wrapper for :py:func:`np.linspace <numpy.linspace>`.

    See its docstring for more information.
    r   r   r    r"   )r   rR   )r$   r	   r   r   r+   r%   linspace)r6   r2   rS   r   r   rR   r	   r   r   r   rU      s
   rU   xy)indexingarraysrW   strList[Array]c                   sR   ddl m  tdd |D dkrtd fddtjdd |D d	| iD S )
z
    Array API compatible wrapper for :py:func:`np.meshgrid <numpy.meshgrid>`.

    See its docstring for more information.
    r   r   c                 S  s   h | ]}|j qS r   r#   .0ar   r   r   	<setcomp>       zmeshgrid.<locals>.<setcomp>z,meshgrid inputs must all have the same dtypec                   s   g | ]}  |qS r   )r+   )r\   r,   r   r   r   
<listcomp>   s    zmeshgrid.<locals>.<listcomp>c                 S  s   g | ]}|j qS r   )r-   r[   r   r   r   r`      r_   rW   )r$   r	   lenr   r%   meshgrid)rW   rX   r   r   r   rb      s   
rb   c                C  r<   )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%   onesr>   r   r   r   rc      r?   rc   c               C  rA   )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-   rC   r   r   r   rd     rD   rd   rE   c               C  4   ddl m} | jdk rtd|tj| j|d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 trilre   )r$   r	   rN   r   r+   r%   trilr-   r@   rE   r	   r   r   r   rh   #     
rh   c               C  rf   )zx
    Array API compatible wrapper for :py:func:`np.triu <numpy.triu>`.

    See its docstring for more information.
    r   r   rg   z)x must be at least 2-dimensional for triure   )r$   r	   rN   r   r+   r%   triur-   ri   r   r   r   rk   1  rj   rk   c                C  r<   )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%   zerosr>   r   r   r   rl   ?  r?   rl   c               C  rA   )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-   rC   r   r   r   rm   R  rD   rm   )
r   r   r   r   r   r   r   r   r   r	   )Nr   )r2   r3   r4   r5   r6   r5   r   r   r   r   r   r	   )r:   r;   r   r   r   r   r   r	   )r@   r	   r   r   r   r   r   r	   r   )rF   r.   rG   rH   rE   r.   r   r   r   r   r   r	   )r@   rK   r   r	   )
r:   r;   rM   r5   r   r   r   r   r   r	   )
rM   r5   r@   r	   r   r   r   r   r   r	   )rS   r.   r6   r5   r2   r5   r   r   r   r   rR   rT   r   r	   )rX   r	   rW   rY   r   rZ   )r@   r	   rE   r.   r   r	   )%
__future__r   typingr   r   r   r   r   _typingr	   r
   r   r   r   collections.abcr   _dtypesr   numpyr%   r   r0   r8   r=   rB   rJ   rL   rO   rQ   rU   rb   rc   rd   rh   rk   rl   rm   r   r   r   r   <module>   sj    /

  