a
    RG5dE                     @   s   d dl mZ d dlmZ d dlmZ G dd deZe Zedd Zdd	d
Z	dd dd e	dfddZ
dddZdd Zdd Zdd ZdS )    )contextmanager)local
expand_mulc                   @   s   e Zd Zdd ZdS )DotProdSimpStatec                 C   s
   d | _ d S N)state)self r
   T/var/www/html/django/DPS/env/lib/python3.9/site-packages/sympy/matrices/utilities.py__init__   s    zDotProdSimpState.__init__N)__name__
__module____qualname__r   r
   r
   r
   r   r      s   r   c                 c   s*   t j}z| t _d V  W |t _n|t _0 d S r   _dotprodsimp_stater   )xoldr
   r
   r   dotprodsimp   s
    r   Fc                 C   s   ddl m} || |dS )z;Wrapper for simplify.dotprodsimp to avoid circular imports.r   )r   )withsimp)sympy.simplify.simplifyr   )exprr   dpsr
   r
   r   _dotprodsimp   s    r   c                 C   s   | S r   r
   r   r
   r
   r   <lambda>       r   Nc                 C   s0   |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   )ZdeffuncZofffuncZonfuncr   r
   r
   r   _get_intermediate_simp   s
    r   c                 C   s   t | dd|S )zYSame as ``_get_intermediate_simp`` but returns bools instead of functions
    by default.FT)r   )defaultr   r
   r
   r   _get_intermediate_simp_bool3   s    r   c                 C   s   t | ddS )zReturns True if x is zero.is_zeroN)getattrr   r
   r
   r   _iszero:   s    r"   c                 C   s   t | dkS )zNTests by expand_mul only, suitable for polynomials and rational
    functions.r   r   r   r
   r
   r   _is_zero_after_expand_mul?   s    r#   c                 C   s   ddl m} || S )z$ Wrapper to avoid circular imports. r   )simplify)r   r$   )r   r$   r
   r
   r   	_simplifyE   s    r%   )F)FN)
contextlibr   	threadingr   sympy.core.functionr   r   r   r   r   r   r   r"   r#   r%   r
   r
   r
   r   <module>   s   




