o
    h                     @   sF   d Z ddlZddlmZmZ ddlmZ ddl	m
Z
 G dd dZdS )z3Test functions for linalg.matmul_toeplitz function
    N)toeplitzmatmul_toeplitz)raises)assert_allclosec                   @   s>   e Zd Zdd Zdd Zdd Zdd Zd	d
 ZdddZdS )TestMatmulToeplitzc                 C   s   t jd| _d| _d S )N*   g7QE=)nprandomRandomStaterng	toleranceself r   [/var/www/vscode/kcb/lib/python3.10/site-packages/scipy/linalg/tests/test_matmul_toeplitz.pysetup_method   s   
zTestMatmulToeplitz.setup_methodc                    s  g }d} j j|d} j j|d} j j|dfd}||||df d} j j|d} j j|d} j j|dfd}||||df d} j j|d} j j|d} j j|dfd}||||df d} j j|d} j j|d} j j|dfd}||||df d} j j|d} j j|d} j j| j dd	fd}||||df d} j j|dfd} j j|dfd} j j| j dd	fd}||||df d} j j|dfd}d } j j| j dd	fd}||||dd
f d} j j|dfd}d } j j|d}||||df d} j j|d} j j|d d} j j|d dfd}||||df d} j j|d} j j|d d} j j|d  j dd	fd}||||df  fdd|D  d S )N   sizeF   e   Ti  d   
         c                    s   g | ]} j | qS r   )do).0ir   r   r   
<listcomp>P   s    z0TestMatmulToeplitz.test_real.<locals>.<listcomp>)r   normalappendrandint)r   casesncrxr   r   r   	test_real   sh    zTestMatmulToeplitz.test_realc                 C   s,  d}| j j|dfd| j j|dfdd  }| j j|dfd| j j|dfdd  }| j j|dfd| j j|dfdd  }| |||d d}| j j|dfd| j j|dfdd  }| j j|d dfd| j j|d dfdd  }| j j|d dfd| j j|d dfdd  }| |||d d S )	N   r   r   y              ?   Fr   r   )r   r    r   r   r$   r%   r&   r'   r   r   r   test_complexR   s   ((((zTestMatmulToeplitz.test_complexc                 C   s:   g }g }g }|  |||d td}|  |||d d S )NF)r   r   )r   r   empty)r   r%   r&   r'   r   r   r   
test_emptya   s   
zTestMatmulToeplitz.test_emptyc                 C   s   d}| j j|d}| j jd| d}| j j|d}ttt||f|d d}| j j|d}| j j|d}| j j|d d}ttt||f|d d}| j j|d}| j j|d d}| j j|d d d}ttt||f|d d S )Nr   r   r   Tr   )r   r    assert_raises
ValueErrorr   r+   r   r   r   test_exceptionsj   s   z"TestMatmulToeplitz.test_exceptionsNFc                 C   sb   t |}|d u rt||||}nt |}t||f||}t||| }t||| j| jd d S )N)rtolatol)r   ravelr   r   r   r   )r   r'   r%   r&   check_finiteworkersactualdesiredr   r   r   r      s   


zTestMatmulToeplitz.do)NFN)	__name__
__module____qualname__r   r(   r,   r.   r1   r   r   r   r   r   r      s    A	r   )__doc__numpyr   scipy.linalgr   r   pytestr   r/   numpy.testingr   r   r   r   r   r   <module>   s    