U
    9%e                     @   s  d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	m
Z
 d dlmZmZ d dlmZmZ d dlmZmZmZ e	d	d
e gd	e dggZe	d
e dgde d
ggZed\ZZZZZZZZedeeZedeeZ edeeZ!edeeZ"edeeZ#dd Z$dd Z%dd Z&dd Z'dd Z(dd Z)dd  Z*d!d" Z+d#d$ Z,d%d& Z-d'd( Z.d)d* Z/d+d, Z0d-d. Z1d/d0 Z2d1d2 Z3d3d4 Z4d5d6 Z5d7S )8    )Mod)I)symbols)floor)Matrixeye)MatrixSymbolIdentity)dettrace)KroneckerProductkronecker_productcombine_kronecker            zi,j,k,n,m,o,p,xZWABCc                   C   s   t ttttstttttttttks4ttttjtt	 t	t
 fksTtttttt t jspttttttjtj jstd S N)
isinstancer   r   r   AssertionErrorsubsr   shapenmkZis_ZeroMatrixr   r   r   Zis_Identity r    r    n/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/sympy/matrices/expressions/tests/test_kronecker.pytest_KroneckerProduct   s
      r"   c                   C   sD   t ttttttt ks"tt tdtdtdks@td S )Nr   r      )r   r	   r   r   r   r   r    r    r    r!   test_KroneckerProduct_identity!   s    "r$   c                  C   s2  t ddd} t ddd}t| |}|jdks0t| t| d |d  | d |d  | d |d  | d |d  g| d |d  | d |d  | d |d  | d |d  g| d |d  | d |d  | d |d  | d |d  g| d |d  | d |d  | d |d  | d |d  ggks.td S )	NXr   Y)r   r   )r   r   )r   r   )r   r   )r   r   )r   r   r   r   Zas_explicitr   )r%   r&   kpr    r    r!   test_KroneckerProduct_explicit&   s    
::::r(   c                   C   sV   t tt t t t t t  ks.tt tt tt t ksRtd S r   )	r   r   r   r   Zadjointr   mat1mat2r   r    r    r    r!   test_tensor_product_adjoint5   s    r+   c                   C   sV   t tt t t t t t  ks.tt tt tt t ksRtd S r   )	r   r   r   r   	conjugater   r)   r*   r   r    r    r    r!   test_tensor_product_conjugate<   s    r-   c                   C   sT   t tt t tt t t  ks,tt tt tt t ksPtd S r   )	r   r   r   r   Z	transposer   r)   r*   r   r    r    r    r!   test_tensor_product_transposeC   s    r.   c                   C   sH   t tt ttt t tttks$tt tt ttttttksDtd S r   )r   r   r   r   r   r   r    r    r    r!   $test_KroneckerProduct_is_associativeJ   s      
r/   c                   C   sD   t tt ttt tt ks tt ttt tt tt ks@td S r   )r   xr   r   r   r    r    r    r!   !test_KroneckerProduct_is_bilinearQ   s     r1   c                  C   s2   t tt} t| ttt ttt  ks.td S r   )r   r   r   r
   r   r   r   r'   r    r    r!   !test_KroneckerProduct_determinantV   s    
r3   c                  C   s*   t tt} t| tttt ks&td S r   )r   r   r   r   r   r2   r    r    r!   test_KroneckerProduct_trace[   s    
r4   c                   C   s0   t ttt ttkstt ttjdks,td S )NF)r   r   r   r   Zis_commutativer    r    r    r!   &test_KroneckerProduct_isnt_commutative`   s    r5   c                   C   s,   t tt dt td ttt ks(td S )Nr   )r   r0   r   r   r   r   r    r    r    r!   /test_KroneckerProduct_extracts_commutative_parte   s
    r6   c                  C   s,   t tt} |  t t t ks(td S r   )r   r   r   Zinverser   r2   r    r    r!   test_KroneckerProduct_inversej   s    
r7   c                  C   s:   t tt} t tt}t| | t tt tt ks6td S r   )r   r   r   r   r   r   r   )kp1kp2r    r    r!   !test_KroneckerProduct_combine_addo   s    

r:   c                  C   sR   t dtt} t dtt}tt| }tt|}t|| ttt | | ksNtd S )Nr%   r&   )r   r   r   r   r   r   r   r   )r%   r&   r8   r9   r    r    r!   !test_KroneckerProduct_combine_mulu   s
    

r;   c                  C   s   t dtt} t dtt}tt| |t t| t |t ks@tttt| |d  tt| d |d  ksptttt| |d  ttt tt| d t |d t  kstttttjt	 tttjt	 kstd S )Nr%   r&   r   )
r   r   r   r   r0   r   r   r   Tr   r%   r&   r    r    r!   !test_KroneckerProduct_combine_pow}   s*     r>   c                  C   sb   t dtt} t dtt}t| | |t jddt| |t| t t|| t|t ks^td S )Nr%   r&   T)Zkroneckerproduct)r   r   r   r   expandr   r=   r    r    r!   test_KroneckerProduct_expand   s    r@   c                  C   sr   t dtt} t dtt}t| |tt| t	t
tt tt	t
tt tf |t	ttt	ttf  ksntd S )Nr   r   )r   r   r   opr   Z_entryijr   r   r   )r   r   r    r    r!   test_KroneckerProduct_entry   s    rE   N)6Zsympy.core.modr   Zsympy.core.numbersr   Zsympy.core.symbolr   Z#sympy.functions.elementary.integersr   Zsympy.matrices.denser   r   Zsympy.matricesr   r	   Zsympy.matrices.expressionsr
   r   Z$sympy.matrices.expressions.kroneckerr   r   r   r)   r*   rC   rD   r   r   r   rA   rB   r0   r   r   r   r   r   r"   r$   r(   r+   r-   r.   r/   r1   r3   r4   r5   r6   r7   r:   r;   r>   r@   rE   r    r    r    r!   <module>   sB   