Algorithm 916: Faddeyeva & Voigt Evaluation
- Algorithm 916 is a computational routine for evaluating the Faddeyeva function and its Voigt components with high precision (up to 13–15 digits) using series expansions and asymptotic methods.
- It balances accuracy and efficiency through tunable parameters, precomputed exponentials, and domain-specific shortcuts, and is implemented in MATLAB, Fortran, and Scilab.
- Benchmarks show that Algorithm 916 outperforms earlier methods in speed and precision, making it essential for plasma physics, radiative transfer, and high-throughput spectral synthesis.
Algorithm 916 is a robust, highly accurate, and tunable computational algorithm for evaluating the Faddeyeva function and its real (Voigt function ) and imaginary () components. Originally implemented as a MATLAB routine, it was designed to achieve both high precision (up to 13–15 significant digits) and efficient computation across broad domains in the complex plane, particularly for applications in plasma physics, radiative transfer, and spectroscopy. Algorithm 916 introduced systematic control over the accuracy vs. efficiency trade-off and has subsequently been optimized, extended to Fortran and Scilab, and incorporated into high-throughput frameworks such as GPU-based HELIOS-K.
1. Mathematical Foundations
The Faddeyeva function is defined as
where and denotes the complementary error function. An equivalent form is
with and denoting the real and imaginary Voigt functions. The Voigt profile, common in spectroscopy and astrophysics, is the real part of and is expressed as
For efficient computation, the algorithm employs the Salzer expansion for : where tunes the relative error .
2. Series Expansions and Integral Representations
Algorithm 916 rewrites the expressions for and as organized series using the above expansion and integral representations for the error function. The key reformulation involves expressing as a sum of five one-dimensional series (), avoiding direct computation of double sums and leveraging symmetries such as
This rearrangement is critical for uniform convergence and stable evaluation even near problematic regions of the complex plane.
For large , Algorithm 916 switches to an asymptotic continued-fraction expansion (after Faddeeva–Terent’ev and Gautschi) to preserve both speed and accuracy: which ensures relative error for (Zaghloul, 2015).
3. Algorithmic Implementation and Parameter Control
The main MATLAB function signature is
1 2 |
w = faddeyeva(z) w = faddeyeva(z, tiny) |
z is a complex array and tiny is the user-specified relative error threshold, defaulting to (machine precision in IEEE double-precision). Internally, tiny is mapped to the expansion parameter via
thus directly linking accuracy and convergence rate.
For performance, the algorithm:
- Precomputes exponentials and updates them iteratively within the summation loop.
- Makes domain-specific shortcuts: direct use of
erfcxfor purely imaginary arguments, rapid switching to continued fractions for large , and logic to avoid catastrophic cancellation near the real axis. - Truncates the series when new terms fall below
tinyor machine epsilon.
A pseudocode kernel captures this structure:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
function w = faddeyeva(z, tiny)
% initialization...
for each (x, y > 0) in z
% handle special cases
for n = 1 to n_max
% update terms for Sigma1...Sigma5
if (new_term/acc_sum < max(tiny, eps)), break, end
end
% combine Sigma's
w(x, y) = Re + i*Im
% apply symmetry if necessary
end
end |
4. Accuracy vs Efficiency: Tunable Trade-Offs
Algorithm 916's distinctive feature is its tunable accuracy/speed trade-off using the tiny (or sdgts in later versions) parameter. Users can select:
| Desired Accuracy (digits) | Input Parameter | Algorithmic Consequence | Typical Runtime (MATLAB, 2.8M points) |
|---|---|---|---|
| 13–15 | tiny ≈ 1e−17, sdgts=13 | Full cycles, tight cutoff | 1.55 s (v2) |
| ~10 | tiny = 1e−8, sdgts=8 | Fewer cycles, earlier cutoff | 0.76 s |
| ~6 | tiny = 1e−4, sdgts=4 | Minimal cycles, w4 fallback | 0.49 s |
Forreduced precision (), the algorithm invokes a reformed version of Humlíček’s “w4” routine, correcting previous accuracy failures on the real axis (Zaghloul, 2015).
5. Benchmarks and Comparative Performance
Extensive benchmarks have demonstrated Algorithm 916's superiority across both accuracy and speed. For 2.8 million evaluations over , :
- Full-precision (tiny ≈ 1.4e−17): Relative error , runtime 1.55 s (v2), versus 4.46 s (original), 107.4 s for Poppe & Wijers (Algorithm 680), 23.2 s for Humlíček (Zaghloul et al., 2011, Zaghloul, 2015).
- Low-accuracy mode (sdgts=4): Runtime 0.49 s, still avoiding the pathological failures of prior algorithms (e.g., negative Voigt values or total loss of precision near the real axis).
In all tested domains, Algorithm 916 and its v2 implementation are free of catastrophic inaccuracies documented for Hui et al., Humlíček, Weideman, and Letchworth & Benner.
6. Extensions, Implementations, and High-Throughput Applications
Subsequent work provided major efficiency improvements, fixed-cycle summation (removing dynamic convergence checks), precomputation of all necessary exponentials, logical domain partitioning, and optimized asymptotic thresholds. The “v2” codebase is available in MATLAB, Scilab, and Fortran 2008. The Fortran module supports both single and double precision, exposes optional partial derivatives, and handles large-scale evaluations with fine-grained control over significant digits via the sdgts argument (range 4–13).
Algorithm 916 is foundational in the HELIOS-K GPU-accelerated opacity calculator (Grimm et al., 2015). In this context, it is fused with Gauss–Hermite quadrature for the efficient batch evaluation of Voigt profiles on modern CUDA hardware. The regional switching (Algorithm 916 for , GH3 or GH1 quadrature for larger ) ensures both optimal efficiency and uniform high-precision for exoplanet and radiative transfer models.
| Code / Mode | Max Rel. Error | MATLAB Time (s, 2.8M pts) |
|---|---|---|
| Faddeyeva(z,13) (v2) | ~1e-13 | 1.55 |
| Faddeyeva(z,4) (v2) | ~1e-4 | 0.49 |
| Poppe & Wijers [1990] | 107.4 | |
| Humlíček 1982 | ~10–23 |
7. Practical Usage and Recommendations
For MATLAB/Scilab, the interface allows flexible selection of precision:
1 2 3 |
w = faddeyeva(z) % maximum accuracy (13–15 digits) w = faddeyeva(z,1e-8) % medium precision (~10 digits) w = faddeyeva(z,1e-4) % fast, low precision (~6 digits) |
For Fortran:
1 |
call Faddeyeva_v2_rk(z, sdgts, w, dVdx, dVdy, Stat) |
Recommended settings:
- Use
sdgts=13for high-accuracy spectral synthesis, radiative transfer, or reference calculations (Zaghloul, 2015). - For high-throughput environments (e.g., opacities, atmospheric retrieval):
sdgts≈8(10−8) balances speed and accuracy. - For rapid, low-precision tasks where error is acceptable:
sdgts=4activates the safe, compensated low-precision branch. - Selection of parameters can be guided by published timing and error tables to optimize performance for domain-specific needs.
Algorithm 916's design, error analysis, and performance data position it as the state-of-the-art routine for practical and research-grade evaluation of the Faddeyeva and Voigt functions in scientific computing (Zaghloul et al., 2011, Grimm et al., 2015, Zaghloul, 2015).