+
    0iN                     ^   ^ RI t^ RIt^ RIHu Ht ^ RIH	t	 ^t
]P                  ! ]P                  ! ^4      ]
4      t]P                  ! ]P                  ! ^4      ]
) 4      t]P                  ! ^]P                   ,          4      t]P$                  ! ^]P                   ,          4      tRt]P                  ! ^4      t]P                   ^,          t]P                   ^,          t]P                   ^,          t. ROtR tR tRR ltRR ltR tRR ltRR	 lt RR
 lt!R t"R t#RR lt$R t%RR lt&R# )    N)_derivativec                     R V ,          p\         P                  ! V 4      ^,          V ,
          \        ^,          ,           V\         P                  ! \        W,          4      ,          ,           # )      ?)nplog_LOG_2PIpolyval_STIRLING_COEFFS)nrns   & R/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/stats/_ksstats.py_log_nfactorial_div_n_pow_nr   ]   sD     
QB66!9Q;?XaZ'"rzz:JBD/Q*QQQ    c                2    \         P                  ! V RR4      # )z%clips a probability to range 0<=p<=1.        r   )r   clip)ps   &r   
_clip_probr   g   s    771c3r   c                F    \         P                  ! W V4      p\        V4      # )z>Selects either the CDF or SF, and then clips to range 0<=p<=1.)r   wherer   )cdfprobsfprobcdfr   s   &&& r   _select_and_clip_probr   l   s    
v&Aa=r   c                P   VR8  d   \        RRV4      # W,          pVR8:  d   \        RRV4      # \        \        P                  ! V4      4      pWC,
          p^V,          ^,
          p\        P                  ! Wf.4      p\        P
                  ! ^V^,           4      pRWX,          ,
          p	\        P                  ! V4      p
RpV F1  pWV^,
          &   W,          pW^,
          ;;,          V,          uu&   K3  	  \        ^V,          R,
          ^ 4      V,          ^WV,          ,          ,
          pRV,           V,          V	R&   \        ^V4       F"  pV
RWn,
          ^,            W~^,
          R1V3&   K$  	  WR&   \        P                  ! V	^ R7      VR&   \        P                  ! \        P                  ! V4      ^ ,          4      pT p^ p^ pV^ 8  d   V^,          '       d    \        P                  ! W4      pVV,          p\        P                  ! Ww4      pV^,          p\        P                  ! Wt^,
          V^,
          3,          4      \        8  d   V\        ,          pV\        ,          pV^,          pK  W^,
          V^,
          3,          p\        ^V ^,           4       FN  pVV,          V ,          p\        P                  ! V4      \         8  g   K4  V\        ,          pV\        ,          pKP  	  V^ 8w  d   \        P"                  ! VV4      p\        VRV,
          V4      # )	zComputes the Kolmogorov CDF:  Pr(D_n <= d) using the MTW approach to
the Durbin matrix algorithm.

Durbin (1968); Marsaglia, Tsang, Wang (2003). [1], [3].
r   r         ?N)axis)NNNr   )r   r   )r   intr   ceilzerosarangeemptymaxrangeflipeyeshapematmulabs_EP128_E128_EM128ldexp)r   dr   ndkhmHintmvwfacjttiHpwrnnexpntHexpntr   s   &&&                 r   _kolmogn_DMTWrA   r   sp    	Cx$S#s33	
B	Sy$S#s33BGGBKA	A	A	A
!A 99QADaiA
A
C!a%	a%C  
QUS[!	a	!AD&	(B2XAbE1a[!%!)}a%&!) dGwwqq!AeH66"((1+a.!D	
BEF
q&6699T%DVOEIIaO!66!E1q5L/"V+KAeOF1WUAE\A 1a!e_EAI66!9vKAUNE	  zHHQ CE3//r   c                   V ^ 8X  d!   V) V,
          ^,
          W#,           ^,
          reM\        V ^,           ^4      w  rxV^ 8X  du   Wq^,           8X  d-   W,
          V,
          ^,
          W,           V,           ^,
          reMgV^,
          V,
          V,
          ^,
          Wr,           ^,
          V,           ^,
          reM,V^,
          V,
          ^,
          Wr,           V,           ^,
          re\        V^,           ^ 4      \        Wa4      3# )z0Compute the endpoints of the interval for row i.)divmodr%   min)	r<   r   llceilfroundfj1j2ip1div2ip1mod2s	   &&&&&    r   _pomeranz_compute_j1j2rL      s    Avuq"*q.B "!a%+a<a%%!+QVe^a-?B 1r)F2Q6q8H58PST8TBq[2%)7<&+@1+DrAvq>3r:%%r   c                *   W,          p\        \        P                  ! V4      4      pRW4,
          ,          p\        VRV,
          4      pV^ 8  d   ^M^ pVR8  d   ^M^ p^V^,           ,          p	\        P                  ! V	4      p
