a
    ž¬<b  ã                   @   sŠ   d dl mZ 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	d
„ edfdd„Zddd„Zdd„ Zdd„ ZdS )é    )Úcontextmanager)Úlocal©Ú
expand_mul)Údotprodsimpc                   @   s   e Zd Zdd„ ZdS )ÚDotProdSimpStatec                 C   s
   d | _ d S ©N)Ústate)Úself© r   úh/Users/vegardjervell/Documents/master/model/venv/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   r      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   Fc                 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_bool,   s    r   c                 C   s   t | ddƒS )zReturns True if x is zero.Úis_zeroN)Úgetattrr   r   r   r   Ú_iszero3   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_mul8   s    r   )FN)Ú
contextlibr   Ú	threadingr   Zsympy.core.functionr   Zsympy.simplify.simplifyr   Z_dotprodsimpr   r   r   r   r   r   r   r   r   r   Ú<module>   s   
	ÿ

