
    wgE                         d dl mZ d dlmZ d dlmZ  G d de      Z e       Zed        ZddZ	d d	 e	d
fdZ
ddZd Zd Zd Zy
)    )contextmanager)local
expand_mulc                       e Zd Zd Zy)DotProdSimpStatec                     d | _         y N)state)selfs    ]/home/mcse/projects/flask/flask-venv/lib/python3.12/site-packages/sympy/matrices/utilities.py__init__zDotProdSimpState.__init__   s	    
    N)__name__
__module____qualname__r    r   r   r   r      s    r   r   c              #      K   t         j                  }	 | t         _        d  |t         _        y # |t         _        w xY wwr
   _dotprodsimp_stater   )xolds     r   dotprodsimpr      s4     

"
"C'#$ #& 3 s   ?/ ?<?c                 "    ddl m}  || |      S )z;Wrapper for simplify.dotprodsimp to avoid circular imports.r   )r   )withsimp)sympy.simplify.simplifyr   )exprr   dpss      r   _dotprodsimpr      s    :th''r   c                     | S r
   r   r   s    r   <lambda>r"      s    Q r   c                     | S r
   r   r!   s    r   r"   r"      s    ! r   Nc                 f    |du st         j                  du r|S |du st         j                  du r|S | S )a  Support function for controlling intermediate simplification. Returns a
    simplification function according to the global setting of dotprodsimp
    operation.

    ``deffunc``     - Function to be used by default.
    ``offfunc``     - Function to be used if dotprodsimp has been turned off.
    ``onfunc``      - Function to be used if dotprodsimp has been turned on.
    ``dotprodsimp`` - True, False or None. Will be overridden by global
                      _dotprodsimp_state.state if that is not None.
    FTr   )deffuncofffunconfuncr   s       r   _get_intermediate_simpr(      s?     e1775@d066$>Nr   c                     t        | dd|      S )zYSame as ``_get_intermediate_simp`` but returns bools instead of functions
    by default.FT)r(   )defaultr   s     r   _get_intermediate_simp_boolr+   3   s     "'5$DDr   c                     t        | dd      S )zReturns True if x is zero.is_zeroN)getattrr!   s    r   _iszeror/   :   s    1i&&r   c                     t        |       dk(  S )zNTests by expand_mul only, suitable for polynomials and rational
    functions.r   r   r!   s    r   _is_zero_after_expand_mulr1   ?   s     a=Ar   c                     ddl m}  ||       S )z$ Wrapper to avoid circular imports. r   )simplify)r   r3   )r   r3   s     r   	_simplifyr4   E   s    0D>r   )F)FN)
contextlibr   	threadingr   sympy.core.functionr   r   r   r   r   r(   r+   r/   r1   r4   r   r   r   <module>r8      sb    %  *u  &' ' '( $/*E'
r   