K iEddlmZddlmZddlmZGddeZeZedZddZ dd e d fd Z dd Z d Z dZ dZy ))contextmanager)local expand_mulceZdZdZy)DotProdSimpStatecd|_yN)state)selfs ^/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/matrices/utilities.py__init__zDotProdSimpState.__init__s  N)__name__ __module__ __qualname__rrr rrsrrc#Ktj} |t_d|t_y#|t_wxYwwr _dotprodsimp_stater )xolds r dotprodsimpr s4  " "C'#$  #& 3 s?/ ? <?c"ddlm}|||S)z;Wrapper for simplify.dotprodsimp to avoid circular imports.r)r)withsimp)sympy.simplify.simplifyr)exprrdpss r _dotprodsimprs: th ''rc|Sr rrs r r"sQrc|Sr rr!s r r"r"s!rNcf|dustjdur|S|dustjdur|S|S)aSupport 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)deffuncofffunconfuncrs r _get_intermediate_simpr(s?e1775@d066$> Nrct|dd|S)zYSame as ``_get_intermediate_simp`` but returns bools instead of functions by default.FT)r()defaultrs r _get_intermediate_simp_boolr+3s "'5$ DDrct|ddS)zReturns True if x is zero.is_zeroN)getattrr!s r _iszeror/:s 1i &&rct|dk(S)zNTests by expand_mul only, suitable for polynomials and rational functions.rrr!s r _is_zero_after_expand_mulr1?s a=A rcddlm}||S)z$ Wrapper to avoid circular imports. r)simplify)rr3)rr3s r _simplifyr4Es0 D>r)F)FN) contextlibr threadingrsympy.core.functionrrrrrr(r+r/r1r4rrr r8sb%*u&'''( $/ *E'  r