========================= Methods: the linear solve ========================= The GP covariance matrix has one energy row and :math:`D` gradient rows per observation, so :math:`n` observations give :math:`(D+1)\,n` rows. Every fit and every prediction solves a system with that matrix. This page lists each alternative to the dense Cholesky factor that GPRidge has tried, in the form set out on the :doc:`section index `. **Status:** explanation. Commit hashes are abbreviated and are ancestors of ``origin/develop`` at ``e944f60acc`` unless the text says otherwise. A ledger entry is cited by its date and time. The default: dense Cholesky --------------------------- **What it is.** The covariance matrix is factored once, and the weights, the log determinant and the posterior variance come from the factor. The ``KernelInverse`` interface hides the implementation: a dense Eigen factor, a ScaLAPACK factor for several MPI ranks, or a cuSOLVER factor (``gpr/linalg/KernelInverse.h``, commit ``9903a83aa``). **Status.** On develop, default. The HODLR and Nystrom implementations of the interface were removed (``d22aeeca8``). **Use.** The backend is chosen when you build: ``-Dlinalg_backend``. No flag, key or C function selects an implementation at run time. **Measured.** The dense implementation matches an in-test Eigen factor to a relative :math:`10^{-10}` on a 200-row fixture (``9903a83aa``). A dense factor of 1408 rows takes 0.056 s and one of 4480 rows takes 0.366 s (ledger 2026-11-13 16:36, from the ``improve/sparse-precision`` and ``improve/spectral-approx`` runs). **Why it stays.** At the matrix orders that a search produces, no approximation below beat it in total search cost. The sections that follow give the evidence for each. Covariance operator layer and the Krylov objective -------------------------------------------------- **What it is.** ``gpr/linalg/linop`` holds a small interface for symmetric positive semi-definite operators and a solver interface with four questions: :math:`K^{-1}y`, :math:`\log\det K`, :math:`y^{T}K^{-1}y` and :math:`\operatorname{diag}(B^{T}K^{-1}B)`. ``DenseCholeskySolver`` answers them from the Cholesky factor and calls the backend one for one, so the dense path stays bitwise identical (commit ``59f83a3a6``). ``KrylovCovarianceSolver`` answers the same questions with preconditioned batched conjugate gradients (mBCG), stochastic Lanczos quadrature (SLQ) for the log determinant and Hutchinson probes for traces. A cost model compares operation counts and picks the cheaper route. **Status.** On develop. The dense solver is the default and every covariance consumer goes through it (``5718851c8``, ``16c7f0295``, 2026-11-16). The Krylov objective is opt-in and C++ only. ``88d1c7064`` changed the default from ``Auto`` to ``Dense``. ``quadraticDiagonal`` has two implementations and only the dense one is used. ``DenseCholeskySolver::quadraticDiagonal`` is the variance diagonal of the model: ``trainingSolver()`` in ``gpr/ml/GaussianProcessRegression.h`` always returns a ``DenseCholeskySolver``, and it is called from ``calculateVariance`` in ``gpr/ml/gp/Variance.cpp``, ``tryGateEnergyVariance`` in the same file, ``trainingInverseDiagonalInFactorLayout`` in ``gpr/ml/gp/Predict.cpp`` and ``tryActivePosteriorEnergyVariance`` in ``gpr/ml/gp/ActivePosterior.cpp``. With ``GPR_LINALG_SCALAPACK`` (the ``scalapack`` and ``slate`` branches of ``meson.build``) the ``quadraticDiagonal`` calls in ``calculateVariance`` and ``trainingInverseDiagonalInFactorLayout`` are compiled out: each sits in the ``#else`` of a ``GPR_LINALG_SCALAPACK`` test. ``calculateVariance`` replaces it with ``forward_solve_mat_colwise_squared_norm_distributed``. ``trainingInverseDiagonalInFactorLayout`` replaces it with ``cholesky_inverse_diagonal_distributed`` when the factor is distributed, and with an explicit triangular solve of the identity otherwise. The calls in ``tryGateEnergyVariance`` and ``tryActivePosteriorEnergyVariance`` stay in that build and run only for a factor that is not distributed: ``tryGateEnergyVariance`` returns through the distributed forward solve when ``training_cholesky_is_distributed_`` is set, and ``tryActivePosteriorEnergyVariance`` returns false in that case. The Krylov variant, ``KrylovCovarianceSolver::quadraticDiagonal``, and the Lanczos variance cache (LOVE) behind it, ``LanczosVarianceCache::quadraticDiagonal``, are built but unused: only ``tests/gpr/linalg/linop/KrylovTest.cpp`` calls them. ``CallbackOperator`` has no caller outside its own file. The layer has no CLI flag, TOML key, C function or Python name. **Use.** See :doc:`The covariance operator layer and Krylov solvers <../../howto/operator_layer>`. **Measured.** - The earlier branch ``improve/linop-core`` gave identical search counts to develop: "infrastructure only" (ledger 2026-11-13 17:58). - No search-level result is recorded for the landed layer. The 44-cell UMA gate named in the relaunch brief (ledger 2026-11-15) has no recorded numbers. The only 44-cell figures on develop describe the determinism gate: 44 cells and 1881 calls (``bench/linalg-backend-spec.md``). - The cost model refuses Krylov on the 16\_oxirane refit Gram matrix (order 820). The pivot residual traces are :math:`1.2\times10^{5}`, :math:`9.2\times10^{4}`, :math:`1.9\times10^{4}` and 802 at ranks 0, 100, 300 and 600, and the smallest eigenvalue is :math:`5.2\times10^{-4}`. "CG cannot beat the factor there, at any rank" (test comment in ``tests/gpr/linalg/linop/KrylovTest.cpp``). - The opposite regime plans Krylov: noise 10.0 and tolerance 10.0 plan it, noise :math:`10^{-6}` and tolerance :math:`10^{-3}` stay dense (``tests/gpr/ml/gp/ObjectiveBackendTest.cpp``). - Accuracy tests, not campaign results: the Krylov objective agrees with the dense one within 5 times the tolerance :math:`10^{-2}`, and the gradient within :math:`10^{-2}|g_{\mathrm{ref}}|` plus 5 times the tolerance (same test file). - The variance-diagonal memo in the dense solver was removed because "that O(n^2) compare and copy was pure host overhead" (``dd775d6dd``). No number is recorded. **Why it is not the default.** No benefit is recorded. The objective carries stochastic error. The Krylov path needs a dense covariance. It does not run in a ScaLAPACK or SLATE build: ``evaluateKrylovObjective`` and ``planObjectiveBackend`` inside ``evaluateEnergyFromGeometry``, and the Krylov branch of ``evaluateGradientWithGeometry``, are each inside ``#ifndef GPR_LINALG_SCALAPACK`` in ``gpr/ml/gp/EnergyGradient.cpp``, and the ``slate`` branch of ``meson.build`` defines that macro too. It also does not run with HS-SVD, with a manifold chart or geodesic heat kernel, with a nonzero kernel nugget or the principled nugget, with a correction term, with Hutchinson probes, or without a Gaussian likelihood: ``krylovAddedDiagonal`` in ``gpr/ml/gp/KrylovObjective.cpp`` returns no diagonal for each of them. The pivoted-Cholesky preconditioner ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **What it is.** A greedy partial Cholesky factor :math:`F` of the kernel part of :math:`K=A_0+\operatorname{diag}(s)` gives :math:`P=FF^{T}+\operatorname{diag}(s)`. :math:`K-P` is positive semi-definite, so the eigenvalues of :math:`P^{-1}K` lie in :math:`[1,\,1+\lambda_{\max}(E)/\min s]`. The cost model chooses the rank from the Schur residual trace of the last dense factor. **Status.** On develop, opt-in. It runs only inside the Krylov objective. No search-level benefit is recorded. Matrix-free PCG on the predict path ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **What it is.** A deterministic preconditioned CG (``gpr/linalg/IterativeSolver.h``) that replaces the Cholesky solves in the prediction weights. Inner products accumulate in ``long double``, so the iteration is bit-identical at every rank count. Convergence is declared only from an explicitly recomputed residual. A two-dimensional reproducer reports a recursive residual of :math:`8\times10^{-17}` while the true residual is :math:`2.6\times10^{-6}` (``dc8aa459b``). **Status.** On develop, opt-in at build time: ``-Dgp_predict_via_pcg=true``. The default is false. The preconditioner that remains is a replicated full Cholesky factor, which saves nothing ("Its cubic setup cost offers no factorization saving", ``gpr/ml/gp/Predict.cpp``). If PCG does not converge, the code falls back to the direct solve (``45a864817``). **Measured, not adopted.** On d016 with PET-MAD, PCG with the replicated factor needs 18 or 19 iterations and does not beat the Cholesky baseline (``f8e7a9a4e``). .. table:: +-------+----------------+--------------+-------------------+ | Ranks | PCG iterations | PCG wall (s) | Cholesky wall (s) | +=======+================+==============+===================+ | 1 | 18 | 57.62 | 57.05 | +-------+----------------+--------------+-------------------+ | 8 | 18 | 18.89 | 14.66 | +-------+----------------+--------------+-------------------+ | 16 | 19 | 34.03 | 12.62 | +-------+----------------+--------------+-------------------+ Five preconditioners failed on the d016 PET-MAD derivative kernel. The first three ran at :math:`N=430` (``9fa28ef56``). .. table:: +----------------------------------------------------------------------------+---------------------------------------------------+---------------+ | Preconditioner | Outcome | Source | +============================================================================+===================================================+===============+ | Nystrom, :math:`k=108` | dimer forces stuck at 21 and above | ``9fa28ef56`` | +----------------------------------------------------------------------------+---------------------------------------------------+---------------+ | Pivoted Cholesky, :math:`k=256`, tol :math:`10^{-8}` | forces oscillated between 11 and 12 | ``9fa28ef56`` | +----------------------------------------------------------------------------+---------------------------------------------------+---------------+ | Lanczos deflation, :math:`k=64` | forces fell slowly and did not converge tightly | ``9fa28ef56`` | +----------------------------------------------------------------------------+---------------------------------------------------+---------------+ | Lanczos deflation on the smallest Ritz values, :math:`k_{\mathrm{eff}}=32` | forces bounced between 0.5 and 6 | ``21cadced3`` | +----------------------------------------------------------------------------+---------------------------------------------------+---------------+ | Block Jacobi, 8 ranks | outer iteration 47 and not converged; baseline 18 | ``19e8393c0`` | +----------------------------------------------------------------------------+---------------------------------------------------+---------------+ **Why.** "K's spectrum on derivative-augmented GP kernels has too much mass beyond rank k for the low-rank Nystrom approximation to be a usable preconditioner" (``485c8b54d``). The eigenvalues span about 8 decades, so cutting the condition number from :math:`10^{6}` to :math:`10^{2}` needs the smallest :math:`0.7N` eigenvalues (``21cadced3``). The meson option text claims that PCG crosses the Cholesky factor near :math:`N\ge500`. No measurement in the history supports that sentence, and the table above contradicts it for the full factor. HODLR ----- **What it is.** A hierarchically off-diagonal low-rank factor of the kernel (binary tree, adaptive cross approximation on off-diagonal blocks, dense leaves). It replaced the dense factor for the solve, the log determinant and the trace of :math:`K^{-1}\,dK` (``e241aec30``, ``3a1e54150``). **Status.** Removed from develop. ``718a9f975`` (2026-04-29) mapped ``ApproxMode::HODLR`` to ``NONE``. ``d22aeeca8`` deleted the code: 35 files, 78 insertions, 5680 deletions. ``git grep -i hodlr`` on develop finds nothing. The old flag was ``--approx-mode hodlr``. **Measured.** - Gradient error against dense: 30 of 30 perturbations within 0.01 relative; maximum :math:`2.72\times10^{-13}` at :math:`n_{\mathrm{obs}}=14` (``f106292f7``). - Time for the Laplace Hessian, one sample (``5a314c8d3``): .. table:: +--------------+------+------------+------------+ | Observations | Rows | Dense (ms) | HODLR (ms) | +==============+======+============+============+ | 30 | 210 | 92 | 148 | +--------------+------+------------+------------+ | 100 | 700 | 1561 | 3442 | +--------------+------+------------+------------+ - The commit predicted a gain "at PETMAD scale (n\_obs >> 100)" and about 14 times cheaper at :math:`n=430` with rank 30 (``b8a33cef1``). That is a prediction. No end-to-end search time is recorded. **Why it was dropped.** No reason is recorded. ``718a9f975`` and ``d22aeeca8`` have empty bodies. The follow-up commits kept Laplace prediction, the INLA Hessian and the optimiser on the exact backend. Later measurements show that the derivative kernel has a flat spectrum, so the off-diagonal blocks do not compress (see the Route 2 and Route 3 sections below). Nystrom subset-of-data ---------------------- **What it is.** A Williams-Seeger Nystrom approximation :math:`Q=K_{nm}K_{mm}^{-1}K_{nm}^{T}` with :math:`m` inducing rows chosen by farthest-point sampling. The Woodbury identity reduces the solve to an :math:`m\times m` factor (``1f070bcbd``). **Status.** Removed from develop by ``d22aeeca8``, with ``--approx-mode nystrom`` and ``--nystrom-rank``. The name survives in unrelated code: the pivoted Cholesky solver, the sketched L-BFGS start matrix and the IRC Hessian sketch. **Measured.** The record holds a cost table and exactness tests at :math:`m=n` only. No wall time or error at :math:`m ~1.7 s, trainstep ~16.1 s -> ~7.2 s" at :math:`N=400`. It was reverted in ``7c060fd8a``, and no reason is recorded. Reading the evidence together ----------------------------- Every low-rank or sparse route above ran into the same fact. The derivative-augmented kernel of the inverse-distance descriptor has a flat spectrum, a nearly full numerical rank and a dense inverse factor. The recorded checks of that fact are the Route 2 and Route 3 numbers, the D-SKIP rank, the PCG preconditioner failures and the HS-SVD mode counts. They hold for the systems measured: d016 with 14 atoms, the :math:`N=430` kernel of the PCG study, and the cells behind the ledger entries. They do not prove the same for a different descriptor or a much larger system. The :doc:`decision table <../../howto/choose_solver>` says which regime has a measurement and which has none.