+
    i%                     8   ^ RI Ht ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
HtHtHt ^ RIHtHt ^ RIHt ^ R	IHt ^ R
IHt ^ RIHtHtHtHt ^ RIHt ^ RIHt ^ RI H!t! ^ RI"H#t# ^ RI$H%t% ^ RI&H't' ^ RI(H)t) R t*R t+R t,R t-R t.R t/R t0R t1R t2R t3R t4R# )    )Rational)S)symbols)log)import_module)Densityentropyfidelity)Ket
TimeDepKet)Qubit)	represent)Dagger)XKetPxKetPxOpXOp)JzKet)OuterProduct)Tr)sqrt)raises)scipy_sparse_matrix)TensorProductc            
      &   \        \        \        ^ 4      R.\        ^4      R.4      \        4      '       g   Q h\        \        \        R4      ^\	        ^4      ,          .\        R4      ^\	        ^4      ,          .4      \        4      '       g   Q h\        \        R4      ^\	        ^4      ,          .\        R4      ^\	        ^4      ,          .4      p V P
                   F  w  r\        V\        4      '       d   K  Q h	  \        \        R 4       R# )r         ?0011c                  B    \        \        ^ 4      .\        ^4      .4      # )r   )r   r        f/var/www/html/photoedit/myenv/lib/python3.14/site-packages/sympy/physics/quantum/tests/test_density.py<lambda> test_eval_args.<locals>.<lambda>!   s    wAx#a&:r!   N)
