Classes | |
| struct | DerivativeOptions |
| Options for batched posterior derivative primitives. More... | |
| struct | DerivativeReport |
| Report returned by a batched posterior derivative primitive. More... | |
Typedefs | |
| using | HessianAction |
| Exact Hessian-vector-product callback at a fixed point: writes H(x) * v into hv and returns true on success. | |
Enumerations | |
| enum class | DerivativeStatus { Ok , InvalidArgument , NotTrained , Unsupported , OutOfSupport } |
| Outcome of a derivative primitive. The C API maps each value to one status code; nothing here returns a NaN in place of a failure. More... | |
| enum class | EnergyUnit { Native = 0 , Ev = 1 , Hartree = 2 , KcalPerMol = 3 , KjPerMol = 4 } |
| Unit tags carried through the primitives. They name the units the GP was trained in; no value is converted. More... | |
| enum class | LengthUnit { Native = 0 , Angstrom = 1 , Bohr = 2 , Nanometer = 3 } |
| Length unit tags carried through the derivative primitives. More... | |
Functions | |
| std::optional< double > | roundoffVariance (double variance, double prior_scale) noexcept |
| variance when it is finite and nonnegative, zero when it is negative by at most kNegativeVarianceTolerance * prior_scale, and empty otherwise. An empty result is refused with Unsupported by every primitive: a materially negative variance is never in support and never a converged spread. A prior_scale that is not finite and positive admits no negative value. | |
| Eigen::MatrixXd | rigidGenerators (const Eigen::VectorXd &positions) |
| Unit rigid generators of 3N coordinates as columns: three translations, then rotations about the x, y and z axes through the centroid. A rotation that does not move any atom (one atom, or an axis a linear geometry lies on) is a zero column. | |
| Eigen::MatrixXd | rigidProjector (const Eigen::VectorXd &positions, const AtomsConfiguration &config) |
| Orthogonal projector onto the physical vibrational complement of the rigid motions of positions under config. | |
| Eigen::MatrixXd | rigidProjector (const Eigen::VectorXd &positions) |
| I - Q Q^T for an orthonormal basis Q of the nonzero rigid generators. | |
| DerivativeReport | meanHessians (GaussianProcessRegression &gp, const Eigen::MatrixXd &points, const DerivativeOptions &options, std::vector< Eigen::MatrixXd > &hessians, Eigen::MatrixXd *residuals=nullptr) |
| Full posterior-mean Hessians at the rows of points, symmetrized. residuals, when given, receives one row per point: ||H t|| for the six unit generators of rigidGenerators, -1 where a generator vanishes. | |
| DerivativeReport | meanHessianActions (GaussianProcessRegression &gp, const Eigen::MatrixXd &points, const std::vector< Eigen::MatrixXd > &directions, const DerivativeOptions &options, std::vector< Eigen::MatrixXd > &actions) |
| Posterior-mean Hessian actions. directions[b] holds k rows, each one vector at point b; actions[b] receives H(x_b) v as the same k rows. | |
| DerivativeReport | hessianBilinearCovariance (GaussianProcessRegression &gp, const Eigen::MatrixXd &points, const std::vector< Eigen::MatrixXd > &left, const std::vector< Eigen::MatrixXd > &right, const DerivativeOptions &options, std::vector< Eigen::MatrixXd > &covariance) |
| Posterior covariance of M_ij = v_i^T H w_j at each point. left[b] holds the v_i as rows and right[b] the w_j. covariance[b] is (kl kr)^2 with entry index i * kr + j. The curvature is the central difference of the posterior gradient process along each w_j, so this is the covariance of that stencil: a probabilistic estimate with O(h^2) truncation in variance_step, not a bound. Forms the 2 kr (d + 1) joint posterior covariance block per point (O(kr^2 d^2) memory). The three Hessian uncertainty functions refuse with Unsupported, outputs untouched, when a result overflows, is NaN, or flushes a nonzero value below the normal double range (direction norms far from 1 scale it by their fourth power). | |
| DerivativeReport | hessianBilinearVariances (GaussianProcessRegression &gp, const Eigen::MatrixXd &points, const std::vector< Eigen::MatrixXd > &directions, const DerivativeOptions &options, std::vector< Eigen::VectorXd > &variances) |
| Diagonal posterior variances of v_i^T H v_i at each point. Computes one stencil functional at a time, avoiding a k^2 covariance matrix when callers need only each mode's variance. | |
| DerivativeReport | hessianTraceVariance (GaussianProcessRegression &gp, const Eigen::MatrixXd &points, const std::vector< Eigen::MatrixXd > &weights, const DerivativeOptions &options, Eigen::VectorXd &variances) |
| Posterior variance of tr(A dH) at each point for a symmetric A per point, the same estimate as hessianBilinearCovariance on the eigenvectors of A (O(rank(A)^2 d^2) joint-covariance memory). | |
| DerivativeReport | posteriorVariances (GaussianProcessRegression &gp, const Eigen::MatrixXd &points, const DerivativeOptions &options, Eigen::VectorXd &energy_variance, Eigen::MatrixXd &gradient_variance) |
| Posterior energy and gradient variance at the rows of points. | |
| void | setConditionedHessian (GaussianProcessRegression &gp, const Eigen::VectorXd &point, const Eigen::MatrixXd &hessian) |
| Record a user-supplied exact Hessian conditioned at point. | |
| void | clearConditionedHessians (GaussianProcessRegression &gp) noexcept |
| Clear all conditioned exact Hessians stored on gp. | |
| bool | findConditionedHessian (const GaussianProcessRegression &gp, const Eigen::VectorXd &point, Eigen::MatrixXd &hessian_out) |
| Look up a conditioned exact Hessian at point. | |
| DerivativeReport | conditionFixed (GaussianProcessRegression &gp, Observation &training, const Observation &added, const Eigen::MatrixXd *fixed_hessian, const HessianAction *hvp, const Eigen::MatrixXd &queries, const DerivativeOptions &options, Eigen::VectorXd &energy, Eigen::MatrixXd &gradient, Eigen::VectorXd &energy_variance, Eigen::MatrixXd &gradient_variance) |
| Condition on added and optionally record an exact Hessian or Hessian-vector-product callback at the fixed point (added.R.rows() == 1). An invalid shape, non-finite entry, or asymmetric Hessian / HVP is rejected with DerivativeStatus::InvalidArgument before mutating gp or training (no silent fallback to GP curvature). | |
| DerivativeReport | conditionFixed (GaussianProcessRegression &gp, Observation &training, const Observation &added, const Eigen::MatrixXd &queries, const DerivativeOptions &options, Eigen::VectorXd &energy, Eigen::MatrixXd &gradient, Eigen::VectorXd &energy_variance, Eigen::MatrixXd &gradient_variance) |
| Condition the fitted posterior on the rows of added at its current hyperparameters, then predict mean and variance at queries. The training factor is bordered in place when the backend allows it and refactored at the same hyperparameters otherwise; the report says which. Neither refits a hyperparameter. training is the observation set the posterior was fitted on; it is extended whenever the rows are taken, including an OutOfSupport return for the queries. | |
| DerivativeReport | conditionFixed (GaussianProcessRegression &gp, Observation &training, const Observation &added, const Eigen::MatrixXd &fixed_hessian, const Eigen::MatrixXd &queries, const DerivativeOptions &options, Eigen::VectorXd &energy, Eigen::MatrixXd &gradient, Eigen::VectorXd &energy_variance, Eigen::MatrixXd &gradient_variance) |
| Condition on added and record an exact Hessian at the fixed point. | |
| DerivativeReport | conditionFixed (GaussianProcessRegression &gp, Observation &training, const Observation &added, const HessianAction &hvp, const Eigen::MatrixXd &queries, const DerivativeOptions &options, Eigen::VectorXd &energy, Eigen::MatrixXd &gradient, Eigen::VectorXd &energy_variance, Eigen::MatrixXd &gradient_variance) |
| Condition on added and record an HVP callback at the fixed point. | |
| constexpr double | defaultVarianceStep () noexcept |
| Default finite-difference step for posterior curvature variance. | |
Variables | |
| constexpr double | kNegativeVarianceTolerance = 0x1p-26 |
| Relative tolerance under which a negative posterior variance is binary64 round-off. | |
Exact Hessian-vector-product callback at a fixed point: writes H(x) * v into hv and returns true on success.
Definition at line 201 of file PosteriorDerivatives.h.
|
strong |
Outcome of a derivative primitive. The C API maps each value to one status code; nothing here returns a NaN in place of a failure.
| Enumerator | |
|---|---|
| Ok | |
| InvalidArgument | |
| NotTrained | |
| Unsupported | The fitted mean has no analytic Hessian contraction. |
| OutOfSupport | A point's posterior energy standard deviation exceeds the caller's threshold. |
Definition at line 19 of file PosteriorDerivatives.h.
|
strong |
Unit tags carried through the primitives. They name the units the GP was trained in; no value is converted.
| Enumerator | |
|---|---|
| Native | |
| Ev | |
| Hartree | |
| KcalPerMol | |
| KjPerMol | |
Definition at line 32 of file PosteriorDerivatives.h.
|
strong |
Length unit tags carried through the derivative primitives.
| Enumerator | |
|---|---|
| Native | |
| Angstrom | |
| Bohr | |
| Nanometer | |
Definition at line 41 of file PosteriorDerivatives.h.
|
noexcept |
Clear all conditioned exact Hessians stored on gp.
Definition at line 688 of file PosteriorDerivatives.cpp.
| DerivativeReport gpr::posterior::conditionFixed | ( | GaussianProcessRegression & | gp, |
| Observation & | training, | ||
| const Observation & | added, | ||
| const Eigen::MatrixXd & | fixed_hessian, | ||
| const Eigen::MatrixXd & | queries, | ||
| const DerivativeOptions & | options, | ||
| Eigen::VectorXd & | energy, | ||
| Eigen::MatrixXd & | gradient, | ||
| Eigen::VectorXd & | energy_variance, | ||
| Eigen::MatrixXd & | gradient_variance ) |
Condition on added and record an exact Hessian at the fixed point.
Definition at line 844 of file PosteriorDerivatives.cpp.
| DerivativeReport gpr::posterior::conditionFixed | ( | GaussianProcessRegression & | gp, |
| Observation & | training, | ||
| const Observation & | added, | ||
| const Eigen::MatrixXd & | queries, | ||
| const DerivativeOptions & | options, | ||
| Eigen::VectorXd & | energy, | ||
| Eigen::MatrixXd & | gradient, | ||
| Eigen::VectorXd & | energy_variance, | ||
| Eigen::MatrixXd & | gradient_variance ) |
Condition the fitted posterior on the rows of added at its current hyperparameters, then predict mean and variance at queries. The training factor is bordered in place when the backend allows it and refactored at the same hyperparameters otherwise; the report says which. Neither refits a hyperparameter. training is the observation set the posterior was fitted on; it is extended whenever the rows are taken, including an OutOfSupport return for the queries.
Definition at line 829 of file PosteriorDerivatives.cpp.
| DerivativeReport gpr::posterior::conditionFixed | ( | GaussianProcessRegression & | gp, |
| Observation & | training, | ||
| const Observation & | added, | ||
| const Eigen::MatrixXd * | fixed_hessian, | ||
| const HessianAction * | hvp, | ||
| const Eigen::MatrixXd & | queries, | ||
| const DerivativeOptions & | options, | ||
| Eigen::VectorXd & | energy, | ||
| Eigen::MatrixXd & | gradient, | ||
| Eigen::VectorXd & | energy_variance, | ||
| Eigen::MatrixXd & | gradient_variance ) |
Condition on added and optionally record an exact Hessian or Hessian-vector-product callback at the fixed point (added.R.rows() == 1). An invalid shape, non-finite entry, or asymmetric Hessian / HVP is rejected with DerivativeStatus::InvalidArgument before mutating gp or training (no silent fallback to GP curvature).
Definition at line 700 of file PosteriorDerivatives.cpp.
| DerivativeReport gpr::posterior::conditionFixed | ( | GaussianProcessRegression & | gp, |
| Observation & | training, | ||
| const Observation & | added, | ||
| const HessianAction & | hvp, | ||
| const Eigen::MatrixXd & | queries, | ||
| const DerivativeOptions & | options, | ||
| Eigen::VectorXd & | energy, | ||
| Eigen::MatrixXd & | gradient, | ||
| Eigen::VectorXd & | energy_variance, | ||
| Eigen::MatrixXd & | gradient_variance ) |
Condition on added and record an HVP callback at the fixed point.
Definition at line 857 of file PosteriorDerivatives.cpp.
|
inlinenodiscardconstexprnoexcept |
Default finite-difference step for posterior curvature variance.
Definition at line 60 of file PosteriorDerivatives.h.
|
nodiscard |
Look up a conditioned exact Hessian at point.
Definition at line 693 of file PosteriorDerivatives.cpp.
| DerivativeReport gpr::posterior::hessianBilinearCovariance | ( | GaussianProcessRegression & | gp, |
| const Eigen::MatrixXd & | points, | ||
| const std::vector< Eigen::MatrixXd > & | left, | ||
| const std::vector< Eigen::MatrixXd > & | right, | ||
| const DerivativeOptions & | options, | ||
| std::vector< Eigen::MatrixXd > & | covariance ) |
Posterior covariance of M_ij = v_i^T H w_j at each point. left[b] holds the v_i as rows and right[b] the w_j. covariance[b] is (kl kr)^2 with entry index i * kr + j. The curvature is the central difference of the posterior gradient process along each w_j, so this is the covariance of that stencil: a probabilistic estimate with O(h^2) truncation in variance_step, not a bound. Forms the 2 kr (d + 1) joint posterior covariance block per point (O(kr^2 d^2) memory). The three Hessian uncertainty functions refuse with Unsupported, outputs untouched, when a result overflows, is NaN, or flushes a nonzero value below the normal double range (direction norms far from 1 scale it by their fourth power).
Definition at line 454 of file PosteriorDerivatives.cpp.
| DerivativeReport gpr::posterior::hessianBilinearVariances | ( | GaussianProcessRegression & | gp, |
| const Eigen::MatrixXd & | points, | ||
| const std::vector< Eigen::MatrixXd > & | directions, | ||
| const DerivativeOptions & | options, | ||
| std::vector< Eigen::VectorXd > & | variances ) |
Diagonal posterior variances of v_i^T H v_i at each point. Computes one stencil functional at a time, avoiding a k^2 covariance matrix when callers need only each mode's variance.
Definition at line 509 of file PosteriorDerivatives.cpp.
| DerivativeReport gpr::posterior::hessianTraceVariance | ( | GaussianProcessRegression & | gp, |
| const Eigen::MatrixXd & | points, | ||
| const std::vector< Eigen::MatrixXd > & | weights, | ||
| const DerivativeOptions & | options, | ||
| Eigen::VectorXd & | variances ) |
Posterior variance of tr(A dH) at each point for a symmetric A per point, the same estimate as hessianBilinearCovariance on the eigenvectors of A (O(rank(A)^2 d^2) joint-covariance memory).
Definition at line 560 of file PosteriorDerivatives.cpp.
| DerivativeReport gpr::posterior::meanHessianActions | ( | GaussianProcessRegression & | gp, |
| const Eigen::MatrixXd & | points, | ||
| const std::vector< Eigen::MatrixXd > & | directions, | ||
| const DerivativeOptions & | options, | ||
| std::vector< Eigen::MatrixXd > & | actions ) |
Posterior-mean Hessian actions. directions[b] holds k rows, each one vector at point b; actions[b] receives H(x_b) v as the same k rows.
Definition at line 418 of file PosteriorDerivatives.cpp.
| DerivativeReport gpr::posterior::meanHessians | ( | GaussianProcessRegression & | gp, |
| const Eigen::MatrixXd & | points, | ||
| const DerivativeOptions & | options, | ||
| std::vector< Eigen::MatrixXd > & | hessians, | ||
| Eigen::MatrixXd * | residuals ) |
Full posterior-mean Hessians at the rows of points, symmetrized. residuals, when given, receives one row per point: ||H t|| for the six unit generators of rigidGenerators, -1 where a generator vanishes.
Definition at line 369 of file PosteriorDerivatives.cpp.
| DerivativeReport gpr::posterior::posteriorVariances | ( | GaussianProcessRegression & | gp, |
| const Eigen::MatrixXd & | points, | ||
| const DerivativeOptions & | options, | ||
| Eigen::VectorXd & | energy_variance, | ||
| Eigen::MatrixXd & | gradient_variance ) |
Posterior energy and gradient variance at the rows of points.
Definition at line 655 of file PosteriorDerivatives.cpp.
|
nodiscard |
Unit rigid generators of 3N coordinates as columns: three translations, then rotations about the x, y and z axes through the centroid. A rotation that does not move any atom (one atom, or an axis a linear geometry lies on) is a zero column.
Definition at line 328 of file PosteriorDerivatives.cpp.
|
nodiscard |
I - Q Q^T for an orthonormal basis Q of the nonzero rigid generators.
Definition at line 364 of file PosteriorDerivatives.cpp.
|
nodiscard |
Orthogonal projector onto the physical vibrational complement of the rigid motions of positions under config.
Definition at line 349 of file PosteriorDerivatives.cpp.
|
nodiscardnoexcept |
variance when it is finite and nonnegative, zero when it is negative by at most kNegativeVarianceTolerance * prior_scale, and empty otherwise. An empty result is refused with Unsupported by every primitive: a materially negative variance is never in support and never a converged spread. A prior_scale that is not finite and positive admits no negative value.
Definition at line 317 of file PosteriorDerivatives.cpp.
| void gpr::posterior::setConditionedHessian | ( | GaussianProcessRegression & | gp, |
| const Eigen::VectorXd & | point, | ||
| const Eigen::MatrixXd & | hessian ) |
Record a user-supplied exact Hessian conditioned at point.
Definition at line 681 of file PosteriorDerivatives.cpp.
|
inlineconstexpr |
Relative tolerance under which a negative posterior variance is binary64 round-off.
A posterior variance is prior - k^T K^{-1} k. Its round-off is about eps cond(K) times the prior scale of the same functional: the background kernel's energy variance at the point for an energy, and (sum_i abs(w_i) sqrt(K_ii))^2 for a stencil functional w, the Cauchy-Schwarz bound of abs(w^T K w) over the prior marginals K_ii. sqrt(eps) admits cond(K) up to about 6.7e7. This is the only place a negative variance may become zero; see roundoffVariance.
Definition at line 75 of file PosteriorDerivatives.h.