K i ^dZddlmZmZddlmZdgZGddeZde_de_ y)zHermitian conjugation.)Exprsympify)adjointDaggerc(eZdZdZedZddZy)raGeneral Hermitian conjugate operation. Explanation =========== Take the Hermetian conjugate of an argument [1]_. For matrices this operation is equivalent to transpose and complex conjugate [2]_. Parameters ========== arg : Expr The SymPy expression that we want to take the dagger of. evaluate : bool Whether the resulting expression should be directly evaluated. Examples ======== Daggering various quantum objects: >>> from sympy.physics.quantum.dagger import Dagger >>> from sympy.physics.quantum.state import Ket, Bra >>> from sympy.physics.quantum.operator import Operator >>> Dagger(Ket('psi')) >> Dagger(Bra('phi')) |phi> >>> Dagger(Operator('A')) Dagger(A) Inner and outer products:: >>> from sympy.physics.quantum import InnerProduct, OuterProduct >>> Dagger(InnerProduct(Bra('a'), Ket('b'))) >>> Dagger(OuterProduct(Ket('a'), Bra('b'))) |b>>> A = Operator('A') >>> B = Operator('B') >>> Dagger(A*B) Dagger(B)*Dagger(A) >>> Dagger(A+B) Dagger(A) + Dagger(B) >>> Dagger(A**2) Dagger(A)**2 Dagger also seamlessly handles complex numbers and matrices:: >>> from sympy import Matrix, I >>> m = Matrix([[1,I],[2,I]]) >>> m Matrix([ [1, I], [2, I]]) >>> Dagger(m) Matrix([ [ 1, 2], [-I, -I]]) References ========== .. [1] https://en.wikipedia.org/wiki/Hermitian_adjoint .. [2] https://en.wikipedia.org/wiki/Hermitian_transpose c4|jdjS)zHFind the kind of a dagger of something (just the kind of the something).r)argskind)selfs b/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/physics/quantum/dagger.pyr z Dagger.kindRsyy|   ct|dr|r|jSt|dr,t|dr |r|jjSt j |t |S)Nr conjugate transpose)hasattrrrrr__new__r)clsargevaluates r rzDagger.__new__WsY 3 "x;;= S+ &73 +D==?,,. .||C..r N)T)__name__ __module__ __qualname____doc__propertyr rr r rr s"DL!!/r cDd|j|jdzS)Nz Dagger(%s)r)_printr )abs r r _s,!&&)1D"Dr N) r sympy.corerr$sympy.functions.elementary.complexesr__all__rr _sympyreprrr r r%s;$8   Q/WQ/fDr