Skip to main content

Module polylog

Module polylog 

Source
Expand description

The polylogarithm order.

polylog takes its order as a PolylogOrder: a scalar, uniform across the packet, tagged by the class of order it carries. $\mathrm{Li}_n$ at whole-number n is a table lookup: every coefficient of the unity series is a tabulated $\zeta$ value, the leading $\Gamma(1-s)(-\mu)^{s-1}$ term collapses into $H_{n-1} - \ln(-\mu)$, and the far field is the Bernoulli-polynomial inversion formula. At arbitrary real s the same series needs a sweep of live $\zeta(s-k)$ evaluations, a real power, and Wood’s m-th-root identity in the far field. Those are different algorithms with costs an order of magnitude apart.

§Why a scalar, not a vector

Every order-dependent quantity ($\zeta(s-k)/k!$, $k^{-s}$, $\Gamma(1-s)$, the near-integer brackets) is a per-call scalar precompute, splatted once. A per-lane order would pay that sweep per lane, and the regime choices that depend on s (near an integer, non-positive) would become masks over arms every lane then has to evaluate. A caller with several orders runs several calls.

§The payload types

PolylogOrder<E, S> carries the invoking vector’s own element types: E is its Element (f64 on an f64 vector, Complex<f64> on a complex one, a Dual element on a dual one) and S is its Signed lane element (i64 on an f64 vector, i32 on an f32 one), so an order is spelled in the arithmetic of the type it is used with and nothing is ever converted. The trait signature is PolylogOrder<Self::Element, <Self::Signed as GenericVector>::Element>.

§Downgrading

simplify narrows Real to Integer when the value is exactly whole. Nothing narrower is attempted: unlike the Bessel order there is no half-integer shortcut (Wood’s half-integer series is the general one with tabulated constants). A near-integer order is a correctness hazard for the general arm rather than a cost choice, which is why the general kernel fuses the two cancelling poles algebraically instead of trusting the caller to have snapped.

Enums§

PolylogOrder
The order $s$ of a polylogarithm, tagged with the class of order it carries. See the module documentation.
Last built: 2026-09-08 21:35:55 UTC