o
    iL                     @   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)dtypeZeUVOMmG)np	typecodeszerosr   	TypeErrorr   )ntA_ r   h/home/kim/smarthome/.venv/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 Z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&   (...
r1   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   r.   r   )r    r   mr/   r0   r   r   r   test_bandwidth_rect_inputs3   s   (...r4   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   r5   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   r6   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   r2   r   r                 ?)r   arangeastypecomplexreshapepir    r   r   r   r   r    test_issymetric_complex_decimals[   s
   "

r?   c                  C   sd   t ddtdd} | t ddtddd 7 } | t j } | | j  } t| s0J d S r7   )	r   r:   r;   r<   r=   r>   r    conjr   r   r   r   r   !test_ishermitian_complex_decimalsd   s
   "
rA   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        rH   Zrtol-q=vIh%<=)r   randomRandomStateuniformr    standard_normalr   r   rngr%   ypzr   r   r   $test_issymmetric_approximate_resultsm   s   
rV   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:rB   rC   r9   rF   rG   rI   rJ   rK   rL   )r   rM   rN   rO   r    rP   r@   r   rQ   r   r   r   $test_ishermitian_approximate_resultsz   s   
 rW   )numpyr   Zscipy.linalgr   r   r   Zpytestr   r   r   markZparametrizer   r1   r4   r5   r6   r?   rA   rV   rW   r   r   r   r   <module>   s     

		