\        P                  ! V	4      p\        P                  ! V	4      pRV
^ &   RV^ &   RV^ &   ^ pW`,          ^V,          V ,          ^^V,          ,
          V ,          pr\        ^V	4       Ff  pV
V^,
          ,          V,          V,          V
V&   VV^,
          ,          V,          V,          VV&   VV^,
          ,          V,          V,          VV&   Kh  	  \        P                  ! V	.4      p\        P                  ! V	.4      p^V^ &   ^ ^ pp\        ^ WWx4      w  pp\        ^^V ,          ^,           4       EF(  pTpTTppTTppVP                  R4       \        VWWx4      w  ppV^8X  g   V^V ,          ^,           8X  d   T
pMV^,          '       d   TMTpVV,
          ^,           pV^ 8  g   Kz  \        P                  ! VVV,
          VV,
          V,            VRV 4      pVV,
          pVV,
          ^,           pVVVV,            VRV% ^ \        P                  ! V4      u;8  d   \        8  d   M MV\        ,          pV\        ,          pVV,           V,
          pEK+  	  VV V,
          ,          p\        ^V ^,           4       FE  p\        P                  ! V4      \        8  d   V\        ,          pV\        ,          pVV,          pKG  	  V^ 8w  d   \        P                  ! VV4      p\!        VRV,
          V4      pV# )zSComputes Pr(D_n <= d) using the Pomeranz recursion algorithm.

Pomeranz (1974) [2]
r   r   r   N)r    r   floorrD   r$   r&   r"   rL   fillconvolver%   r.   r,   r-   r+   r/   r   ) r   xr   trE   fgrF   rG   npwrsgpower	twogpoweronem2gpowerr?   g_over_ntwo_g_over_none_minus_two_g_over_nr4   V0V1V0sV1srH   rI   r<   k1pwrsln2conv
conv_startconv_lenanss    &&&                             r   _kolmogn_Pomeranzrg      s   $ 	
A	RXXa[	BqvAAsQwAa%QQEs7aFaLEXXe_FI((5/K F1IIaLKNE56S!A#a%!ac'12l1e_1q5MH,q0q	 Q',6:	!$QU+.DDqHA 
 
5'	B	5'	BBqE!C#Aqe<FB1a!eai RBS
'1%@B6Q!a%!)^D!"QIKD2gk7;;r"s(28c>:D#JGDbJBw{H J,ABByM266":&&f(R-C+ !0 QW+C1a!e_66#;6MCUNEq	  zhhsE"
S3Y
4CJr   c           	     	   VR8:  d   \        RRVR7      # VR8  d   \        RRVR7      # \        P                  ! V 4      V,          pV^,          V^,          V^,          V^,          3w  rErg\        ) ^,          V,          pV\        8  d   \        RRVR7      # \        P
                  ! V4      p	V) p
\        ^,          p^V,          ^V,          ,           p^V,          ^V,          ,
          \        ,          ^,          p\        ^^V,          ,
          ,          ^,          p\        ^^V,          ,
          ,          ^@,          p\        RV,          ^V,          ,           ,          ^,          p\        ^V,          ^`V,          ,
          ,          ^,          pRV,          ^ZV^,          ,          ,
          p\        P                  ! ^4      p\        \        P                  ! ^V,          \        P                  ,          4      4      p\        V^ R4       F  p^V,          ^,
          pV^,          V^,          V^,          ppp\        P                  ! V	^V,          4      p\        P                  ! RWV,          ,           WV,          ,           VV,          ,           VVV,          ,           VV,          ,           VV,          ,           .4      pVV,          pVV,          pK  	  VV	,          pV\        ,          pV\        P                  ! V^V,          ^HV^,          ,          RV^
