U
    ?h                      @   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k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   `/var/www/html/venv/lib/python3.8/site-packages/scipy/linalg/tests/test_cythonized_array_utils.pytest_bandwidth_dtypes   s    r   c                  C   sH   t dddg} ttt|  t dddgdddg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 k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std S )N   r   Fr	   orderr   c                 S   s   g | ]}|qS r   r   r"   r   r   r   r%   !   s     z0test_bandwidth_square_inputs.<locals>.<listcomp>c                 S   s   g | ]}|qS r   r   r"   r   r   r   r%   "   s     c                 S   s   g | ]}|qS r   r   r"   r   r   r   r%   #   s     c                 S   s   g | ]}|qS r   r   r"   r   r   r   r%   $   s     r   r   ranger   AssertionError)r    r   kRr   r   r   test_bandwidth_square_inputs   s    (...r/   c                 C   s   g | ]}|d k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std S )N)
   r&   r   r'   r(   r   c                 S   s   g | ]}|qS r   r   r"   r   r   r   r%   /   s     z.test_bandwidth_rect_inputs.<locals>.<listcomp>c                 S   s   g | ]}|qS r   r   r"   r   r   r   r%   0   s     c                 S   s   g | ]}|qS r   r   r"   r   r   r   r%   1   s     c                 S   s   g | ]}|qS r   r   r"   r   r   r   r%   2   s     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krFttt| ttt| q|dkrPqt|s\tt|stqd S r   )r   r   r   r   r   r   r   r,   )r   r   r   r   r   r   "test_issymetric_ishermitian_dtypes6   s    r3   c                  C   s   t dddg} ttt|  ttt|  t dddgdddggg} ttt|  ttt|  t dddgdddg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\td S Nr   r0   r   r                 ?)	r   arangeastypecomplexreshapepir    r   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`t	d S r5   )
r   r8   r9   r:   r;   r<   r    conjr   r,   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sXtt|dddsjtt|dd	ds|tt|d
d	dstd S )Nr&   i[      @highsize绽|=atol        rF   Zrtol-q=vIh%<=)r   randomRandomStateuniformr    standard_normalr   r,   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sntt|ddd	stt|dd
d	stt|dd
d	std S )Nr&   ih:r@   rA   r7   rD   rE   rG   rH   rI   rJ   )	r   rK   rL   rM   r    rN   r>   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   

		