K i8dZddlmZddlmZmZGddZy)a( Module for the DomainScalar class. A DomainScalar represents an element which is in a particular Domain. The idea is that the DomainScalar class provides the convenience routines for unifying elements with different domains. It assists in Scalar Multiplication and getitem for DomainMatrix. )construct_domain)DomainZZceZdZdZdZefdZdZedZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZdZxZS) DomainScalarz docstring ct|ts td|j|std|d||j ||S)Nzdomain should be of type Domainzelement z should be in domain ) isinstancer TypeErrorof_typenew)clselementdomains g/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/polys/matrices/domainscalar.py__new__zDomainScalar.__new__sE&&)=> >~~g&7FST Twww''cBt||}||_||_|SN)superrrr)rrrobj __class__s rr zDomainScalar.news$goc"   rc,t|jSr)reprrselfs r__repr__zDomainScalar.__repr__$DLL!!rcHt|g\}\}|j||Sr)rr )rexprrrs r from_sympyzDomainScalar.from_sympy's&.v6'www''rcL|jj|jSr)rto_sympyrrs rr#zDomainScalar.to_sympy,s{{##DLL11rcr|j|j|j}|j||Sr) convert_fromrrr )rrrs r to_domainzDomainScalar.to_domain/s-%%dllDKK@xx((rc$|j|Sr)r&)rrs r convert_tozDomainScalar.convert_to3s~~f%%rc|jj|j}|j||j|fSr)runifyr&)rotherrs rr*zDomainScalar.unify6s7""5<<0~~f%uv'>>>rc,t|jSr)boolrrs r__bool__zDomainScalar.__bool__:rrct|tstS|j|\}}|j |j |j z|j Srr rNotImplementedr*r rrrr+s r__add__zDomainScalar.__add__=F%.! !jj' exx u}}4dkkBBrct|tstS|j|\}}|j |j |j z |j Srr0r2s r__sub__zDomainScalar.__sub__Cr4rct|ts0t|trtt|t}ntS|j |\}}|j |j|jz|jSr) r rintrr1r*r rrr2s r__mul__zDomainScalar.__mul__Is`%.%%$RY3%%jj' exx u}}4dkkBBrct|tstS|j|\}}|j |j j |j|j|j Sr)r rr1r*r rquorr2s r __floordiv__zDomainScalar.__floordiv__SP%.! !jj' exx  emmDdkkRRrct|tstS|j|\}}|j |j j |j|j|j Sr)r rr1r*r rremrr2s r__mod__zDomainScalar.__mod__Yr=rc,t|tstS|j|\}}|jj |j |j \}}|j||j|j||jfSr)r rr1r*rdivrr )rr+qrs r __divmod__zDomainScalar.__divmod___sm%.! !jj' e{{t||U]];1DKK($((1dkk*BCCrct|tstS|j|j|z|j Sr)r r8r1r rr)rns r__pow__zDomainScalar.__pow__fs/!S!! !xx a55rcP|j|j|jSrr rrrs r__pos__zDomainScalar.__pos__kxx t{{33rcP|j|j |jSrrJrs r__neg__zDomainScalar.__neg__nrLrct|tstS|j|jk(xr|j|jk(Sr)r rr1rrr2s r__eq__zDomainScalar.__eq__qs7%.! !||u}},L 1LLrcH|j|jjk(Sr)rrzerors ris_zerozDomainScalar.is_zerovs||t{{////rcH|j|jjk(Sr)rroners ris_onezDomainScalar.is_oneys||t{{..r)__name__ __module__ __qualname____doc__r classmethodr rr!r#r&r(r*r.r3r6r9r<r@rErHrKrNrPrSrV __classcell__)rs@rrrs( "((2)&?"C C CS S D6 44M 0/rrN)rZ constructorrsympy.polys.domainsrrrrrr`s +*i/i/r