@@ -321,22 +321,22 @@ end
321321# the auxiliary variable f, the continued-fraction coefficients a_n, b_n, and
322322# their partial derivatives w.r.t. p (≡ a) and q (≡ b). See Boik & Robinson-Cox (1999).
323323
324- @inline function _Kfun (x:: T , p:: T , q:: T ) where {T<: AbstractFloat }
324+ @inline function _Kfun (x:: T , p:: T , q:: T ) where {T}
325325 # K(x;p,q) = x^p (1-x)^{q-1} / (p * B(p,q)) computed in log-space for stability
326326 return exp (p * log (x) + (q - 1 ) * log1p (- x) - log (p) - logbeta (p, q))
327327end
328328
329- @inline function _ffun (x:: T , p:: T , q:: T ) where {T<: AbstractFloat }
329+ @inline function _ffun (x:: T , p:: T , q:: T ) where {T}
330330 # f = q x / (p (1-x)) — convenience variable appearing in CF coefficients
331331 return q * x / (p * (1 - x))
332332end
333333
334- @inline function _a1fun (p:: T , q:: T , f:: T ) where {T<: AbstractFloat }
334+ @inline function _a1fun (p:: T , q:: T , f:: T ) where {T}
335335 # a₁ coefficient of the continued fraction for ₂F₁ representation
336336 return p * f * (q - 1 ) / (q * (p + 1 ))
337337end
338338
339- @inline function _anfun (p:: T , q:: T , f:: T , n:: Int ) where {T<: AbstractFloat }
339+ @inline function _anfun (p:: T , q:: T , f:: T , n:: Int ) where {T}
340340 # a_n coefficient (n ≥ 1) of the continued fraction for ₂F₁ in terms of p=a, q=b, f.
341341 # For n=1, falls back to a₁; for n≥2 uses the closed-form product from the Gauss CF.
342342 n == 1 && return _a1fun (p, q, f)
@@ -346,24 +346,24 @@ end
346346 return r * (n - 1 ) * (pn + q - 2 ) * (pn - 1 ) * (q - n) / ((p2n - 3 ) * (p2n - 2 )^ 2 * (p2n - 1 ))
347347end
348348
349- @inline function _bnfun (p:: T , q:: T , f:: T , n:: Int ) where {T<: AbstractFloat }
349+ @inline function _bnfun (p:: T , q:: T , f:: T , n:: Int ) where {T}
350350 # b_n coefficient (n ≥ 1) of the continued fraction. Derived for the same CF.
351351 x = 2 * n * (p * f + 2 * q) * (n + p - 1 ) + p * q * (p - 2 - p * f)
352352 y = q * (p + 2 * n - 2 ) * (p + 2 * n)
353353 return x / y
354354end
355355
356- @inline function _dK_dp (x:: T , p:: T , q:: T , K:: T , ψpq:: T , ψp:: T ) where {T<: AbstractFloat }
356+ @inline function _dK_dp (x:: T , p:: T , q:: T , K:: T , ψpq:: T , ψp:: T ) where {T}
357357 # ∂K/∂p using digamma identities: d/dp log B(p,q) = ψ(p) - ψ(p+q)
358358 return K * (log (x) - inv (p) + ψpq - ψp)
359359end
360360
361- @inline function _dK_dq (x:: T , p:: T , q:: T , K:: T , ψpq:: T , ψq:: T ) where {T<: AbstractFloat }
361+ @inline function _dK_dq (x:: T , p:: T , q:: T , K:: T , ψpq:: T , ψq:: T ) where {T}
362362 # ∂K/∂q using identical pattern
363363 K * (log1p (- x) + ψpq - ψq)
364364end
365365
366- @inline function _dK_dpdq (x:: T , p:: T , q:: T ) where {T<: AbstractFloat }
366+ @inline function _dK_dpdq (x:: T , p:: T , q:: T ) where {T}
367367 # Convenience: compute (∂K/∂p, ∂K/∂q) together with shared ψ(p+q)
368368 ψ = digamma (p + q)
369369 Kf = _Kfun (x, p, q)
@@ -372,12 +372,12 @@ end
372372 return dKdp, dKdq
373373end
374374
375- @inline function _da1_dp (p:: T , q:: T , f:: T ) where {T<: AbstractFloat }
375+ @inline function _da1_dp (p:: T , q:: T , f:: T ) where {T}
376376 # ∂a₁/∂p from the closed form of a₁
377377 return - _a1fun (p, q, f) / (p + 1 )
378378end
379379
380- @inline function _dan_dp (p:: T , q:: T , f:: T , n:: Int ) where {T<: AbstractFloat }
380+ @inline function _dan_dp (p:: T , q:: T , f:: T , n:: Int ) where {T}
381381 # ∂a_n/∂p via log-derivative: d a_n = a_n * d log a_n; for n=1, uses ∂a₁/∂p
382382 if n == 1
383383 return _da1_dp (p, q, f)
@@ -387,13 +387,13 @@ end
387387 return an * dlog
388388end
389389
390- @inline function _da1_dq (p:: T , q:: T , f:: T ) where {T<: AbstractFloat }
390+ @inline function _da1_dq (p:: T , q:: T , f:: T ) where {T}
391391 # ∂a₁/∂q
392392 return _a1fun (p, q, f) / (q - 1 )
393393end
394394
395395
396- @inline function _dan_dq (p:: T , q:: T , f:: T , n:: Int ) where {T<: AbstractFloat }
396+ @inline function _dan_dq (p:: T , q:: T , f:: T , n:: Int ) where {T}
397397 # ∂a_n/∂q avoiding the removable singularity at q ≈ n for integer q.
398398 # For n=1, defer to the specific a₁ derivative.
399399 if n == 1
415415 return C * (p + 2 * q - 2 )
416416end
417417
418- @inline function _dbn_dp (p:: T , q:: T , f:: T , n:: Int ) where {T<: AbstractFloat }
418+ @inline function _dbn_dp (p:: T , q:: T , f:: T , n:: Int ) where {T}
419419 # ∂b_n/∂p via quotient rule on b_n = N/D.
420420 # Note the internal dependence f(p,q)=q x/(p(1-x)) — terms cancel in N as per derivation.
421421 g = p * f + 2 * q
431431 return (dN_dp * D - N * dD_dp) / (D^ 2 )
432432end
433433
434- @inline function _dbn_dq (p:: T , q:: T , f:: T , n:: Int ) where {T<: AbstractFloat }
434+ @inline function _dbn_dq (p:: T , q:: T , f:: T , n:: Int ) where {T}
435435 # ∂b_n/∂q similarly via quotient rule
436436 g = p * f + 2 * q
437437 A = 2 * n^ 2 + 2 * (p - 1 ) * n
447447 return (dN_dq * D - N * dD_dq) / (D^ 2 )
448448end
449449
450- @inline function _nextapp (f:: T , p:: T , q:: T , n:: Int , App:: T , Ap:: T , Bpp:: T , Bp:: T ) where {T<: AbstractFloat }
450+ @inline function _nextapp (f:: T , p:: T , q:: T , n:: Int , App:: T , Ap:: T , Bpp:: T , Bp:: T ) where {T}
451451 # One step of the continuant recurrences:
452452 # A_n = a_n A_{n-2} + b_n A_{n-1}
453453 # B_n = a_n B_{n-2} + b_n B_{n-1}
@@ -458,12 +458,12 @@ end
458458 return An, Bn, an, bn
459459end
460460
461- @inline function _dnextapp (an:: T , bn:: T , dan:: T , dbn:: T , Xpp:: T , Xp:: T , dXpp:: T , dXp:: T ) where {T<: AbstractFloat }
461+ @inline function _dnextapp (an:: T , bn:: T , dan:: T , dbn:: T , Xpp:: T , Xp:: T , dXpp:: T , dXp:: T ) where {T}
462462 # Derivative propagation for the same recurrences (X∈{A,B})
463463 return dan * Xpp + an * dXpp + dbn * Xp + bn * dXp
464464end
465465
466- function _beta_inc_grad (a:: T , b:: T , x:: T ; maxapp:: Int = 200 , minapp:: Int = 3 , err:: T = eps (T)* T (1e4 )) where {T<: AbstractFloat }
466+ function _beta_inc_grad (a:: T , b:: T , x:: T ; maxapp:: Int = 200 , minapp:: Int = 3 , err:: T = eps (T)* T (1e4 )) where {T}
467467 # Compute I_x(a,b) and partial derivatives (∂I/∂a, ∂I/∂b, ∂I/∂x)
468468 # using a differentiated continued fraction with convergence control.
469469 oneT = one (T)
0 commit comments