,          ,          .4      ,          p\        P
                  ! \        ) ^,          V,          4      p	\        P                   ! V^ R4      pV^,          p\"        V,          p\        P                  V,          pV	V,          p \        P$                  ! VV ,          4      p!V!\        \        ,          R	V,          ,          ,          p!V^;;,          V!,          uu&   \        P$                  ! VV,           VV,
          ,          V,          V ,          4      p"V"\        \        ,          ^V,          ,          ,          p"V^;;,          V",          uu&   \        P                  ! V R,          \        P                   ! \'        V4      4      R,          4      p#VV#,          pV'       g   VR,          pV^ ;;,          ^,          uu&   \%        V4      p$V$# )
a4  Computes the Pelz-Good approximation to Prob(Dn <= x) with 0<=x<=1.

Start with Li-Chien, Korolyuk approximation:
    Prob(Dn <= x) ~ K0(z) + K1(z)/sqrt(n) + K2(z)/n + K3(z)/n**1.5
where z = x*sqrt(n).
Transform each K_(z) using Jacobi theta functions into a form suitable
for small z.
Pelz-Good (1976). [6]
r   r   r   iP         @iir   i)r   r   sqrt_PI_SQUARED_MIN_LOGexp_PI_FOUR_PI_SIXr"   r    r!   pir&   powerarray_SQRT2PIr#   _SQRT3sumlen)%r   rQ   r   zzsquaredzthreezfourzsixqlogqk1ak1bk2ak2bk2ck3dk3ck3bk3aK0to3maxkr2   r4   msquaredmfourmsixqpowercoeffsksksquaredsqrt3zkspiqpwersk2extrak3extrapowers_of_nKsums%   &&&                                  r   _kolmogn_PelzGoodr   #  s    	Cx$S#377Cx$S#377

