+
    nDjK                        ^ RI t^ RIt^ RIt^ RIt^ RIHtHtH	t	H
t
 ^ RIHtHtHt ^ RIHtHtHt ^ RIHt . ROtRR.t]P.                  P1                  RR	R
7      R 4       t]P.                  P5                  R4      ]P.                  P5                  R4      ]P.                  P5                  R4      ]! ]4       ! R R4      4       4       4       4       t]! ]4       ! R R4      4       t]! ]4       ! R R4      4       tR# )    N)is_array_api_strictmake_xp_test_casexp_default_dtype	xp_device)xp_assert_equalxp_assert_closexp_assert_less)log_softmax	logsumexpsoftmax)_wrap_radiansint32int64Fprivatereasonc                    V P                  \        P                  ) ^,
          \        P                  ) RR^ R^\        P                  \        P                  ^,           .	4      pV P                  \        P                  ^,
          \        P                  RR^ R^\        P                  \        P                  ) ^,           .	4      p\        WR7      p\	        W2^ R7       R# )   gYn)xp)atolNgYn)asarraymathpir   r   )r   xrefress   &   \/data/cameron/venvs/s3viz/lib/python3.14/site-packages/scipy/special/tests/test_logsumexp.pytest_wrap_radiansr      s    


TWWHQJ"gvq$''477196 	7A
**dggai"gvq$''DGG8A:7 8C

!CC1%    z/ignore:invalid value encountered:RuntimeWarningz0ignore:divide by zero encountered:RuntimeWarningz*ignore:overflow encountered:RuntimeWarningc                     a  ] tR t^!t o R tR tR tR tR tR t	R t
R tR	 t]P                  P                  R
^. R)O34      R 4       tR t]P                  P                  R]4      R 4       t]P                  P                  R]4      ]P                  P                  R]4      R 4       4       tR t]P                  P                  RRR.4      R 4       tR t]P                  P                  R]! ]P4                  ! ]P8                  ) ]P8                  ]! ]P8                  ) R4      ]! ]P8                  ) R*4      ]! ]P8                  ) ]P8                  4      ]! ]P8                  ) ]P8                  ) 4      ]! ]P8                  R4      ]! ]P8                  R*4      ]! ]P8                  ]P8                  4      ]! ]P8                  ]P8                  ) 4      ]! ]P8                  ) R4      ]! ]P8                  ) R4      ]! ]P8                  ) R4      ]! ]P8                  ) R4      ]! ]P8                  R4      ]! ]P8                  R4      ]! ]P8                  R4      ]! ]P8                  R4      .^R7      4      4      R 4       tR t]P                  P                  R R!R". .4      R# 4       t R$ t!]P                  P                  R%]P8                  .R&R!3]P8                  .R+.R+3.4      R' 4       t"R(t#V t$R&# ),TestLogSumExpc           	     d   VP                  . 4      pVP                  VP                  ) 4      p\        \        V4      V4       VP	                  R VP
                  R7      pVP                  VP                  VP                  V4      4      4      p\        \        V4      V4       VP                  RR.4      pVP                  R\        P                  ! R4      ,           4      p\        \        V4      V4       RpVP                  V3R4      pVP                  R\        P                  ! V4      ,           4      p\        \        V4      V4       VP                  R.R,          4      pVP                  V4      pVP                  Wf.4      pVP                  Ww.4      p	\        VP                  \        V	4      4      VP                  V4      4       \        VP                  \        V	^ R	7      4      VP                  V^ R	7      4       \        VP                  \        V	^R	7      4      VP                  V^R	7      4       VP                  VP                  .4      p
VP                  VP                  .4      p\        \        V
4      V
^ ,          4       \        \        V
) 4      V
^ ,          ) 4       \        \        V4      V^ ,          4       \        \        VP                  VP                  ) VP                  ) .4      4      V
^ ,          ) 4       VP                  R
R.R\        P                  ) ..4      pVP                  R
R.4      p\        \        VRR	7      V4       VP                  VRR	7      p\        \        VRRR7      V4       \        \        VRR	7      VP                  R
4      4       R# )      i@dtype     @@       @  '  g     @Ww'&l7i@B axisg    _Bg|=T)r-   keepdimsNg    _r   )r   )r   infr   r   arangefloat64logsumexpr   r   fullstacknannpexpand_dims)selfr   adesiredbnr   logxXlogXr0   r8   r   s   &&           r   test_logsumexpTestLogSumExp.test_logsumexp&   s   JJrN**bffW%	!g. IId"**I-&&q	*+	!g. JJu~&**Vdhhsm34	!g.GGQD% **Wtxx{23	!g.JJw()vvayHHaVxx%y/;yA679JKyA679JK jj"&&"jj"&&"	#A/	3$#a&1	#A/	"**rvvgw-?"@ACF7K JJu(* +jj$'	!"-s3 nnSrn*	!"t<cB 		!(3RZZ5EFr    c           
        VP                  R VP                  R7      pVP                  R RR4      pVP                  VP                  W1P	                  V4      ,          4      4      p\        \        W#R7      V4       VP                  RR.4      pVP                  RR.4      pVP                  R\        P                  ! R4      ,           4      p\        \        W#R7      V4       VP                  R.R,          4      pVP                  ^RR4      pVP                  V4      pVP                  WU34      pVP                  Wf34      pVP                  W334      p	\        VP	                  \        WR7      4      VP                  W,          4      4       \        VP	                  \        W^ R7      4      VP                  W,          ^ R	7      4       \        VP	                  \        W^R7      4      VP                  W,          ^R	7      4       R
