pyhgf.math.lambert_w0#
- pyhgf.math.lambert_w0 = <jax._src.custom_derivatives.custom_jvp object>[source]#
Principal branch of the Lambert W function for z >= 0.
Solves
w * exp(w) = zvia 6 Halley iterations, which yields machine precision for all z >= 0.A custom JVP is attached so that reverse-mode autodiff does not backprop through the Halley iterations. The implicit relation
w * exp(w) = zyields the closed-form derivative\[\frac{\partial W}{\partial z} = \frac{1}{e^{w}\,(1 + w)},\]which is well-defined for all
z >= 0(in particular atz = 0, wherew = 0gives∂W/∂z = 1). This avoids the NaN gradients that would otherwise arise when the Halley iterations’ intermediateexp(w)values overflow.