QA$%qD!Q$1ad$:!He<!h&Dh$S#377
tA )C
/C
d(QY
Cu9q8|#{
2Q
6C
a!h,&
'"
,C
Qh&
'"
,C
cHnsU{2
3b
8C
urDy0
1A
5C
*rAqDy
 CHHQKE rwwrAv~&'D4BEAI !1adAqD%!QU#3X-X-E	9X-E	9CHDF G 	   
QJE	XE	RXXq!e)R!Q$Yq"u=>>E 	|a(*+A	4B	BQwHaZF552:D(]FffX&'G{X%sV|44G	!HHffftm6AFJKG{X%sTz22G	!HH((1s7BIIc%j$9C$?@K	[EaAu:DKr   c                   \         P                  ! V 4      '       d   V # \        V 4      V 8w  g   V ^ 8:  d   \         P                  # VR8  d   \	        RRVR7      # VR8:  d   \	        RRVR7      # W,          pVR8:  d   VR8:  d   \	        RRVR7      # V ^8:  dW   \         P
                  ! \         P                  ! ^V ^,           4      RV ,          ,          ^V,          ^,
          ,          4      pMO\         P                  ! \        V 4      V \         P                  ! ^V,          ^,
          4      ,          ,           4      p\	        VRV,
          VR7      # W0^,
          8  d,   ^RV,
          V ,          ,          p\	        ^V,
          WBR7      # VR8  d;   ^\        P                  P                  W4      ,          p\	        RV,
          WBR7      # W1,          pV ^8:  d   VR8:  d#   \        WRR7      p\	        VRV,
          VR7      # V^8:  d#   \        WRR7      p\	        VRV,
          VR7      # ^\        P                  P                  W4      ,          p\	        RV,
          WBR7      # V'       gB   VR8  d   R# VR8  d2   ^\        P                  P                  W4      ,          p\        V4      # VR	8  d   RpM6V R
8:  d#   WR,          ,          R8:  d   \        WRR7      pM\!        WRR7      p\	        VRV,
          VR7      # )zComputes the CDF(or SF) for the two-sided Kolmogorov-Smirnov statistic.

x must be of type float, n of type integer.

Simard & L'Ecuyer (2011) [7].
r   r   ri   r   g0q&?Tg      w@g@g      2@i g      ?gffffff?)r   isnanr    nanr   prodr#   rn   r   r   scipyspecialsmirnovrA   rg   r   r   )r   rQ   r   rR   prob	nxsquaredr   s   &&&    r   _kolmognr   v  se    
xx{{
1v{a1fvvCx$S#377Cx$S#377	ACx8(cs;;877299Q!,A6!A#'BCD665a81rvvac!e};LLMD$T3:3??EzC!Ga<$QXt==Cx5==((..$S4Z??ICx  40D(sTzsCC>$Qt4D(sTzsCC5==((..$S4Z?? u}},,Q22Dd##D	
fVs*$/#Ad3 #-SAAr   c                  a  \         P                  ! S 4      '       d   S # \        S 4      S 8w  g   S ^ 8:  d   \         P                  # VR8  g   V^ 8:  d   ^ # S V,          pVR8:  d   VR8:  d   R# S ^8:  dP   \         P                  ! \         P
                  ! ^S 4      RS ,          ,          ^V,          ^,
          ,          4      pMV\         P                  ! \        S 4      S ^,
          \         P                  ! ^V,          ^,
          4      ,          ,           4      pV^,          S ^,          ,          # VS ^,
          8  d&   ^RV,
          S ^,
          ,          ,          S ,          # VR8  d2   ^\        P                  P                  P                  VS 4      ,          # VR,          p\        WARS ,          ,
          4      p\        VRV,
          4      pV 3R lp\        WQV^R7      # )znComputes the PDF for the two-sided Kolmogorov-Smirnov statistic.

x must be of type float, n of type integer.
r   r   r   c                    < \        SV 4      # N)kolmogn)_xr   s   &r   _kk_kolmogn_p.<locals>._kk  s    q"~r   )dxorderg      @)r   r   r    r   r   r#   rn   r   r   r   statsksonepdfrD   r   )r   rQ   rR   prddeltar   s   f&    r   
_kolmogn_pr     sj   
 
xx{{
1v{a1fvvCx16	AACx88''"))Aq/S1W5QCDC&&4Q71Q3"&&QQRBS:SSTCQwA~AEzC!G1%%))Cx5;;$$((A... KE3q5y!EsQwE s%q11r   c                \  a a \         P                  ! S 4      '       d   S # \        S 4      S 8w  g   S ^ 8:  d   \         P                  # S^ 8:  d
   RS ,          # V^ 8:  d   R# \         P                  ! \         P
                  ! S4      \        P                  P                  S ^,           4      ,
          S ,          4      pVRS ,          8:  d   VRS ,          ,           ^,          # \         P                  ! \         P
                  ! VR,          4      S ,          4      ) pV^RS ,          ,
          8  d   V# \        P                  ! S4      \         P                  ! S 4      ,          p\        VRRS ,          ,
          4      pV V3R lp\        P                  P                  VRS ,          VRR7      # )zYComputes the PPF/ISF of kolmogn.

n of type integer, n>= 1
p is the CDF, q the SF, p+q=1
r   rj   c                 *   < \        SV 4      S,
          # r   )r   )rQ   r   r   s   &r   _f_kolmogni.<locals>._f  s    1~!!r   g+=)xtol)r   r   r    r   rn   r   r   r   loggammaexpm1scu	_kolmogcirk   rD   optimizebrentq)r   r   r~   r   rQ   x1r   s   ff&    r   	_kolmognir     s)    
xx{{
1v{a1fvvAv1uAvFFBFF1I 6 6qs ;;Q>?EA~a1$$	"&&3-/	""AAAI~	q	"''!*	$B	Rs1u	B" >>  SUBU ;;r   c                   \         P                  ! WVR.R.R\         P                  \         P                  \         P                  .R7      pV F_  w  rErg\         P                  ! V4      '       d   WGR&   K(  \        V4      V8w  d   \        RV 24      h\        \        V4      WVR7      VR&   Ka  	  VP                  R,          pV# )a  Computes the CDF for the two-sided Kolmogorov-Smirnov distribution.

The two-sided Kolmogorov-Smirnov distribution has as its CDF Pr(D_n <= x),
for a sample of size n drawn from a distribution with CDF F(t), where
:math:`D_n &= sup_t |F_n(t) - F(t)|`, and
:math:`F_n(t)` is the Empirical Cumulative Distribution Function of the sample.

Parameters
----------
n : integer, array_like
    the number of samples
x : float, array_like
    The K-S statistic, float between 0 and 1
cdf : bool, optional
    whether to compute the CDF(default=true) or the SF.

Returns
-------
cdf : ndarray
    CDF (or SF it cdf is False) at the specified locations.

The return value has shape the result of numpy broadcasting n and x.
Nzerosize_ok)flags	op_dtypes.n is not integral: ri   r   )	r   nditerfloat64bool_r   r    
ValueErrorr   operands)	r   rQ   r   it_nr   _cdfrx   results	   &&&      r   r   r     s    0 
A#t$]O"BJJ"**E
GB88B<<cFr7b=22$788#b'20#  [[_FMr   c                $   \         P                  ! WR.4      pV F^  w  r4p\         P                  ! V4      '       d   W5R&   K(  \        V4      V8w  d   \	        RV 24      h\        \        V4      V4      VR&   K`  	  VP                  R,          pV# )a\  Computes the PDF for the two-sided Kolmogorov-Smirnov distribution.

Parameters
----------
n : integer, array_like
    the number of samples
x : float, array_like
    The K-S statistic, float between 0 and 1

Returns
-------
pdf : ndarray
    The PDF at the specified locations

The return value has shape the result of numpy broadcasting n and x.
N.r   r   )r   r   r   r    r   r   r   )r   rQ   r   r   r   rx   r   s   &&     r   kolmognpr     s    " 
A$<	 B	88B<<cFr7b=22$788CGR(#  [[_FMr   c                f   \         P                  ! WVR.4      pV F~  w  rErg\         P                  ! V4      '       d   WGR&   K(  \        V4      V8w  d   \	        RV 24      hV'       d   V^V,
          3M
^V,
          V3w  r\        \        V4      W4      VR&   K  	  VP                  R,          p
V
# )a  Computes the PPF(or ISF) for the two-sided Kolmogorov-Smirnov distribution.

Parameters
----------
n : integer, array_like
    the number of samples
q : float, array_like
    Probabilities, float between 0 and 1
cdf : bool, optional
    whether to compute the PPF(default=true) or the ISF.

Returns
-------
ppf : ndarray
    PPF (or ISF if cdf is False) at the specified locations

The return value has shape the result of numpy broadcasting n and x.
N.r   r   )r   r   r   r    r   r   r   )r   r~   r   r   r   _qr   rx   _pcdf_psfr   s   &&&        r   kolmognir   ;  s    & 
A#t$	%B88B<<cFr7b=22$788$(r1R4jqtRj3r7E0#  [[_FMr   i<)gSˆBgAAz?g}<ٰj_g#+K?g88CgJ?gllfgUUUUUU?)T)'numpyr   scipy.specialr   scipy.special._ufuncsr   _ufuncsr   scipy.stats._finite_differencesr   r-   r/   
longdoubler,   r.   rk   rq   rt   r   r   rm   ru   rl   ro   rp   r
   r   r   r   rA   rL   rg   r   r   r   r   r   r   r    r   r   <module>r      s
  H   # # 7	"--"E	*	"--"UF	+771ruu966!bee)	eeqj55A:
%%1*I R 
H0V&$QhPf9Bx'2T<:"J:r   