o
    hL                     @   s   d dl Zd dlmZmZmZ d dlZd dlmZ dd Zdd Z	ej
dd	d
 ejd D dd Zej
ddd
 ejd D dd Zdd Zdd Zdd Zdd Zdd Zdd ZdS )    N)	bandwidthissymmetricishermitian)raisesc                  C   sR   d} t jd D ]}t j| | g|d}|dv rttt| q|dkr"qt|}qd S N   All)dtypeeUVOMmG)np	typecodeszerosr   	TypeErrorr   )ntA_ r   b/var/www/vscode/kcb/lib/python3.10/site-packages/scipy/linalg/tests/test_cythonized_array_utils.pytest_bandwidth_dtypes   s   
r   c                  C   sB   t g d} ttt|  t g dg dgg} ttt|  d S N)         )   r      )r   arrayr   
ValueErrorr   r   r   r   r   test_bandwidth_non2d_input   s   r    Tc                 C      g | ]}|d vr|qS eGUVOMmr   .0xr   r   r   
<listcomp>       r(   r   c                 C   s0  d}d}t j||g| dd}d|dd t|D dd t|D f< d|dd t|| D dd t||D f< d|d	d td|D d	d t|d D f< d|d
d t||D d
d t|| D f< t|||fksqJ t g dg dg dg dg dg dg dg dg}t|dksJ d S )N   r   Fr	   orderr   c                 S      g | ]}|qS r   r   r%   r   r   r   r(   !       z0test_bandwidth_square_inputs.<locals>.<listcomp>c                 S   r.   r   r   r%   r   r   r   r(   "   r/   c                 S   r.   r   r   r%   r   r   r   r(   #   r/   c                 S   r.   r   r   r%   r   r   r   r(   $   r/   )r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   )r   r   )r   r   ranger   r   )r!   r   kRr   r   r   r   test_bandwidth_square_inputs   s&   (...
r3   c                 C   r"   r#   r   r%   r   r   r   r(   3   r)   c                 C   s   d\}}d}t j||g| dd}d|dd t|D dd t|D f< d|dd t|| D dd t||D f< d|d	d td|D d	d t|d D f< d|d
d t||D d
d t|| D f< t|||fkssJ d S )N)
   r*   r   r+   r,   r   c                 S   r.   r   r   r%   r   r   r   r(   :   r/   z.test_bandwidth_rect_inputs.<locals>.<listcomp>c                 S   r.   r   r   r%   r   r   r   r(   ;   r/   c                 S   r.   r   r   r%   r   r   r   r(   <   r/   c                 S   r.   r   r   r%   r   r   r   r(   =   r/   )r   r   r0   r   )r!   r   mr1   r2   r   r   r   test_bandwidth_rect_inputs3   s   (...r6   c                  C   sn   d} t jd D ]-}t j| | g|d}|dv r#ttt| ttt| q|dkr(qt|s.J t|s4J qd S r   )r   r   r   r   r   r   r   )r   r   r   r   r   r   "test_issymetric_ishermitian_dtypesA   s   r7   c                  C   s   t g d} ttt|  ttt|  t g dg dgg} ttt|  ttt|  t g dg dg} ttt|  ttt|  d S r   )r   r   r   r   r   r   r   r   r   r   *test_issymmetric_ishermitian_invalid_inputO   s   r8   c                  C   s`   t ddtdd} | t ddtddd 7 } | t j } | | j } t| s.J d S Nr   r4   r   r                 ?)r   arangeastypecomplexreshapepir!   r   r   r   r   r    test_issymetric_complex_decimals[   s
   "

rA   c                  C   sd   t ddtdd} | t ddtddd 7 } | t j } | | j  } t| s0J d S r9   )	r   r<   r=   r>   r?   r@   r!   conjr   r   r   r   r   !test_ishermitian_complex_decimalsd   s
   "
rC   c                  C   s   d} t jd}|jd| | gd}||j }|| | g}|| |j }t|dds,J t|ddds5J t|dd	ds>J t|d
d	dsGJ d S )Nr*   i[      @highsize绽|=atol        rJ   rtol-q=vIh%<=)r   randomRandomStateuniformr!   standard_normalr   r   rngr'   ypzr   r   r   $test_issymmetric_approximate_resultsm   s   
rY   c                  C   s   d} t jd}|jd| | gd}||j }|| | g|| | gd  }|| | j }t|dds7J t|ddd	s@J t|dd
d	sIJ t|dd
d	sRJ d S )Nr*   ih:rD   rE   r;   rH   rI   rK   rL   rN   rO   )r   rP   rQ   rR   r!   rS   rB   r   rT   r   r   r   $test_ishermitian_approximate_resultsz   s   
 rZ   )numpyr   scipy.linalgr   r   r   pytestr   r   r    markparametrizer   r3   r6   r7   r8   rA   rC   rY   rZ   r   r   r   r   <module>   s     

		