# )r$   r%           r>   r)   g333333?r+   i )r>   r-   r,   N      g333333@)r1   r2   r3   r4   r5   r   r   r   r   linspacer7   )
r;   r   r<   r>   r=   r   r@   rA   rB   Bs
   &&        r   test_logsumexp_bTestLogSumExp.test_logsumexp_bX   s   IId"**I-IIdB$&&&&),-	!)73JJd|$JJSz"**TDHHW$556	!)73JJw'(KK4(vvayHHaVxx%HHaVy34bffQUmDy;<bffQUQRf>STy;<bffQUQRf>STr    c                    VP                  . RO4      pVP                  . RO4      p\        W#RR7      w  rE\        WAP                  R4      4       \        WQP                  R4      4       R# )r   Tr>   return_sign      ?N)r   r   r   )r   r   r   rH   )r   r   r   r   r;   r   r<   r>   rss   &&    r   test_logsumexp_sign!TestLogSumExp.test_logsumexp_signm   sL    JJy!JJ{#T2::b>*::c?+r    c                    VP                  ^^.4      pVP                  ^R.4      p\        W#RR7      w  rEVP                  V4      '       d   Q hVP                  V4      '       d   Q hV^ 8  g   Q hV^ 8X  g   Q hR# )r   TrN   Nr   )r   r   isfiniteisnanrQ   s   &&    r   test_logsumexp_sign_zero&TestLogSumExp.test_logsumexp_sign_zerou   so    JJ1vJJ2wT2;;q>>!!88A;;1uuAvvr    c                .   VP                  R4      pVP                  V4      p\        V^VRR7      w  rEVP                  VP                  u;8X  d	   R8X  g   Q h Q h\        VRVRR7      w  rEVP                  VP                  u;8X  d	   R8X  g   Q h Q hR# )r   T)r-   r>   rO   Nr            r   r]   r_   r   r^   ones	ones_liker   shaperQ   s   &&    r   test_logsumexp_sign_shape'TestLogSumExp.test_logsumexp_sign_shape   s    GGL!LLOaT:ww!''.Y.....1$?ww!''*U*****r    c                   VP                  . RO4      p\        VRR7      w  r4VP                  VP                  V4      4      pWQP	                  V4      ,          p\        WF4       \        WAP                  V4      ,          V4       R# )r   T)rO   N)y      ?      ?y       @      y             @)r   r   r4   r5   absr   )r;   r   r<   rR   rS   expected_sumexpexpected_signs   &&     r   test_logsumexp_complex_sign)TestLogSumExp.test_logsumexp_complex_sign   sb    JJ01-&&+'&&*AA)FF1I7r    c                    VP                  R4      pVP                  V4      p\        V^VR7      pVP                  R8X  g   Q h\        VRVR7      pVP                  R8X  g   Q hR# )r   )r-   r>   Nr\   r`   ra   rb   )r;   r   r<   r>   rR   s   &&   r   test_logsumexp_shape"TestLogSumExp.test_logsumexp_shape   s]    GGL!LLOaa1%ww)###af*ww&   r    c                    VP                  ^R.4      pVP                  ^^ .4      p\        \        W#R7      VP                  R4      4       R# )r   r*   rG   rP   N)r   r   r   r;   r   r<   r>   s   &&  r   test_logsumexp_b_zero#TestLogSumExp.test_logsumexp_b_zero   s=    JJ5z"JJ1v	!)2::b>:r    c                b    VP                  R4      pVP                  R4      p\        W#R7       R# )r_   rG   N)r_   r   r]   r   )r^   r      )zerosrc   r   rr   s   &&  r   test_logsumexp_b_shape$TestLogSumExp.test_logsumexp_b_shape   s&    HH\"GGI!r    argc                    \        V4      \        \        P                  ! \        P                  ! V4      4      4      8X  g   Q hR # N)r   r9   r   
