o
    Je!                     @   s  d Z ddlZddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZmZ ejjZejjZejjZejjZejjZej jZ!e"ej#e"ej$e"ej%e"ej&iZ'e"ej(e"ej&kre')e"ej*e"ej(i dddedfddZ+dddedfddZ,ddddedfddZ-ddddedfddZ.d,ddddZ/d,ddddZ0d-ddZ1d.ddZ2d,dddd Z3d/ddd!d"Z4d/ddd#d$Z5d0d%d&Z6d1d(d)Z7d1d*d+Z8dS )2zx
Array methods which are called by both the C-code for the method
and the Python code for the NumPy-namespace function

    N)nullcontext)
multiarray)umath)
asanyarray)numerictypes)_exceptions)_no_nep50_warning)_NoValue)pickle	os_fspathFTc                 C      t | |d ||||S N)umr_maximumaaxisoutkeepdimsinitialwhere r   a/home/seandotau/au.memorygallery.club/gallery/lib/python3.10/site-packages/numpy/core/_methods.py_amax'      r   c                 C   r   r   )umr_minimumr   r   r   r   _amin+   r   r   c                 C      t | ||||||S r   )umr_sumr   r   dtyper   r   r   r   r   r   r   _sum/   r   r    c                 C   r   r   )umr_prodr   r   r   r   _prod3   r   r"   r   c                C   ,   |du rt | ||||S t | |||||dS NTr#   )umr_anyr   r   r   r   r   r   r   r   r   _any7      r(   c                C   r$   r%   )umr_allr'   r   r   r   _all=   r)   r+   c                 C   s   |du r2|d u rt t| j}nt|t s|f}d}|D ]}|| jt|| j 9 }qt|}|S ddl	m
} t||| j|tjd |}|S )NT   r   )broadcast_to)tuplerangendim
isinstanceshapemuZnormalize_axis_indexntZintpZnumpy.lib.stride_tricksr-   r   )arrr   r   r   itemsaxr-   r   r   r   _count_reduce_itemsC   s   


r8   c                 K   sr   |d u r|d u rt d|d u rtj| |fd|i|S |d u r,tj| |fd|i|S tj| ||fd|i|S )NzOne of max or min must be givenr   )
ValueErrorumminimummaximumZclip)r   minmaxr   kwargsr   r   r   _clipZ   s   r@   c          
      C   sN  t | }d}t||||d}|du r|dkr'nt|dkd dr'tjdtdd |d u rKt|jjt	j
t	jfr<td	}nt|jjt	jrKtd
}d}t||||||d}	t|	tjrt  tj|	||	ddd}	W d    n1 ssw   Y  |r|d u r|j|	}	|	S t|	dr|r|j|	| }	|	S |	j|	| }	|	S |	| }	|	S )NFr   r   Tr   r   zMean of empty slice.   
stacklevelf8Zf4r#   unsafer   ZcastingZsubokr   )r   r8   r&   warningswarnRuntimeWarning
issubclassr   typer4   integerbool_r3   Zfloat16r   r1   ndarrayr   r:   true_dividehasattr)
r   r   r   r   r   r   r5   Zis_float16_resultrcountretr   r   r   _meane   s:   "

	
rU   c                C   sF  t | }t||||d}|du r||kr%nt||kd dr%tjdtdd |d u r9t|jjt	j
t	jfr9td}t|||d|d}	|jdkrJ|}
n||	j}
t|	tjrtt  tj|	|
|	d	d
d}	W d    n1 snw   Y  nt|	dr|	j|	| }	n|	| }	t ||	 }t|jjt	jt	j
frtj|||d}n3|jtv r|jt|j dfd}tj|||d tj|d |d |jdj}ntj|t||dj}t||||||d}t|| d}t|tjrt  tj|||d	d
d}W d    |S 1 sw   Y  |S t|dr|j|| }|S || }|S )NrA   TrB   z!Degrees of freedom <= 0 for slicerC   rD   rF   r   rG   FrH   r   r   rC   )r   ).r   ).r,   )r   r8   r&   rI   rJ   rK   rL   r   rM   r4   rN   rO   r3   r   r0   Zreshaper2   r1   rP   r   r:   rQ   rR   Zfloatingmultiply_complex_to_floatviewaddreal	conjugater<   )r   r   r   r   ddofr   r   r5   rS   ZarrmeandivxZxvrT   r   r   r   _var   s\   "






ra   c             	   C   sb   t | ||||||d}t|tjrtj||d}|S t|dr*|jt|}|S t|}|S )N)r   r   r   r^   r   r   rV   r   )	ra   r1   r3   rP   r:   sqrtrR   r   rM   )r   r   r   r   r^   r   r   rT   r   r   r   _std   s   

rc   c              	   C   s&   t t| |d ||t| |d d ||S r   )r:   subtractr   r   )r   r   r   r   r   r   r   _ptp   s
   re   rC   c                 C   s\   t |dr
t|}ntt|d}|}tj| ||d W d    d S 1 s'w   Y  d S )Nwritewbprotocol)rR   r   openr   r
   dump)selffileri   ctxfr   r   r   _dump   s   

"rp   c                 C   s   t j| |dS )Nrh   )r
   dumps)rl   ri   r   r   r   _dumps   s   rr   )NNNF)FT)NNN)NNNr   F)NNFrW   )9__doc__rI   
contextlibr   Z
numpy.corer   r3   r   r:   Znumpy.core.multiarrayr   r   r4   r   Znumpy.core._ufunc_configr   Znumpy._globalsr	   Znumpy.compatr
   r   r<   reducer   r;   r   r[   r   rX   r!   
logical_orr&   logical_andr*   r   ZcsinglesingleZcdoubledoublerY   Z
longdoubleupdateZclongdoubler   r   r    r"   r(   r+   r8   r@   rU   ra   rc   re   rp   rr   r   r   r   r   <module>   sd    





"E

