.. index:: pair: class; gpr::StableBasisND .. _doxid-classgpr_1_1_stable_basis_n_d: class gpr::StableBasisND ======================== .. toctree:: :hidden: struct_gpr_StableBasisND_AffineVariancePrior.rst struct_gpr_StableBasisND_BorderedCacheState.rst struct_gpr_StableBasisND_BorderedFactorCache.rst struct_gpr_StableBasisND_BorderedRmCache.rst struct_gpr_StableBasisND_SchurFloorReport.rst struct_gpr_StableBasisND_TrainingNoiseReport.rst Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class StableBasisND { public: // structs struct :ref:`AffineVariancePrior`; struct :ref:`BorderedCacheState`; struct :ref:`BorderedFactorCache`; struct :ref:`BorderedRmCache`; struct :ref:`SchurFloorReport`; struct :ref:`TrainingNoiseReport`; // construction :target:`StableBasisND`(); :target:`StableBasisND`(std::shared_ptr<:ref:`linalg::BackendContext`> context); // methods void :ref:`setChopNoiseVariance`(double sigma2); double :target:`chopNoiseVariance`() const; double :ref:`droppedEigenvalueMax`() const; double :ref:`covarianceComplementEigenvalue`() const; double :ref:`complementWeight`(double sigma2) const; double :ref:`covarianceComplementWeight`(double sigma2) const; void :target:`recordDroppedSpectrum`(const Eigen::VectorXd& S); void :target:`factorize`(const Eigen::MatrixXd& X, const Eigen::VectorXd& eps, double alpha, int max_degree, bool gradient_enhanced, double sv_rtol = 1e-13); void :target:`factorizeGPCartesian`(const Eigen::MatrixXd& X, const Eigen::VectorXd& eps, double alpha, double overall_scale, int max_degree, const std::vector& jacobians, bool component_major = false, double sv_rtol = 1e-13, int sketch_size = 0, int n_power_iter = 2, double mode_prune_rtol = 0.0, double sv_abs_tol = 0.0); void :target:`factorizeGPCartesianAffine`(const Eigen::MatrixXd& U, const Eigen::VectorXd& eps, double alpha, double overall_scale, int max_degree, const std::vector& jac_tangent, const std::vector& jac_normal, bool component_major = false, double sv_rtol = 1e-13, int sketch_size = 0, int n_power_iter = 2, double mode_prune_rtol = 0.0, double sv_abs_tol = 0.0); void :target:`factorizeKernel`(const Eigen::MatrixXd& kernel, double sv_rtol = 1e-13, double sv_abs_tol = 0.0, double sv_chop_tol = 0.0); bool :target:`factorizeKernelLapackRrr`(const Eigen::MatrixXd& kernel, double sv_rtol = 1e-13, double sv_abs_tol = 0.0, double sv_chop_tol = 0.0, bool allow_value_range = false); void :target:`factorizeNoisyKernel`(const Eigen::MatrixXd& noisy_kernel, double sigma2); bool :target:`factorizeNoisyKernelLapackRrr`(const Eigen::MatrixXd& noisy_kernel, double sigma2); void :target:`factorizeKernelRandomized`(const Eigen::MatrixXd& kernel, int sketch_size, int n_power_iter = 2, double sv_rtol = 1e-13, double sv_abs_tol = 0.0, double sv_chop_tol = 0.0); void :target:`liftFromDeflatedSubspace`(Eigen::Index full_rows, Eigen::MatrixXd lifted_psi, const detail::RigidDeflationState& deflation, double extra_assembly_error = 0.0); bool :target:`factorizeKernelAppend`(const :ref:`StableBasisND`& old_basis, const Eigen::MatrixXd& cross_old_new, const Eigen::MatrixXd& new_kernel, double sv_rtol = 1e-13, double sv_abs_tol = 0.0, double sv_chop_tol = 0.0); Eigen::VectorXd :target:`solve`(const Eigen::VectorXd& y) const; Eigen::VectorXd :target:`predictEnergy`(const Eigen::MatrixXd& Xstar, const Eigen::VectorXd& b) const; Eigen::MatrixXd :target:`predictGradient`(const Eigen::MatrixXd& Xstar, const Eigen::VectorXd& b) const; Eigen::VectorXd :target:`solveNoisy`(const Eigen::VectorXd& y, double sigma2) const; Eigen::VectorXd :target:`noisySelfQuadratic`(const Eigen::MatrixXd& rhs, double sigma2) const; Eigen::VectorXd :target:`noisyRangeSelfQuadratic`(const Eigen::MatrixXd& rhs, double sigma2) const; Eigen::VectorXd :ref:`stableRangePosteriorDiagonal`(const Eigen::MatrixXd& rhs, const Eigen::VectorXd& prior, const Eigen::VectorXd& signal, double sigma2, bool check_variance = true) const; std::vector<:ref:`BorderedVarianceInterval`> :ref:`noisyBorderedVarianceIntervals`(const Eigen::MatrixXd& rhs, const Eigen::VectorXd& prior_diag, double sigma2) const; std::vector<:ref:`BorderedVarianceInterval`> :ref:`noisyBorderedVarianceIntervals`(const Eigen::MatrixXd& rhs, const Eigen::VectorXd& prior_diag, double sigma2, :ref:`BorderedSchurSign` sign) const; :ref:`BorderedNoiseReport` :ref:`borderedNoiseReport`(double sigma2) const; :ref:`BorderedNoiseReport` :ref:`borderedNoiseReport`(double sigma2, double output_variance_scale) const; :ref:`BorderedNoiseReport` :ref:`borderedNoiseReport`(double sigma2, double y_scale, double calibration) const; :ref:`SchurFloorReport` :ref:`floorCertifiedSchurDiagonal`(const Eigen::MatrixXd& cross, const Eigen::VectorXd& prior, double sigma2, Eigen::VectorXd& value, const std::vector* skip = nullptr) const; double :ref:`trainingRowLatentErrorBound`(Eigen::Index row, double sigma2) const; Eigen::Index :target:`borderedKernelOrder`() const; bool :ref:`supportsBorderedVarianceInterval`() const; Eigen::VectorXd :target:`noisyInverseDiagonal`(double sigma2) const; Eigen::VectorXd :target:`noisyInverseDiagonalEntries`(const Eigen::VectorXi& rows, double sigma2) const; double :target:`leaveOneOutNegativeLogPredictiveDensity`(const Eigen::VectorXd& y, double sigma2) const; double :target:`computeVarianceCalibrationFactor`(const Eigen::VectorXd& y, double sigma2) const; Eigen::VectorXd :target:`noisyInverseSandwichDiagonal`(const Eigen::MatrixXd& dK, double sigma2) const; double :target:`leaveOneOutNegativeLogPredictiveDensityDirectionalDerivative`(const Eigen::VectorXd& y, double sigma2, const Eigen::MatrixXd& dK) const; Eigen::MatrixXd :target:`noisyInverse`(double sigma2) const; double :target:`leaveOneOutNegativeLogPredictiveDensityGrouped`(const Eigen::VectorXd& y, double sigma2, const std::vector>& groups) const; double :target:`leaveOneOutNegativeLogPredictiveDensityGroupedDirectionalDerivative`(const Eigen::VectorXd& y, double sigma2, const Eigen::MatrixXd& dK, const std::vector>& groups) const; Eigen::VectorXd :target:`posteriorMeanReducedCoeffs`(const Eigen::VectorXd& y, double sigma2) const; :ref:`StableBasisPosteriorWeights` :target:`noisyPosteriorWeights`(const Eigen::VectorXd& y, double sigma2) const; double :target:`logDetNoisy`(double sigma2) const; Eigen::VectorXd :target:`posteriorMeanWeights`(const Eigen::VectorXd& alpha) const; Eigen::VectorXd :target:`posteriorMeanEnergy`(const Eigen::MatrixXd& Xstar, const Eigen::VectorXd& alpha) const; Eigen::MatrixXd :target:`posteriorMeanGradient`(const Eigen::MatrixXd& Xstar, const Eigen::VectorXd& alpha) const; Eigen::VectorXd :target:`posteriorVarianceEnergy`(const Eigen::MatrixXd& Xstar, double sigma2) const; Eigen::VectorXd :ref:`posteriorVarianceDiagonal`(const Eigen::MatrixXd& cross, const Eigen::VectorXd& prior, double sigma2) const; Eigen::MatrixXd :ref:`posteriorCovariance`(const Eigen::MatrixXd& cross, const Eigen::MatrixXd& prior, double sigma2) const; double :ref:`posteriorVarianceAction`(const Eigen::MatrixXd& cross, const Eigen::MatrixXd& prior, const Eigen::VectorXd& weights, double sigma2) const; Eigen::VectorXd :target:`predictEnergyAffine`(const Eigen::MatrixXd& Ustar, const Eigen::MatrixXd& residuals, const Eigen::VectorXd& b) const; Eigen::VectorXd :target:`energyAffineDesignRow`(const Eigen::MatrixXd& Ustar, const Eigen::MatrixXd& residuals) const; Eigen::MatrixXd :target:`predictGradientAffine`(const Eigen::MatrixXd& Ustar, const Eigen::MatrixXd& residuals, const Eigen::MatrixXd& basis, const Eigen::VectorXd& b) const; Eigen::MatrixXd :target:`predictGradientHessianVectorAffine`(const Eigen::MatrixXd& Ustar, const Eigen::MatrixXd& residuals, const Eigen::MatrixXd& basis, const Eigen::MatrixXd& tangent_directions, const Eigen::MatrixXd& residual_directions, const Eigen::VectorXd& b) const; Eigen::VectorXd :target:`posteriorVarianceEnergyAffine`(const Eigen::MatrixXd& Ustar, const Eigen::MatrixXd& residuals, double sigma2) const; double :target:`conditionNumber`() const; double :ref:`conditionFlooredNoise`(double sigma2) const; double :ref:`varianceFlooredNoise`(double sigma2) const; int :target:`rank`() const; bool :target:`usedLapackRrrValueRange`() const; const char* :target:`lastKernelFactorizeDriver`() const; int :ref:`lapackRrrFullSolvesForTesting`() const; int :target:`lapackRrrExtensionsForTesting`() const; bool :target:`usedLapackRrrValueRangeForTesting`() const; bool :target:`usedFastKernelEigensolverForTesting`() const; int :target:`borderedFactorBuildsForTesting`() const; void :ref:`assumeExtendedCertificationForTesting`(bool available); void :ref:`setRetainedSpectrumForTesting`(Eigen::MatrixXd psi, Eigen::VectorXd singular_values); Eigen::MatrixXd :target:`energyDesignForTesting`(const Eigen::MatrixXd& Xstar) const; Eigen::MatrixXd :target:`affineEnergyDesignForTesting`(const Eigen::MatrixXd& Ustar, const Eigen::MatrixXd& residuals, Eigen::VectorXd& kself) const; Eigen::VectorXd :ref:`rangeVarianceFromDesignForTesting`(const Eigen::MatrixXd& A_E, double sigma2) const; const Eigen::MatrixXd& :target:`trainingDesignForTesting`() const; void :ref:`borderedEpsKForTesting`(double& hi, double& lo, int& operations) const; const Eigen::MatrixXd& :ref:`borderedKernelForTesting`() const; double :target:`borderedAssemblyErrorForTesting`() const; bool :target:`hasCrossCovariance`() const; int :target:`numBasis`() const; Eigen::Index :target:`numObs`() const; const Eigen::MatrixXd& :target:`leftSingularVectors`() const; const Eigen::VectorXd& :target:`singularValues`() const; const Eigen::VectorXd& :target:`noisyEigenvalues`() const; bool :target:`hasNoisyEigenvalues`() const; bool :target:`permuteObservationRows`(const Eigen::VectorXi& source_for_target); Eigen::MatrixXd :target:`reconstructKernel`(bool truncated) const; void :target:`eigenTensorEpsDerivative`(const Eigen::MatrixXd& X, int j, Eigen::MatrixXd& Phi, Eigen::MatrixXd& dPhi_eps) const; static std::size_t :ref:`factorizationCount`(); static :ref:`SchurFloorReport` :ref:`schurFloorTotals`(); static void :target:`resetSchurFloorTotals`(); static double :ref:`floorLatentVariance`(double latent, double error_bound, :ref:`SchurFloorReport`* report); static Eigen::Index :target:`standardChop`(const Eigen::VectorXd& coeffs, double tol); static int :target:`autoMaxDegree`(const Eigen::VectorXd& eps, double alpha, int dim, double target_tol, int max_degree_cap = 40); static bool :target:`gradedModeCountExceedsLimit`(int dim, int max_degree, Eigen::Index limit); static int :target:`capMaxDegreeByModeCount`(int dim, int requested_degree, Eigen::Index mode_limit); static Eigen::MatrixXd :target:`affineSpanBasis`(const Eigen::MatrixXd& centered_X); static void :target:`projectToAffineSpan`(const Eigen::MatrixXd& centered_X, const Eigen::MatrixXd& basis, Eigen::MatrixXd& coords, Eigen::MatrixXd& residuals); static double :ref:`conditionFlooredSigma2ForTesting`(const Eigen::VectorXd& singular_values, double sigma2, Eigen::Index nobs); static int :ref:`designVarianceWorkingDigitsForTesting`(); static long long :ref:`latentVarianceOperationDepthForTesting`(Eigen::Index rank); }; .. _details-classgpr_1_1_stable_basis_n_d: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Methods ------- .. index:: pair: function; setChopNoiseVariance .. _doxid-classgpr_1_1_stable_basis_n_d_1ac29ca7498d3c1b931483f068ce4c070b: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setChopNoiseVariance(double sigma2) Likelihood variance (noise + jitter) the plateau chop must respect: a component with s^2 > chop_tol \* sigma2 is never dropped, because its removal perturbs (K + sigma2 I)^-1 by s^2/sigma2 relative. .. index:: pair: function; droppedEigenvalueMax .. _doxid-classgpr_1_1_stable_basis_n_d_1a24c39b46f3658e5a781cf4bf6e6fed2c: .. ref-code-block:: cpp :class: doxyrest-title-code-block double droppedEigenvalueMax() const Largest eigenvalue discarded by the last truncation (0 when none). .. index:: pair: function; covarianceComplementEigenvalue .. _doxid-classgpr_1_1_stable_basis_n_d_1a29aaa6021291e1ef3657cb3315fa54c0: .. ref-code-block:: cpp :class: doxyrest-title-code-block double covarianceComplementEigenvalue() const Largest signal eigenvalue represented by the discarded covariance complement. A complement below the eigensolver's backward-error threshold is the null space of the retained model and therefore has eigenvalue zero. .. index:: pair: function; complementWeight .. _doxid-classgpr_1_1_stable_basis_n_d_1aaeff3b1bd1da24d9fe20fba0293e6cbe: .. ref-code-block:: cpp :class: doxyrest-title-code-block double complementWeight(double sigma2) const Weight of the complement (I - Psi Psi^T) in (K + sigma2 I)^-1: 1/(dropped_s2_max + sigma2), the lower end of the exact range. .. index:: pair: function; covarianceComplementWeight .. _doxid-classgpr_1_1_stable_basis_n_d_1a5b00391df01f696400d0b62ec82e5894: .. ref-code-block:: cpp :class: doxyrest-title-code-block double covarianceComplementWeight(double sigma2) const Complement weight for posterior covariance: 1/(max(dropped_s2_max, n eps s2_max) + sigma2). A dropped eigenvalue below the resolution n eps s2_max is recorded as zero, so complementWeight gives it 1/sigma2. That overshoots its exact weight 1/(s2 + sigma2) by s2/sigma2 relative, which is O(1) once sigma2 sits at the condition floor (itself ~ n eps s2_max). A joint covariance K - K\* W K\* with W above (K + sigma2 I)^-1 in any direction is indefinite, and the training-row identity sigma2 I - sigma2^2 W pairs a zero complement variance with a nonzero mixed entry. Bounding the dropped spectrum by the resolution keeps W <= (K + sigma2 I)^-1: every covariance block then conditions the prior Psi S^2 Psi^T + (1/w_c - sigma2)(I - Psi Psi^T) >= K on the same observations. The bound is fixed by the factorization, not by the eigensolver's rounding, so it does not move between evaluations. .. index:: pair: function; stableRangePosteriorDiagonal .. _doxid-classgpr_1_1_stable_basis_n_d_1a3d7c77b513602d5f74ce08fda1ce9aab: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd stableRangePosteriorDiagonal(const Eigen::MatrixXd& rhs, const Eigen::VectorXd& prior, const Eigen::VectorXd& signal, double sigma2, bool check_variance = true) const Range-only posterior diagonal as a nonnegative eigenmode sum. The value is prior_j - z_j^T diag(1/(S^2+sigma2)) z_j with z_j = Psi^T rhs_j, the contraction noisyRangeSelfQuadratic subtracts, evaluated as the unresolved tail prior_j - norm(S^-1 z_j)^2 plus the noise-damped terms sigma2/(S^2+sigma2) (S^-1 z_j)^2 in ExactSum. signal_j is the variance of the diagonal that entered the sum and sets the roundoff allowance of :ref:`linalg::requireStablePosteriorVariance `. sigma2 is floored through varianceFlooredNoise. A shape mismatch or a non-positive noise floor throws :ref:`linalg::StableVarianceError `. Callers that replace training-row channels with their latent identity defer the finite/nonnegative check until after that replacement. .. index:: pair: function; noisyBorderedVarianceIntervals .. _doxid-classgpr_1_1_stable_basis_n_d_1ac7553f2b6114ee8155a8a522878847bf: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector<:ref:`BorderedVarianceInterval`> noisyBorderedVarianceIntervals(const Eigen::MatrixXd& rhs, const Eigen::VectorXd& prior_diag, double sigma2) const Two-sided variational Schur variance intervals [lower, upper] for s_j = prior_diag(j) - rhs_j^T (K + sigma2 I)^(-1) rhs_j. Requires a stored kernel and a strictly positive certified minimum eigenvalue mu_min of M = K + sigma2 I at the condition-floored noise. The default entry point clamps a negative lower endpoint to zero when the upper endpoint is nonnegative and throws std::runtime_error when the upper endpoint is negative or M cannot be certified. sigma2 is floored through conditionFlooredNoise, the noise the mean, log-determinant and LOO routes invert, so M is the matrix the trained factor used. Endpoints are rounded outward to binary64. .. index:: pair: function; noisyBorderedVarianceIntervals .. _doxid-classgpr_1_1_stable_basis_n_d_1a251f3ca314b8c56ef7307e16a4449cf5: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector<:ref:`BorderedVarianceInterval`> noisyBorderedVarianceIntervals(const Eigen::MatrixXd& rhs, const Eigen::VectorXd& prior_diag, double sigma2, :ref:`BorderedSchurSign` sign) const Same enclosure. PreserveSigned keeps a negative Schur value. .. index:: pair: function; borderedNoiseReport .. _doxid-classgpr_1_1_stable_basis_n_d_1ad43adb9f61df51db732a8af59b0f6fb3: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`BorderedNoiseReport` borderedNoiseReport(double sigma2) const Condition-floored noise for the requested sigma2, the certificate gap of the stored kernel factor and the noise the interval certifies. Builds (and caches) the factor, and throws BorderedVarianceError when it cannot be built. .. index:: pair: function; borderedNoiseReport .. _doxid-classgpr_1_1_stable_basis_n_d_1a5fb6f0781f2d0e44e0baaef5b29c6cdb: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`BorderedNoiseReport` borderedNoiseReport(double sigma2, double output_variance_scale) const The same report in the units of an output frame scaled by ``output_variance_scale`` (a positive finite factor, y_scale^2). The certificate is decided after scaling, from the scaled endpoints: ``floored`` is rounded down and ``certificate_gap`` up to binary64, so ``certified`` holds exactly when the reported floored exceeds the reported gap. A unit gap that survives in training units can collapse under the multiply and is then not certified. ``requested`` is rounded down like ``floored``, so ``floored >= requested`` still holds, and ``interval`` equals ``floored``. .. index:: pair: function; borderedNoiseReport .. _doxid-classgpr_1_1_stable_basis_n_d_1a2e4cfa9fd9161f3a226bd669359e0141: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`BorderedNoiseReport` borderedNoiseReport(double sigma2, double y_scale, double calibration) const The same report for the output frame y_scale^2 \* calibration, with the scale kept in the working type: it is the outward-rounded enclosure [lower, upper] of y_scale^2 \* calibration (varianceScaleEnclosure), not a binary64 y_scale \* y_scale. ``floored`` and ``requested`` are rounded down through lower, ``certificate_gap`` up through upper, so the certificate is the strict comparison of the reported endpoints and agrees with the energy variance interval gate. Throws BorderedVarianceError when the enclosure is not positive and finite. .. index:: pair: function; floorCertifiedSchurDiagonal .. _doxid-classgpr_1_1_stable_basis_n_d_1a683c884dbe2fe3ae45834a54c25838bf: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`SchurFloorReport` floorCertifiedSchurDiagonal(const Eigen::MatrixXd& cross, const Eigen::VectorXd& prior, double sigma2, Eigen::VectorXd& value, const std::vector* skip = nullptr) const ``value(j)`` is a computed Schur diagonal prior(j) - cross_j^T (K + sigma2 I)^(-1) cross_j. Nonnegative entries are untouched; no entry is left negative or NaN. A negative entry is replaced by the smallest nonnegative value of the outward-rounded bordered enclosure of that same quantity: 0 where the enclosure contains zero (lower <= 0 <= upper, counted as floored), and the lower endpoint where it is entirely positive (counted as raised). Where the enclosure is entirely negative the entry becomes +inf and counts as proven negative. A NaN or -inf entry, and a negative one without an enclosure, becomes +inf and counts as uncertified. ``skip``, when given, has one flag per entry. A flagged entry has already been replaced by another certified formula (the latent training-row variance), so it is neither floored nor counted: the counts describe the entries that remain in ``value``. .. index:: pair: function; trainingRowLatentErrorBound .. _doxid-classgpr_1_1_stable_basis_n_d_1a9c4ca8f1c3b87dff7c8cf5b0cc4e2e25: .. ref-code-block:: cpp :class: doxyrest-title-code-block double trainingRowLatentErrorBound(Eigen::Index row, double sigma2) const Upper bound on the binary64 rounding error of the training-row latent variance eta2 - eta2^2 q(row), q the diagonal of (K_r + eta2 I)^-1 assembled from the retained spectrum. It includes the departure of the retained row from unit norm, which the nonnegativity of the latent variance assumes. Infinite when it cannot be bounded. .. index:: pair: function; supportsBorderedVarianceInterval .. _doxid-classgpr_1_1_stable_basis_n_d_1aa6bdc35c8d13cced780716ea952f1e96: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool supportsBorderedVarianceInterval() const Whether this factorization retained the exact assembled kernel needed by noisyBorderedVarianceIntervals. Design-only factorizations are not eligible for certification. .. index:: pair: function; posteriorVarianceDiagonal .. _doxid-classgpr_1_1_stable_basis_n_d_1a28bf137669fe9dcfb5b375adb5d007c1: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd posteriorVarianceDiagonal(const Eigen::MatrixXd& cross, const Eigen::VectorXd& prior, double sigma2) const Cancellation-free posterior diagonal for arbitrary query channels. Each entry is one ExactSum of the nonnegative unresolved tail and the noise-damped retained and resolved-complement eigenmode terms, at the noise varianceFlooredNoise(sigma2). A null complement leaves the query's residual in the unresolved tail. An entry the rounded basis cannot represent as nonnegative is NaN; callers reject it with :ref:`linalg::requireStablePosteriorVariance ` after any training-row identity is applied. A shape mismatch or a non-positive noise floor throws :ref:`linalg::StableVarianceError `. .. index:: pair: function; posteriorCovariance .. _doxid-classgpr_1_1_stable_basis_n_d_1a96894c32d0e984f394000ae7dc367071: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd posteriorCovariance(const Eigen::MatrixXd& cross, const Eigen::MatrixXd& prior, double sigma2) const Joint posterior covariance from the same exact eigenmode sums. Off-diagonal entries share the diagonal's unresolved-tail and noise-damped mode decomposition, so linear actions and covariance blocks describe one posterior. The diagonal is posteriorVarianceDiagonal and is not projected; stabilizePosteriorCovariance makes the matrix positive semidefinite once the caller has validated it. Throws :ref:`linalg::StableVarianceError ` like posteriorVarianceDiagonal. .. index:: pair: function; posteriorVarianceAction .. _doxid-classgpr_1_1_stable_basis_n_d_1a5a095325ab531a9240a8a9ca576c4149: .. ref-code-block:: cpp :class: doxyrest-title-code-block double posteriorVarianceAction(const Eigen::MatrixXd& cross, const Eigen::MatrixXd& prior, const Eigen::VectorXd& weights, double sigma2) const Variance of a linear action on a joint query covariance, evaluated by the same nonnegative eigenmode decomposition. Returns NaN when the rounded basis cannot represent the action as nonnegative and throws :ref:`linalg::StableVarianceError ` on a shape mismatch or a non-positive noise floor. .. index:: pair: function; conditionFlooredNoise .. _doxid-classgpr_1_1_stable_basis_n_d_1ad8a2f3406da59f3fb05425839771e2a6: .. ref-code-block:: cpp :class: doxyrest-title-code-block double conditionFlooredNoise(double sigma2) const Condition-floored likelihood noise for this basis' retained spectrum: the same floor every mean/logdet/LOO/variance path applies, exposed so external covariance assembly inverts the SAME regularized operator. .. index:: pair: function; varianceFlooredNoise .. _doxid-classgpr_1_1_stable_basis_n_d_1a2d24e6c132c30d0e4d9d5a9dea343303: .. ref-code-block:: cpp :class: doxyrest-title-code-block double varianceFlooredNoise(double sigma2) const Variance-specific likelihood-noise floor for the retained spectrum. With the stable posterior variance on, the floor resolves one squared eigenvalue to eps\*s2_max and does not grow with the observation count, because the stable variances are nonnegative eigenmode sums reduced exactly. Inverse, mean, log-determinant, LOO and the training-row identity keep conditionFlooredNoise, the n\*eps floor of their rounded observation-space projector. With the option off this equals conditionFlooredNoise. .. index:: pair: function; lapackRrrFullSolvesForTesting .. _doxid-classgpr_1_1_stable_basis_n_d_1a3725a86d8c6c7179ae6a88cb53c95f5e: .. ref-code-block:: cpp :class: doxyrest-title-code-block int lapackRrrFullSolvesForTesting() const Full DSYEVR calls. A repeated kernel and a bordered extension of a cached spectrum do not increment this. .. index:: pair: function; assumeExtendedCertificationForTesting .. _doxid-classgpr_1_1_stable_basis_n_d_1afbf6ee6fbfbdac9511859dd0ae897091: .. ref-code-block:: cpp :class: doxyrest-title-code-block void assumeExtendedCertificationForTesting(bool available) Force the extended-precision certificate off, or back on. On cannot succeed where the platform has neither an extended long double nor IEEE binary64 for the double-double fallback. Clears the factor cache. .. index:: pair: function; setRetainedSpectrumForTesting .. _doxid-classgpr_1_1_stable_basis_n_d_1ae27e2b4d94568e1251fe29afd1de7168: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setRetainedSpectrumForTesting(Eigen::MatrixXd psi, Eigen::VectorXd singular_values) Install a caller-built retained basis and spectrum, so a test can give the projection a basis whose columns have lost orthogonality. Only the range variance reductions, which read Psi\_ and Sr\_, are meaningful afterwards; every cached factorization is dropped. .. index:: pair: function; rangeVarianceFromDesignForTesting .. _doxid-classgpr_1_1_stable_basis_n_d_1acf92383970ca4cbd27be1b6f2ad9d37b: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd rangeVarianceFromDesignForTesting(const Eigen::MatrixXd& A_E, double sigma2) const The design variance of the rows of A_E at sigma2, and the retained training design it contracts against. .. index:: pair: function; borderedEpsKForTesting .. _doxid-classgpr_1_1_stable_basis_n_d_1a1248826c08fef0dc32e9a92a2aaff642: .. ref-code-block:: cpp :class: doxyrest-title-code-block void borderedEpsKForTesting(double& hi, double& lo, int& operations) const The bordered factor's eps_K as hi + lo binary64 limbs, and the number of rounded operations the directed margin on it counts. .. index:: pair: function; borderedKernelForTesting .. _doxid-classgpr_1_1_stable_basis_n_d_1a66c7596820278c8b3983d3dcbd8fc78d: .. ref-code-block:: cpp :class: doxyrest-title-code-block const Eigen::MatrixXd& borderedKernelForTesting() const The exact stored kernel and its binary64 assembly error bound, the two inputs eps_K is derived from. .. index:: pair: function; factorizationCount .. _doxid-classgpr_1_1_stable_basis_n_d_1ac92fd0f7aecc2b7d1502715067e72817: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::size_t factorizationCount() Process-wide count of kernel eigenfactorizations (full and append), the O(m^3) operations of this backend; read per outer iteration by the driver's report line. .. index:: pair: function; schurFloorTotals .. _doxid-classgpr_1_1_stable_basis_n_d_1a302ba5d3498410c7c3cd1161e9fbe41a: .. ref-code-block:: cpp :class: doxyrest-title-code-block static :ref:`SchurFloorReport` schurFloorTotals() Process-wide totals of :ref:`SchurFloorReport ` over every call. .. index:: pair: function; floorLatentVariance .. _doxid-classgpr_1_1_stable_basis_n_d_1a58f9d16ff8c760e2980a6249e8365d9d: .. ref-code-block:: cpp :class: doxyrest-title-code-block static double floorLatentVariance(double latent, double error_bound, :ref:`SchurFloorReport`* report) Floors a computed latent variance. A nonnegative value, +inf included, is returned as is. A negative value whose error bound reaches 0 is roundoff and becomes 0. One whose bound stays negative is proven negative and becomes +inf. A NaN or -inf value, or a negative one whose bound is NaN, infinite or negative, has no certificate: it becomes +inf and counts as uncertified. .. index:: pair: function; conditionFlooredSigma2ForTesting .. _doxid-classgpr_1_1_stable_basis_n_d_1a0269d35a398728c06cb568815265a630: .. ref-code-block:: cpp :class: doxyrest-title-code-block static double conditionFlooredSigma2ForTesting(const Eigen::VectorXd& singular_values, double sigma2, Eigen::Index nobs) The condition floor of a descending singular spectrum, as conditionFlooredNoise computes it from the retained one. .. index:: pair: function; designVarianceWorkingDigitsForTesting .. _doxid-classgpr_1_1_stable_basis_n_d_1a3ff420025eba018db15789357889eb2f: .. ref-code-block:: cpp :class: doxyrest-title-code-block static int designVarianceWorkingDigitsForTesting() Significand digits of the working type the design-variance accumulation runs in. .. index:: pair: function; latentVarianceOperationDepthForTesting .. _doxid-classgpr_1_1_stable_basis_n_d_1a70c10660cec61cc72d2f1c55d5fd375d: .. ref-code-block:: cpp :class: doxyrest-title-code-block static long long latentVarianceOperationDepthForTesting(Eigen::Index rank) Operations a term of the training-row latent variance passes through, which trainingRowLatentErrorBound scales the unit roundoff by.