atleast_1d)r;   rz   s   &&r   test_xp_invalid_input#TestLogSumExp.test_xp_invalid_input   s+    ~2::bmmC6H+I!JJJJr    c                    R R .p\         P                  ! R\        P                  ! R4      ,           4      p\	        \        V4      V4       R# )r)   r'   r(   N)r9   r   r   r3   r   r   )r;   r<   r=   s   &  r   test_array_likeTestLogSumExp.test_array_like   s4    4L**Vdhhsm34	!g.r    r&   c                6   \        W!4      pVP                  R R .VR7      pVP                  VR4      '       d   VP                  R4      P                  MTpVP                  R \        P
                  ! R4      ,           VR7      p\        \        V4      V4       R# )r'   r%   integralrP   r(   N)getattrr   isdtyper&   r   r3   r   r   )r;   r&   r   r<   desired_dtyper=   s   &&&   r   test_dtypes_aTestLogSumExp.test_dtypes_a   sx    "JJu~UJ313E:1N1NB--# 	**Vdhhsm3=*I	!g.r    dtype_adtype_bc                   \        W14      p\        W24      pVP                  ^^.VR7      pVP                  ^R.VR7      p\        V4      '       dx   WE3 Uu. uF  pVP                  VR4      '       d   K  VNK!  	  p	p\	        V	4      ^8  d+   V	P                  VP                  R4      P                  4       VP                  ! V	!  p
M4VP                  WE4      p
VP                  V
R4      '       d   \        V4      p
VP                  \        P                  ! \        P                  ! ^4      \        P                  ! ^4      ,
          4      V
R7      p\        \        WgR7      V4       R# u upi )r]   r%   r   rP   rG   Nr   )r   r   r   r   lenappendr&   result_typer   r   r3   r5   r   r   )r;   r   r   r   
xp_dtype_a
xp_dtype_br<   r>   r&   xp_float_dtypesr   r=   s   &&&&        r   test_dtypes_abTestLogSumExp.test_dtypes_ab   s(    R)
R)
JJ1vZJ0JJ2wjJ1r"" 4>2J E2J&(jj
&C  %u2JO E?#a'&&rzz"~';';<NNO<MNN:BMzz-44/3}**TXXdhhqkDHHQK&?@*V	!)73Es   E+6E+c                    VP                  R R.4      p\        V4      pVP                  V^ ,          V^,          4      p\        W44       R# )rF   Ng      D)r   r   	logaddexpr   )r;   r   r<   r   r   s   &&   r   test_gh18295TestLogSumExp.test_gh18295   s?     JJU|$lll1Q41&!r    	complex64
complex128c                n   \         P                  P                  R 4      p\        W4      pRpVP	                  ^^(V4      RVP	                  ^^(V4      ,          ,           pVP                  WRR7      p\        V^R7      pVP                  VP                  VP                  V4      ^R7      4      pVP                  VP                  V4      VP                  4      p\        VP                  VP                  V4      4      V4       \        Wg4       \        VR^R7      w  rVP                  VP                  V4      ^R7      p\        VP                  VP                  V
4      4      V4       \        WP!                  VP                  V4      4      4       \        WVP                  V4      ,          4       R# )l   &DN$              ?r%   r,   T)rO   r-   N)
   d   )r9   randomdefault_rngr   uniformr   r   r3   r4   r5   	full_likeimagr   r	   ri   r   real)r;   r   r&   rngre   r   r   r   maxoutsgns   &&&        r   test_gh21610TestLogSumExp.test_gh21610   sA    ii##$67"KK2u%ckk!R.G(GGJJqJ&"ffRVVBFF1IAV./ll2773</rvvbggcl+S1!QDq9ffRVVAYQf'rvvbggcl+S1WWRVVC[12_-r    c                   VP                  ^ R.4      p\        V4      pVP                  R4      p\        VP                  V4      VP                  V4      4       \        VP	                  V4      VP	                  V4      ^ RR7       R# )r   y        y<gV瞯<)r   rtolNy9B.?i<)r   r   r   r   r   )r;   r   r   r   r   s   &&   r   test_gh21709_small_imaginary*TestLogSumExp.test_gh21709_small_imaginary   sj     JJ567l
 jjCDbggcl3bggclGr    zx,yrF   g%u?g}b@g"~j@gH@)repeatc           
         \        VP                  W.4      4      pVP                  VP                  VP	                  VP                  W.4      4      4      4      p\        WE4       R # r|   )r   r   r3   r4   r5   r   )r;   r   yr   r   r   s   &&&&  r   test_gh22601_infinite_elements,TestLogSumExp.test_gh22601_infinite_elements  sL    4 

