a
    Re                      @   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rDqt|}qd S N   All)dtypeZeUVOMmG)np	typecodeszerosr   	TypeErrorr   )ntA_ r   b/var/www/sunrise/env/lib/python3.9/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   s   g | ]}|d vr|qS ZeGUVOMmr   .0xr   r   r   
<listcomp>   s   r%   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sJ d S )N   r   Fr	   orderr   c                 S   s   g | ]}|qS r   r   r"   r   r   r   r%   !       z0test_bandwidth_square_inputs.<locals>.<listcomp>c                 S   s   g | ]}|qS r   r   r"   r   r   r   r%   "   r*   c                 S   s   g | ]}|qS r   r   r"   r   r   r   r%   #   r*   c                 S   s   g | ]}|qS r   r   r"   r   r   r   r%   $   r*   r   r   ranger   )r    r   kRr   r   r   test_bandwidth_square_inputs   s    (...r/   c                 C   s   g | ]}|d vr|qS r!   r   r"   r   r   r   r%   (   s   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sJ d S )N)
   r&   r   r'   r(   r   c                 S   s   g | ]}|qS r   r   r"   r   r   r   r%   /   r*   z.test_bandwidth_rect_inputs.<locals>.<listcomp>c                 S   s   g | ]}|qS r   r   r"   r   r   r   r%   0   r*   c                 S   s   g | ]}|qS r   r   r"   r   r   r   r%   1   r*   c                 S   s   g | ]}|qS r   r   r"   r   r   r   r%   2   r*   r+   )r    r   mr-   r.   r   r   r   test_bandwidth_rect_inputs(   s    (...r2   c                  C   sn   d} t jd D ]Z}t j| | g|d}|dv rFttt| ttt| q|dkrPqt|s\J t|sJ qd S r   )r   r   r   r   r   r   r   )r   r   r   r   r   r   "test_issymetric_ishermitian_dtypes6   s    r3   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_inputD   s    r4   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   r0   r   r                 ?)r   arangeastypecomplexreshapepir    r   r   r   r   r    test_issymetric_complex_decimalsP   s
    "

r=   c                  C   sd   t ddtdd} | t ddtddd 7 } | t j } | | j  } t| s`J d S r5   )	r   r8   r9   r:   r;   r<   r    conjr   r   r   r   r   !test_ishermitian_complex_decimalsY   s
    "
r?   c                  C   s   d} t jd}|jd| | gd}||j }|| | g}|| |j }t|ddsXJ t|dddsjJ t|dd	ds|J t|d
d	dsJ d S )Nr&   i[      @highsize绽|=atol        rF   Zrtol-q=vIh%<=)r   randomRandomStateuniformr    standard_normalr   r   rngr$   ypzr   r   r   $test_issymmetric_approximate_resultsb   s    
rT   c                  C   s   d} t jd}|jd| | gd}||j }|| | g|| | gd  }|| | j }t|ddsnJ t|ddd	sJ t|dd
d	sJ t|dd
d	sJ d S )Nr&   ih:r@   rA   r7   rD   rE   rG   rH   rI   rJ   )r   rK   rL   rM   r    rN   r>   r   rO   r   r   r   $test_ishermitian_approximate_resultso   s    
 rU   )numpyr   Zscipy.linalgr   r   r   Zpytestr   r   r   markZparametrizer   r/   r2   r3   r4   r=   r?   rT   rU   r   r   r   r   <module>   s   

		