8 Adaptive evaluation and numerical interfaces
On this page · Permalink · Source line 1
An adaptive solver should refine the representation responsible for the largest unresolved error. The planner described here chooses packets, support, and modes jointly. Its floating implementation retains an analytic ledger. The next part supplies the stricter contract in which finite arithmetic and output serialization are enclosed as well.
8.1 Adaptive K-COS algorithm
On this page · Permalink · Source line 7
The packet planner accepts a finite positive spectrum, an upper-tail query \(q>\sum_j\lambda_j\), and a requested relative tolerance \(\tau>0\). Its initial support parameter satisfies \(L>0\), and its mode count is a positive integer.
Solve \(\kappa'(\theta_*)=q\).
Initialize an upper interval \(b=q+L\sqrt{\kappa''(\theta_*)+\sqrt{\kappa^{(4)}(\theta_*)}}\) and a mode count \(N\).
Retain the largest spectral spikes exactly and place the remaining sorted eigenvalues into coarse packets.
Evaluate \(\rho_P(\theta_*+{\mathrm{i}} u_k)\) and the packet remainder bound on the actual COS grid. Split packets until the propagated packet contribution is within its budget.
Evaluate the omitted-mode certificate (7.15).
If the combined relative certificate exceeds \(\tau\), refine whichever analytic error source dominates: split packets, increase \(b\), or increase \(N\).
Return a certified analytic result only after the combined bound meets \(\tau\). Return the tail estimate, the compiled spectral representation, and its error ledger together. If resource limits are reached first, report failure to certify rather than accepting the estimate.
The resulting object is query dependent. Schematically,
where \(\mathcal P_{\Lambda,q,\tau}\) stores exact spikes, packet centers, centered moments, packet radii, and the selected COS parameters.
8.2 Numerical interfaces and log-domain evaluation
On this page · Permalink · Source line 40
The preceding mathematics is exposed through a domain-neutral engine rather than through a SKAT-only entry point. The central positive engine accepts:
an explicit nonnegative spectrum.
a positive semidefinite matrix.
a dense factor \(A\).
a replayable streamed column-factor source.
or a covariance/quadratic-matrix pair \((\Sigma,M)\).
A signed central engine accepts a signed spectrum, a symmetric operator, or
and performs the exact central-indefinite reduction proved in Chapter 1. A separate noncentral positive engine accepts
and performs the corresponding noncentral reduction.
8.2.1 Log-domain packet error accumulation
On this page · Permalink · Source line 65
After separating the likelihood-ratio prefactor, the packet contribution contains sums of the form
Direct evaluation can overflow even when the candidate is destined to be rejected by the adaptive planner. The implementation instead computes
by log-sum-exp arithmetic, and compares this quantity with the logarithm of the requested tolerance before converting a final accepted bound back to float64.
This change does not weaken the mathematical bound. It changes only its floating-point representation.
8.2.2 Reference convergence is part of verification
On this page · Permalink · Source line 97
An independently evaluated reference is useful only if its own numerical resolution has converged. In a rank-350 deep-tail audit, an initial fixed-grid reference appeared to disagree with the adaptive answer. Increasing the reference COS grid gave absolute discrepancies of approximately
decades as the grid was refined through

The numerical verification rule is consequently two-sided: the adaptive solver must satisfy its own certificate, and any external or fixed-grid reference used for comparison must demonstrate numerical convergence.