Conditional chart gradients

Fitting the hyperparameters of the molecular-chart kernel needs the derivative of the likelihood with respect to each log hyperparameter. That derivative contracts a weight matrix against the derivative of the covariance, which couples every pair of geometries and every energy and force channel. This page gives the contraction that ManifoldEnergyForceKernel::contractJointLogHyperparameterDerivatives evaluates from low-rank factors of the weight, and the floating-point bounds the implementation relies on. The factored path exists for affine charts only; the function throws for any other chart.

Status: implemented for affine charts, in the conditional posterior of gpr/ml/gp/ActivePosterior.cpp. The symbolic identities and the 49 binary64 rounding certificates are checked by a script and by C++ tests; the Lean statements are listed under Checks.

The conditional GP covariance is

\[S=C_{qq}-C_{aq}^{T}C_{aa}^{-1}C_{aq}.\]

The anchor covariance includes its fixed noise. With \(W=C_{aa}^{-1}C_{aq}\) and \(T=[-W;I]\), its differential is \(dS=T^{T}(dK)T\). The likelihood derivative is \(\frac12\langle T\,\operatorname{sym}(Q)T^{T},K_\theta\rangle_F\). The weight \(Q\) can be indefinite. The implementation forms factors \(L=T\operatorname{sym}(Q)\) and \(R=T\), then contracts their rows. The matrix notation groups anchor and query channels; the row accessor maps them to the stored channel-major order.

Differential blocks

For a geometry pair, let \(\delta=z_i-z_j\), \(a=\ell^{-2}\), \(s=a\|\delta\|^2\), and \(k=m\exp(-s/2)\). Split each factor into its energy row \(e\) and Cartesian gradient rows \(G\). Project the latter through the chart Jacobian: \(H_L=J_iG_L\), \(H_R=J_jG_R\). Define \(p=H_L^T\delta\), \(z=H_R^T\delta\), and

\[E=e_L e_R^T,\quad X=e_Lz,\quad Y=p^Te_R^T,\quad F=\langle H_L,H_R\rangle_F,\quad O=p^Tz.\]

The log-magnitude contraction is \(k[E+a(X-Y+F)-a^2O]\). The log-length contraction is \(k[sE+a(s-2)(X-Y+F)-a^2(s-4)O]\). These identities retain the full affine metric and every force channel. Affine charts use this path. Other charts contract dense derivative row blocks.

Arithmetic and storage

Products and chart projections use binary64 arithmetic. Inner products and row sums retain a TwoSum correction. Scaling proceeds from the weight inward, including \(k(a(ax))\), so forming \(a^2\) alone cannot erase a representable term. Rows accumulate in geometry order. Each row belongs to one Message Passing Interface (MPI) rank, including executions with idle ranks or split communicators.

Each row’s arithmetic obeys these bounds for normal operations without overflow. Let \(u=2^{-53}\) and \(\gamma_n=nu/(1-nu)\). A product chain has relative error bounded by \(\gamma_n\). An entry’s error bound uses its sum of product magnitudes. This permits cancellation of the exact entry. Projected factor errors also contribute to the full sum.

For exact TwoSum residuals, rounding the accumulated correction contributes at most \(\gamma_n^2\sum_i|v_i|\). Rounded scalar products add their own error. The pair budget is \([u+(1+u)\gamma_n^2]\sum_i|x_i y_i|\); rounding sum plus correction adds another rounding step. These bounds require normal intermediates and no overflow. Separate exact binary64 certificates cover the documented subnormal examples. The certificates treat the computed kernel value as an input; they do not certify the platform exponential, linear solve, or nonlinear optimizer.

Storage

The contraction uses \(N\) geometries and \(D\) Cartesian coordinates. Let \(r\) denote the chart rank, \(q\) the query channels, and \(P\) the ranks. The arithmetic cost is \(O(N^2rq/P+N(D+1)q^2/P)\) arithmetic. Projected factor buffers use \(O((N/P+B)(r+1)q)\) storage with batch size \(B=16\), plus temporary factors. The anchor solve, stored projection weights, likelihood weight and chart geometry retain their storage requirements.

Checks

scripts/check_factored_chart_contraction.py needs SymPy and Sollya. It derives the Schur differential and both parameter derivatives, then requires all 49 rounding certificates. Sollya’s binary64 rounding operation includes subnormals.

From proofs/lean, run lake build GPRidge and lake env lean Audit.lean. The Lean identities cover arbitrary finite matrix dimensions, indefinite weights, the channel permutation, rank ownership and error summation without division by the exact value. The C++ suites compare dense transport, finite differences, cancellation, subnormal terms and distributed execution. Molecular acceptance requires the Baker and Birkholz results, measured walltime and force-call counts.