isinstancer   r   r   r   argsr   
ValueError)dstateprobs      r"   test_eval_argsr+      s    gs1vsmc!fc];WEEEEguT{Ad1gI6$T{Ad1gI689@B B B B 	taQi(5;$q'	*BCA%''''   ::;r!   c                     \        R 4      w  r\        RRR7      w  r#rErg\        \        4       R.\        4       R.4      pR\        4       \	        \        4       4      ,          ,          R\        4       \	        \        4       4      ,          ,          ,           VP                  4       8X  g   Q h\        \        W,          4      R.\        W,          4      R.4      p	R\        W,          4      \	        \        W,          4      4      ,          ,          R\        W,          4      \	        \        W,          4      4      ,          ,          ,           V	P                  4       8X  g   Q h\        W#,           V,          R.4      pVP                  4       RV,          V,          \	        V4      ,          \	        V4      ,          RV,          V,          \	        V4      ,          \	        V4      ,          ,           RV,          V,          \	        V4      ,          \	        V4      ,          ,           RV,          V,          \	        V4      ,          \	        V4      ,          ,           8X  g   Q h\        W#V4      p
\        V
R.4      pVP                  4       R\        V\	        V4      ,          V\	        V4      ,          V\	        V4      ,          4      ,          8X  g   Q h\        W#4      p\        WE4      p\        VR.VR.4      pVP                  4       R\        V\	        V4      ,          V\	        V4      ,          4      ,          R\        V\	        V4      ,          V\	        V4      ,          4      ,          ,           8X  g   Q h\        W,           R.4      pVP                  4       R\        V\	        V4      ,          V\	        V4      ,          4      ,          R\        V\	        V4      ,          V\	        V4      ,          4      ,          ,           R\        V\	        V4      ,          V\	        V4      ,          4      ,          ,           R\        V\	        V4      ,          V\	        V4      ,          4      ,          ,           8X  g   Q h\        \        ^^4      \        ^R4      4      p\        V^.4      p\        V4      p
V
P                  4       ^8X  g   Q h\        V^ .4      p
V
P                  4       \        ^R4      \	        \        ^R4      4      ,          8X  g   Q h\        V^.4      p
V
P                  4       \        ^^4      \	        \        ^^4      4      ,          8X  g   Q h\        \        \        P                  \        P                  4      \        \        P                  \        R^4      4      4      p\        V^.4      p\        V4      p
V
P                  4       ^8X  g   Q h\        V^ .4      p
V
P                  4       \        \        P                  \        R^4      4      \	        \        \        P                  \        R^4      4      4      ,          8X  g   Q h\        V^.4      p
V
P                  4       \        \        P                  \        P                  4      \	        \        \        P                  \        P                  4      4      ,          8X  g   Q hR# )x yzA B C D E FF)commutativer         ?N)r   r   r   r   r   doitr   r   r   r   Halfr   )xyABCDEFr(   
d_with_symtt2t3tp1tp2s                  r"   	test_doitrA   $   s   5>DA}%@A!~.A()tv&'(,-FFH5 5 5 $qs)S)E!#J+<=JqsF5:../ac6$qs),,-.2<//2CD D D 	!%C !A668Aaq	)&)3Aaq	)&)34Aaq	)&)34 Aaq	)&)34 5 5 5 	aAACA668mAfQiK6!9aq	kBBC C C 
q	B	q	BS	B9%A668mAfQiK6!9EEmAfQiK6!9EEF G G G 	#A668mAfQiK6!9EEmAfQiK6!9EEFmAfQiK6!9EEF mAfQiK6!9EEF G G G aU1b\
2CaA 	1A668q== 	1qc
A668uQ|fU1b\&:::::
1qc
A668uQ{VE!QK%88888 affaff-uQVVXb!_/M
NCaA 	1A668q== 	1qc
A668uQVVXb!_5uQVVXVXZ[_?]8^^^^^
1qc
A668uQVVQVV,veAFFAFF6K/LLLLLr!   c                     \        \        ^ 4      R.\        ^4      R.4      p V P                  \        4       4      \        \        4       \        ^ 4      ,          R.\        4       \        ^4      ,          R.4      8X  g   Q hR# r   r   N)r   r   apply_opr   )r(   s    r"   test_apply_oprE   j   se    QA}-A::ces1vs(;),s1vs(;!= = = =r!   c                     \        R 4      w  r\        \        4       R.\        4       R.4      p\	        R\        4       \        \        4       4      ,          ,          4      \	        R\        4       \        \        4       4      ,          ,          4      ,           \	        V4      8X  g   Q h\        \        W,          4      R.\        W,          4      R.4      p\	        R\        W,          4      \        \        W,          4      4      ,          ,          4      \	        R\        W,          4      \        \        W,          4      4      ,          ,          4      ,           \	        V4      8X  g   Q h\	        R\        4       \        \        4       4      ,          ,          \        4       R7      \	        R\        4       \        \        4       4      ,          ,          \        4       R7      ,           \	        V\        4       R7      8X  g   Q hR# )r-   r   )basisN)r   r   r   r   r   r   r   )r3   r4   r(   r;   s       r"   test_representrH   p   s\   5>DA~.Ac576%'?234c46&.01237@|D D D $qs)S)E!#J+<=Jc5:fU13Z&889:c49VDI%66789*  
 c46&.01@c576%'?2346BC!46"# # #r!   c                      \        \        ^ 4      R.\        ^4      R.4      p V P                  4       pV^ ,          \        ^ 4      8X  d   V^,          \        ^4      8X  g   Q hR# rC   )r   r   states)r(   rJ   s     r"   test_statesrK      sQ    QA}-AXXZF!9A6!9A#666#6r!   c                  `   \        \        ^ 4      R.\        ^4      R.4      p V P                  4       pV^ ,          R8X  d   V^,          R8X  g   Q h\        R4      w  r#\        \        ^ 4      V.\        ^4      V.4      p V P                  4       pV^ ,          V8X  d   V^,          V8X  g   Q hR# )r         ?      ?r-   N)r   r   probsr   )r(   rO   r3   r4   s       r"   
test_probsrP      s    QA~.AGGIE8taD 000 5>DAQc!fa[)AGGIE8q=U1X]**]r!   c                     \        R 4      w  r\        \        ^ 4      V .\        ^4      V.4      pVP                  ^ 4      VP                  ^4      3pV^ ,          \        ^ 4      8X  d   V^,          \        ^4      8X  g   Q hR# r-   N)r   r   r   	get_state)r3   r4   r(   rJ   s       r"   test_get_staterT      sk    5>DAQc!fa[)Akk!nakk!n-F!9A6!9A#666#6r!   c                      \        R 4      w  r\        \        ^ 4      V .\        ^4      V.4      pVP                  ^ 4      VP                  ^4      3pV^ ,          V 8X  d   V^,          V8X  g   Q hR# rR   )r   r   r   get_prob)r3   r4   r(   rO   s       r"   test_get_probrW      s`    5>DAQc!fa[)AZZ]AJJqM*E8q=U1X]**]r!   c                  \   \        \        P                  \        P                  4      p \        \        P                  \        R^4      4      p\	        V \        P                  3V\        P                  34      p\        V4      p\        V4      \        ^4      ^,          8X  g   Q hVP                  4       \        ^4      ^,          8X  g   Q h\        RRR7      pV'       d\   \        VRR7      p\        V4      p\        WTP                  4      '       g   Q hVP                  R8X  g   Q hVP                  ^ 8X  g   Q h\        RRR./R	7      pV'       dX   V'       dN   \        VR
R7      p\        V\        4      '       g   Q hVP                  R8X  g   Q hVP                  ^ 8X  g   Q hR# R# R# )   numpyz1.4.0)min_module_version)formatg9B.?scipyfromlistsparse)import_kwargszscipy.sparseNr0   )r   r   r2   r   r   r	   r   r   r   r%   ndarrayrealimagr   )updownr(   entnpnp_matr]   mats           r"   test_entropyrj      sG   	qvvqvv	B"a)DQVVtQVVn-A !*C1:Q!!!99;#a&("""	w7	;B	1W-fo&**----xx....xx1}}'*xj1IJE.1#23333xx....xx1}} ur!   c                  f   \        \        P                  \        P                  4      p \        \        P                  \        R^4      4      p\	        V R3VR34      p\        V4      pVP                  4       R8X  g   Q h ! R R\        4      p\        R4      w  rSV! ^ R4      pV! ^ ^4      p\	        VR.VR.4      pVP                  4       R\        WfP                  4      ,          R\        WwP                  4      ,          ,           8X  g   Q h\        V4      pVP                  4       R8X  g   Q hR# )rY   r   r/   c                   &   a  ] tR t^t o R tRtV tR# )'test_eval_trace.<locals>.TestTimeDepKetc                    ^# )rY   r    )selfbraoptionss   &&,r"   _eval_trace3test_eval_trace.<locals>.TestTimeDepKet._eval_trace   s    r!   r    N)__name__
__module____qualname____firstlineno__rr   __static_attributes____classdictcell__)__classdict__s   @r"   TestTimeDepKetrm      s     	 	r!   r{   zx tNr0   )r   r   r2   r   r   r   r1   r   r   r   dual)rd   re   r(   r<   r{   r3   k1k2s           r"   test_eval_tracer      s    	qvvqvv	B"a)DS	D#;'A
1A668s??  5>DA	3	B	1	BS	B9%A668l2ww77l2ww778 9 9 9 	1A668s??r!   c                    aaaa \        \        P                  \        P                  4      p \        \        P                  \        R^4      4      p\        P                  \        ^4      ,          V ,          \        P                  \        ^4      ,          V,          ,           p\        V \        V 4      ,          4      p\        V\        V4      ,          4      p\        V\        V4      ,          4      p\        \        W34      ^,
          4      R8  g   Q h\        W44      R8  g   Q h\        \        W54      \        P                  \        ^4      ,          ,
          4      R8  g   Q h\        \        WT4      \        P                  \        ^4      ,          ,
          4      R8  g   Q h\        V R.4      p\        VR.4      p\        VR.4      p\        \        W34      ^,
          4      R8  g   Q h\        \        W44      4      R8  g   Q h\        \        W54      \        P                  \        ^4      ,          ,
          4      R8  g   Q h\        \        WT4      \        P                  \        ^4      ,          ,
          4      R8  g   Q h\        ^4      ^,          V ,          \        P                  V,          ,           p\        VR.VR.4      p\        VR.VR.4      p\        \        Wx4      R,
          4      R8  g   Q h\        \        W4      \        Wx4      ,
          4      R8  g   Q h\        R4      p	\        R4      p
