Expand description
Elliptic integrals.
The complete integrals K and E use the arithmetic-geometric mean (AGM), which is
branchless and needs only one sqrt per iteration - far cheaper for SIMD than the
Carlson duplication algorithm used for the incomplete forms (see carlson_rf etc.).
The algorithms are classical (Gauss/Legendre AGM; Carlson’s symmetric forms); this is an original SIMD implementation, not a port of any particular source.
Structs§
- Carlson
Rc - Carlson
R_C(x, y) = R_F(x, y, y)- degenerate first kind. SeeCarlsonKind. - Carlson
Rd - Carlson
R_D(x, y, z) = R_J(x, y, z, z)- degenerate third kind;zis the repeated argument. SeeCarlsonKind. - Carlson
Rf - Carlson
R_F(x, y, z)- symmetric integral of the first kind. SeeCarlsonKind. - Carlson
Rg - Carlson
R_G(x, y, z)- symmetric integral of the second kind. SeeCarlsonKind. - Carlson
Rj - Carlson
R_J(x, y, z, p)- symmetric integral of the third kind;pis the parameter (a Cauchy principal value whenp < 0). SeeCarlsonKind. - EllintD
- Complete
D(k) = (K - E) / k^2. - EllintD
Inc - Incomplete
D(phi, k). - EllintE
- Complete elliptic integral of the second kind,
E(k). - EllintE
Inc - Incomplete elliptic integral of the second kind,
E(phi, k). - EllintF
- Incomplete elliptic integral of the first kind,
F(phi, k). - EllintK
- Complete elliptic integral of the first kind,
K(k). - Ellint
Pi - Complete elliptic integral of the third kind,
Pi(n, k). - Ellint
PiInc - Incomplete elliptic integral of the third kind,
Pi(n, phi, k). - Heuman
Lambda - Heuman’s lambda
Lambda_0(phi, k), the complementary-modulus companion to the complete integral of the third kind. Seeheuman_lambda. - Jacobi
Zeta - Jacobi zeta
Z(phi, k): the oscillating part ofE(phi, k). Seejacobi_zeta.
Constants§
- KIND_D
- KIND_E
- KIND_F
- Legendre integral kinds for
ellint_impl’sKINDconst parameter. - KIND_PI
Traits§
- Carlson
Kind - A Carlson symmetric elliptic integral request. The implementors are small structs that carry
the integral’s arguments as named fields (
CarlsonRf,CarlsonRc,CarlsonRd,CarlsonRj,CarlsonRg), so each kind has exactly its own arguments - no dummy slots, and the special roles (R_J’s parameterp,R_D’s repeatedz) are named at the call site. - Elliptic
Consts - Compile-time per-element constants for the elliptic routines, so values that are otherwise a
few runtime ops (e.g. the Carlson convergence threshold, three sequential
sqrts) become a constant splat. Declared forf32/f64; add more element types as needed. - Elliptic
Kind - Legendre elliptic integral request, dual to
CarlsonKind(see it for the named-field rationale). The implementors areEllintK/EllintF(1st kind, complete/incomplete),EllintE/EllintEInc(2nd kind),EllintD/EllintDInc, andEllintPi/EllintPiInc(3rd kind). Completeness is encoded by the fields: a complete integral has nophi. - WrapTo
- The wider (vector) form of a scalar request struct - the inverse of [
Unwrap] for these structs.Unwraponly maps vector -> scalar (type Unwrapped), and Rust cannot invert an associated type, so this names the forward (scalar -> vector) direction. It is what lets theScalar*math-trait layer take a scalar request (CarlsonRf<f64>), wrap it into a width-1 vector request (CarlsonRf<Vector<f64>>), evaluate on the (vector-only) backend, then unwrap the scalar result - without implementing the backend twice. Implemented only for scalar-element request structs.
Functions§
- agm
- The arithmetic-geometric mean
$\mathrm{AGM}(a, b)$of two non-negative arguments. - agm_
complete_ ke - Complete elliptic integrals of the first and second kind,
(K(k), E(k)), evaluated together from a single AGM pass (they share the iteration). - carlson_
rc - Carlson degenerate integral
R_C(x, y) = R_F(x, y, y), closed form. Assumesy > 0(the only cases that arise inside R_J and the third-kind reductions); they < 0Cauchy-principal-value branch is not handled here. - carlson_
rd - Carlson symmetric integral
R_D(x, y, z) = R_J(x, y, z, z)(degenerate third kind, used for the second-kind incomplete integral). Same duplication scheme ascarlson_rf, plus an accumulated sum term. - carlson_
rf - Carlson symmetric integral of the first kind,
R_F(x, y, z), via the duplication algorithm. All Boost special cases are omitted: the duplication converges for any valid input (e.g. a single zero argument becomes positive after one step), so the loop runs uniformly across lanes and stops once every lane has converged. - carlson_
rg - Carlson symmetric integral of the second kind,
R_G(x, y, z), as a combination ofcarlson_rfandcarlson_rd(Carlson 2015): - carlson_
rj - Carlson symmetric integral of the third kind,
R_J(x, y, z, p), via duplication. Handlesp < 0(a Cauchy principal value) through Carlson’s transform to a positive parameter. Each step accumulates anR_Cterm, so this is the most expensive Carlson primitive. - ellint_
impl - Legendre elliptic integral, const-generic over kind and completeness.
- heuman_
lambda - Heuman’s lambda function
$\Lambda_0(\varphi, k)$. - jacobi_
zeta - The Jacobi zeta function
$Z(\varphi, k)$.