A6*+ffRVVBFF2::qf#5678!r    c                    VP                  RR.4      pVP                  RR.4      p\        V4       \        W#R7       \        W!P                  RR.4      4       \        W1P                  RR.4      4       R# )zFTest that logsumexp doesn't accidentally write back to its parameters.g      @g      @g      @r(   rG   N)r   r   r   rr   s   &&  r   test_no_writebackTestLogSumExp.test_no_writeback   s_    JJBx JJBx !!::r2h/0::r2h/0r    x_rawrP   r   c                    V F^  pVP                  WR7      p\        \        V4      4      \        V4      8X  g   Q h\        \        WUR7      4      \        V4      8X  d   K^  Q h	  R# )z(Test input device propagation to output.)devicerG   N)r   r   r   )r;   r   r   devicesdr   s   &&&&  r   test_deviceTestLogSumExp.test_device)  sU     A

5
+AYq\*il:::Yq./9Q<??? r    c           	     &   VP                  . RO4      pVP                  . RO4      p\        \        W#R7      \        W#RR7      ^ ,          4       VP                  . RO4      p\        \        W#R7      VP                  VP                  4      4       R# )rC@rG   TrN   N)r   g X?g	ml@)_+J?eY@g|H4)r   r   gR%)r   r   r   r8   rr   s   &&  r   test_gh22903TestLogSumExp.test_gh229031  sj     JJ;<JJ<=	!)9Q+Nq+QR JJ<=	!)2::bff+=>r    za, b, sign_refNc                    VP                  V4      Ve   VP                  V4      MR r2\        W#RR7      w  rVVP                  V4      '       g   Q h\        WaP                  V4      4       R # )NTrN   )r   r   isinfr   )r;   r   r<   r>   sign_refvalsigns   &&&&&  r   test_gh23548TestLogSumExp.test_gh23548?  sR     zz!}q}bjjm$1a$7	xx}}}jj23r     )r   r]   r^   g       rH   )%__name__
__module____qualname____firstlineno__rC   rK   rT   rY   rf   rl   ro   rs   rx   pytestmarkparametrizer~   r   dtypesr   r   r   r   r   listitproductr9   r0   complexr   r   r   r   r   __static_attributes____classdictcell____classdict__s   @r   r"   r"   !   s    
0GdU*,+
8!; [[UQ	N3K 4K/
 [[Wf-/ ./ [[Y/[[Y/4 0 04(" [[W{L&AB. C.0H [[UDVVGFFRVVGR RVVGS!RVVGRVV$RVVGbffW%BFFBBFFC BFFBFF#BFFRVVG$RVVGV$RVVGV$RVVGV$RVVGV$BFFF#BFFF#BFFF#BFFF#'	
( +* % ."/."1 [[WsD"o6@ 7@? [[- "xr2 "x#467474r    r"   c                   ~   a  ] tR tRt o R tR t]P                  P                  RRR7      R 4       t	R t
R	 tR
tV tR# )TestSoftmaxiK  c                    \        \        VP                  . RO4      4      VP                  . R	O4      RR7       \        \        VP                  RR.4      4      VP                  RR.4      RR7       \        \        VP                  RR.4      4      VP                  R\        P                  .4      ^\        P                  ,           ,          RR7       VP                  ^VP                  R7      pVP                  . R
OVP                  R7      p\        \        V4      VRR7       \        \        V^d,           4      VRR7       \        \        VP                  VR4      4      VP                  VR4      RR7       R# )r'   rF   rP   vIh%<=r         ?r%   N)r'   rF   rF   rF   rP   rF   rF   rF   )g*lI9i?g{O?gW-R?gI?r]   r]   )r   r   r   r9   er1   r2   reshape)r;   r   r   expecteds   &&  r   test_softmax_fixtures!TestSoftmax.test_softmax_fixturesM  s)   

+> ?@

#345	B

B8 45

B8,5	:

B8 45

B:.BDD9"	$ IIarzzI*:: 3 ;=**  F
 	
H59 	C((? 	

1f 56

8V45	Br    c           	     p   \        \        VP                  R R.R R..4      ^ R7      VP                  RR.RR..4      RR7       \        \        VP                  R R.R R..4      ^R7      VP                  RR.RR..4      RR7       VP                  . RO. R	O.4      pVP                  . R
O. RO.4      p\        \        V^R7      VRR7       \        \        VP                  ^ R7      VP                  RR7       VP	                  VR4      p\        \        VRR7      VP	                  VR4      RR7       R# )r'   rF   r,   r   r   r   rP   N)g      9rF   g      9@g      I@)rP   g     Pt@g     h@g     p@)g	+9g.K|T}%m;g]7=g\?)rF   gpk&gTV6?gd?r]   r]   r]   r   r]   )r   r   r   Tr   )r;   r   r   r   x3ds   &&   r   test_softmax_multi_axes#TestSoftmax.test_softmax_multi_axesi  s$   

UBK%+E FQO

RHr2h#78u	F

UBK%+E FQO

RHr2h#78u	F
 JJ002 3::  3 4	5 6 	*H5A!,hjjuE jjI&&1

8Y7e	Er    array_api_strictint->float promotionr   c                x    \        \        VP                  . RO4      4      VP                  . RO4      RR7       R# r)   r   r   N)r)   r   r   r   r   )r   r   r   r;   r   s   &&r   test_softmax_int_array"TestSoftmax.test_softmax_int_array  s*    

? ;<

#345	Br    c                \    \        \        R 4      \        P                  ! R4      RR7       R# )r)   rP   r   r   Nr   r   r9   r   r;   s   &r   test_softmax_scalarTestSoftmax.test_softmax_scalar  s    rzz"~EBr    c                d    \        \        . RO4      \        P                  ! . RO4      RR7       R# r   r   r   s   &r   test_softmax_array_like#TestSoftmax.test_softmax_array_like  s!    0

#345	Br    r   N)r   r   r   r   r   r   r   r   xfail_xp_backendsr   r   r   r   r   r   s   @r   r   r   K  sP     B8E4 [[""#5>T"UB VBCB Br    r   c                     a  ] tR tRt o R t]P                  P                  RRR7      R 4       tR t	R t
]R	 4       t]R
 4       t]P                  P                  R^ ^d.4      R 4       tR t]P                  P                  R^ ]P$                  ! R4      ]P&                  ! R4      ,          3^RR.RR..3.4      R 4       tR tR tR tRtV tR# )TestLogSoftmaxi  c                x    \        \        VP                  R R.4      4      VP                  RR.4      RR7       R# )r'   rP   rF   r   r   N     8r   r
   r   r   s   &&r   test_log_softmax_basic%TestLogSoftmax.test_log_softmax_basic  s0    BJJr{$;<

B;/e	=r    r   r   r   c                x    \        \        VP                  R ^.4      4      VP                  RR.4      RR7       R# r)   rF   r   r   Nr  r  r   s   &&r   test_log_softmax_int_array)TestLogSoftmax.test_log_softmax_int_array  s0    BJJay$9:

B;/e	=r    c                4    \        \        R 4      RRR7       R# )rP   rF   r   r   N)r   r
   r   s   &r   test_log_softmax_scalar&TestLogSoftmax.test_log_softmax_scalar  s    C(#E:r    c                d    \        \        R ^.4      \        P                  ! RR.4      RR7       R# r  )r   r
   r9   r   r   s   &r   test_log_softmax_array_like*TestLogSoftmax.test_log_softmax_array_like  s'    T1I.

B;/e	=r    c                ~    V P                  ^V P                  R7      p. ROpWP                  W P                  R7      3# )r_   r%   g:-g:-guZgi,ܿ)r1   r2   r   r   r   expects   &  r   data_1dTestLogSoftmax.data_1d  s9    IIarzzI*( **V::*666r    c                    V P                  V P                  ^V P                  R7      R4      p. RO. RO.pWP                  W P                  R7      3# )   r%   )r]   r_   r  )r   r1   r2   r   r  s   &  r   data_2dTestLogSoftmax.data_2d  sN    JJryy"**y5v>))	* **V::*666r    offsetc                j    V P                  V4      w  r4W1,          p\        \        V4      VR R7       R# )r   r   N)r  r   r
   )r;   r  r   r   r  s   &&&  r   test_log_softmax_translation+TestLogSoftmax.test_log_softmax_translation  s+     LL$		AU;r    c                    V P                  V4      w  r#VP                  VR4      pVP                  VR4      p\        \        V4      VRR7       R# )r]   r   r   Nr   )r  r   r   r
   r;   r   r   r  s   &&  r   test_log_softmax_noneaxis(TestLogSoftmax.test_log_softmax_noneaxis  sD     LL$	JJq&!FF+AU;r    zaxis_2d, expected_2dr   rF   c                    VP                  R R.R R..4      p\        \        WAR7      VP                  W$P                  R7      RR7       R# )r'   rP   r,   r%   r   r   N)r   r   r
   r&   )r;   axis_2dexpected_2dr   r   s   &&&& r   	test_axesTestLogSoftmax.test_axes  sC    
 JJeR[12A4

;gg
>U	Lr    c                ^    V P                  V4      w  r#\        \        V^R7      VRR7       R# )r   r,   r   r   N)r  r   r
   r   s   &&  r   test_log_softmax_2d_axis1(TestLogSoftmax.test_log_softmax_2d_axis1  s%    LL$	AA.UCr    c                    V P                  V4      w  r#\        \        VP                  ^ R7      VP                  RR7       R# )r   r,   r   r   N)r  r   r
   r   r   s   &&  r   test_log_softmax_2d_axis0(TestLogSoftmax.test_log_softmax_2d_axis0  s-    LL$	ACCa0&((Gr    c                    V P                  V4      w  r#VP                  VR4      pVP                  VR4      p\        \        VRR7      VRR7       R# )r]   r,   r   r   Nr   r   )r  r   r   r
   r   s   &&  r   test_log_softmax_3d"TestLogSoftmax.test_log_softmax_3d  sE    LL$	JJq)$FI.AF3V%Hr    r   Nr   r  )r   r   r   r   r  r   r   r   r	  r  r  staticmethodr  r  r   r  r!  r9   r3   rc   r&  r)  r,  r/  r   r   r   s   @r   r  r    s    = [[""#5>T"U= V=;= 7 7 7 7 [[X3x0< 1<< [[3	
BFF3K"''&/)*	
b%[2u+&'6 L	L
DHI Ir    r  )float32r2   r   r   r   r   )	itertoolsr   r   r   numpyr9   scipy._lib._array_apir   r   r   r   scipy._lib._array_api_no_0dr   r   r	   scipy.specialr
   r   r   scipy.special._logsumexpr   r   integral_dtypesr   uses_xp_capabilitiesr   filterwarningsr"   r   r  r   r    r   <module>r<     s"      @ @9 9 : 9 2 
MG$ !!%	!:& ;& MNNOHI9c4 c4  J P Oc4L	 7AB AB ABH ;PI PI  PIr    