\        P                  \        ^4      ,          V	,          \        P                  \        ^4      ,          V
,          ,           p\        \        ^^4      4      V	,          \        P                  \        ^4      ,          V
,          ,           p\        V	^.4      p\        V
^.4      p\        V^.4      p\        W4      ^8X  g   Q h\        W4      ^ 8X  g   Q h\        \        W4      ^\        ^4      ,          ,
          4      R8  g   Q h\        \        W4      ^\        ^4      ,          ,
          4      R8  g   Q h\        VR.VR	.4      p\        VR
.VR.4      p\        \        Ww4      ^,
          4      R8  g   Q h\        \        Wx4      R,
          4      R8  g   Q h\        \        Wx4      \        W4      ,
          4      R8  g   Q h^ ^ .^ ^ .^ ^ ..o^ ^ .^ ^ ..o\        \        VV3R l4       ^ ^ .^ ^ ..o. RO. RO. RO.o\        \        VV3R l4       ^^uoo\        \        VV3R l4       R# )rY   gMbP?r/   rN   rM   gʡE?01gffffff?g333333?g?g?gZd;?c                     < \        S S4      # Nr
   mat1mat2s   r"   r#   test_fidelity.<locals>.<lambda>      xd3r!   c                     < \        S S4      # r   r   r   s   r"   r#   r     r   r!   c                     < \        S S4      # r   r   )r3   r4   s   r"   r#   r   !  s    x1~r!   Nr0   )r   r   r   )r   r   r2   r   Oner   r   r   absr
   r   r   r   r'   )rd   re   updownup_dmdown_dm	updown_dmupdown2d1d2state1state2state3state4	state1_dm	state2_dm	state3_dmr   r   r3   r4   s                   @@@@r"   test_fidelityr      sf   	qvvqvv	B"a)DeeDGmR155a=$"66F b6":o&Evd|+,G&6&>12Ix%)*T111E#d***x)QUU47];<tCCCx	+quuT!W}=>EEE RIEtSk"G&Ix%)*T111x'(4///x)QUU47];<tCCCx	+quuT!W}=>EEE 1gailQVVD[(G	&$'4	1B	&$'4	1Bx%'(4///x(2"223d::: 3ZF3ZFUU47]6!AEE$q'M&$88F(1a.!&(155a=+??F$I$I$II)Q...I)Q...x	-$q'	9:TAAAx	-$q'	9:TAAA 
&$&$	0B	&$&$	0Bx!#$t+++x%'(4///x(2"223d::: FFFD FFD
:34 FFDD :34 aDAq
:-.r!   N)5sympy.core.numbersr   sympy.core.singletonr   sympy.core.symbolr   &sympy.functions.elementary.exponentialr   sympy.externalr   sympy.physics.quantum.densityr   r	   r
   sympy.physics.quantum.stater   r   sympy.physics.quantum.qubitr   sympy.physics.quantum.representr   sympy.physics.quantum.daggerr   sympy.physics.quantum.cartesianr   r   r   r   sympy.physics.quantum.spinr   sympy.physics.quantum.operatorr   sympy.physics.quantum.tracer   sympy.functionsr   sympy.testing.pytestr   !sympy.physics.quantum.matrixutilsr   #sympy.physics.quantum.tensorproductr   r+   rA   rE   rH   rK   rP   rT   rW   rj   r   r   r    r!   r"   <module>r      s|    ' " % 6 ( D D 7 - 5 / B B , 7 *   ' A =<CML=#$7	+7+80K/r!   