Namespaces | |
| namespace | generated |
Classes | |
| class | CountedReal |
| class | DerivativeProvider |
| A type-erased Hessian and Hessian-vector-product provider. More... | |
| struct | FiniteDifferenceOptions |
| struct | Lift |
| struct | Lift< Eigen::AutoDiffScalar< Derivatives > > |
| struct | OperationCounts |
| struct | RadialMeanExpansion |
Typedefs | |
| using | Vector = Eigen::VectorXd |
| using | Matrix = Eigen::MatrixXd |
| using | HessianAction = std::function<bool(const Vector&, Vector&)> |
| using | HessianPreparation = std::function<HessianAction(const Vector&)> |
| using | ForceFunction = std::function<bool(const Vector&, Vector&)> |
Enumerations | |
| enum class | RadialProfile { SquaredExponential , Matern32 , Matern52 } |
| enum class | MeanDerivativeMethod { Analytic , Generated , HyperDual , Jet } |
Functions | |
| OperationCounts & | operationCounts () noexcept |
| double | plainValue (double x) noexcept |
| double | plainValue (const CountedReal &x) noexcept |
| DerivativeProvider | makeAnalyticDerivativeProvider (HessianPreparation prepare) |
| Adapt an analytic Hessian preparation, such as a fitted GP posterior. | |
| double | coordinateCharacteristicScale (Eigen::Index column, const FiniteDifferenceOptions &options={}) |
| Characteristic coordinate length floor scale_i for column. | |
| bool | coordinateCharacteristicScale (Eigen::Index column, double &result, const FiniteDifferenceOptions &options={}, std::string *reason=nullptr) noexcept |
| Non-throwing characteristic-scale query. | |
| double | finiteDifferenceCoordinateStep (const Vector &position, Eigen::Index column, const FiniteDifferenceOptions &options={}) |
| Per-coordinate central-difference step h_i = h_0 * max(abs(x_i),
scale_i). | |
| bool | finiteDifferenceCoordinateStep (const Vector &position, Eigen::Index column, double &result, const FiniteDifferenceOptions &options={}, std::string *reason=nullptr) noexcept |
| Non-throwing per-coordinate step query. | |
| double | finiteDifferenceDirectionStep (const Vector &position, const Vector &direction, const FiniteDifferenceOptions &options={}) |
| Directional central-difference step h = (h_0 / M) max(1, cbrt(||x||_2 M / 4)), where u is the normalized direction, M = max_i(abs(u_i) / max(abs(x_i), scale_i)) and h_0 is relativeStep. | |
| bool | finiteDifferenceDirectionStep (const Vector &position, const Vector &direction, double &result, const FiniteDifferenceOptions &options={}, std::string *reason=nullptr) noexcept |
| Non-throwing directional step query. | |
| DerivativeProvider | makeFiniteDifferenceForceProvider (ForceFunction force, FiniteDifferenceOptions options={}) |
| Central differences of a physical force F=-grad(E). | |
| DerivativeProvider | makeEnzymeDerivativeProvider (const ForceFunction &) |
| Reserved source-compatible factory for the optional Enzyme bridge. | |
| template<typename T, typename Value> | |
| T | lift (const Value &value) |
| double | nestedAtan2 (double y, double x) |
| template<typename Derivatives> | |
| Eigen::AutoDiffScalar< Derivatives > | nestedAtan2 (const Eigen::AutoDiffScalar< Derivatives > &y, const Eigen::AutoDiffScalar< Derivatives > &x) |
| template<typename Real = double> | |
| bool | radialMeanGradient (const RadialMeanExpansion &expansion, MeanDerivativeMethod method, const detail::RealVector< Real > &q, detail::RealVector< Real > &gradient) |
| template<typename Real = double> | |
| bool | radialMeanHessianVector (const RadialMeanExpansion &expansion, MeanDerivativeMethod method, const detail::RealVector< Real > &q, const detail::RealVector< Real > &u, detail::RealVector< Real > &action) |
| Hessian of m at q applied to u. False as for radialMeanGradient. | |
| template<typename Real = double> | |
| bool | radialMeanHessian (const RadialMeanExpansion &expansion, MeanDerivativeMethod method, const detail::RealVector< Real > &q, detail::RealMatrix< Real > &hessian) |
| Full Hessian of m at q. False as for radialMeanGradient. | |
| bool | radialMeanCartesianHessianVector (const RadialMeanExpansion &expansion, MeanDerivativeMethod method, const Eigen::VectorXd &q, const Eigen::MatrixXd &jacobian, const Eigen::VectorXd &v, Eigen::VectorXd &action) |
Variables | |
| constexpr bool | kEnzymeToolchainDetected = false |
| constexpr bool | kEnzymeDerivativeProviderAvailable = false |
| The Enzyme bridge is unavailable until its ABI is pinned. | |
| using gpr::derivatives::ForceFunction = std::function<bool(const Vector&, Vector&)> |
Definition at line 23 of file DerivativeProvider.h.
| using gpr::derivatives::HessianAction = std::function<bool(const Vector&, Vector&)> |
Definition at line 21 of file DerivativeProvider.h.
| using gpr::derivatives::HessianPreparation = std::function<HessianAction(const Vector&)> |
Definition at line 22 of file DerivativeProvider.h.
| using gpr::derivatives::Matrix = Eigen::MatrixXd |
Definition at line 20 of file DerivativeProvider.h.
| using gpr::derivatives::Vector = Eigen::VectorXd |
Definition at line 19 of file DerivativeProvider.h.
|
strong |
Four evaluations of the same exact derivatives of a radial posterior mean.
Analytic contracts hand-written phi', phi'', phi''' through the radial Hessian identity. Generated contracts the sympy cse coefficients of generated/RadialKernelJets.h through the same identity. HyperDual evaluates only phi with three nested scalar Eigen AutoDiff levels (centre shift along g, then two coordinate directions), one pass per Hessian entry or HVP component. Jet nests a vector Eigen AutoDiff gradient over one scalar direction, so an HVP or a full Hessian is one pass.
| Enumerator | |
|---|---|
| Analytic | |
| Generated | |
| HyperDual | |
| Jet | |
Definition at line 33 of file RadialMeanDerivatives.h.
|
strong |
phi(s) of k(q, c) = sigma^2 phi(norm(q - c)^2) on scaled descriptors. SquaredExponential is exp(-s), the HS-SVD dual descriptor kernel. Matern profiles have rho = sqrt(s) and the usual sqrt(3), sqrt(5) rates.
| Enumerator | |
|---|---|
| SquaredExponential | |
| Matern32 | |
| Matern52 | |
Definition at line 22 of file RadialMeanDerivatives.h.
|
inline |
Characteristic coordinate length floor scale_i for column.
| std::invalid_argument | if a configured scale is non-finite or not positive. |
| std::out_of_range | if column is negative or not represented by coordinateScales. |
Definition at line 287 of file DerivativeProvider.h.
|
inlinenoexcept |
Non-throwing characteristic-scale query.
On failure, returns false, resets result to zero and records the validation error through reason when provided.
Definition at line 303 of file DerivativeProvider.h.
|
inline |
Per-coordinate central-difference step h_i = h_0 * max(abs(x_i), scale_i).
| std::invalid_argument | if position or an option is invalid, or if coordinateScales does not match position. |
| std::out_of_range | if column does not index position. |
Definition at line 320 of file DerivativeProvider.h.
|
inlinenoexcept |
Non-throwing per-coordinate step query.
On failure, returns false, resets result to zero and records the validation error through reason when provided.
Definition at line 342 of file DerivativeProvider.h.
|
inline |
Directional central-difference step h = (h_0 / M) max(1, cbrt(||x||_2 M / 4)), where u is the normalized direction, M = max_i(abs(u_i) / max(abs(x_i), scale_i)) and h_0 is relativeStep.
The base step h_0 / M moves the coordinate with the largest weight by h_0 max(abs(x_i), scale_i). It ignores the spacing of the floating-point numbers near x. The stencil F(x + h u) - F(x - h u) is formed from fl(x + h u) and fl(x - h u), which differ from x +- h u by at most (epsilon / 2) abs(x_i) per coordinate, so the displacement 2 h u carries an error r with ||r||_2 <= epsilon ||x||_2. Relative to ||2 h u||_2 = 2 h that is epsilon ||x||_2 / (2 h). It is a property of the whole vector, so it is bounded and continuous in u; a small component of u on a coordinate of order one does not enter it. The truncation error of the stencil is (h M)^2. Their sum E(h) = (h M)^2 + epsilon ||x||_2 / (2 h) has E'(h) = 2 h M^2 - epsilon ||x||_2 / (2 h^2), which vanishes where 4 M^2 h^3 = epsilon ||x||_2, and E''(h) = 6 M^2 > 0 there, so the minimum is h_r = cbrt(epsilon ||x||_2 / (4 M^2)). With the default h_0 = cbrt(epsilon) the base step is cbrt(epsilon) / M, and h_r / (cbrt(epsilon) / M) = cbrt(||x||_2 M / 4). The step is the base step times the larger of 1 and that ratio. At the default h_0 it equals max(cbrt(epsilon) / M, h_r). For another h_0 the whole step scales with h_0, so the steps h and 2 h of a Richardson comparison differ by exactly the factor 2 that it assumes. ||x||_2 M exceeds 4 only when the large coordinates carry little of the direction, the case in which the base step leaves the displacement of a large coordinate below the floating-point spacing and the stencil drops it.
Position, direction and options are validated once per call.
| std::invalid_argument | if position, direction, or an option is invalid, or if coordinateScales does not match position. |
Definition at line 386 of file DerivativeProvider.h.
|
inlinenoexcept |
Non-throwing directional step query.
On failure, returns false, resets result to zero and records the validation error through reason when provided.
Definition at line 427 of file DerivativeProvider.h.
| T gpr::derivatives::lift | ( | const Value & | value | ) |
Definition at line 35 of file NestedAutoDiff.h.
|
inline |
Adapt an analytic Hessian preparation, such as a fitted GP posterior.
Definition at line 171 of file DerivativeProvider.h.
|
inline |
Reserved source-compatible factory for the optional Enzyme bridge.
Definition at line 530 of file DerivativeProvider.h.
|
inline |
Central differences of a physical force F=-grad(E).
Steps are relative to each coordinate for a full Hessian and to the direction-weighted characteristic scale for an HVP. The representable displacement, rather than twice the requested step, is used as the denominator.
Definition at line 471 of file DerivativeProvider.h.
| Eigen::AutoDiffScalar< Derivatives > gpr::derivatives::nestedAtan2 | ( | const Eigen::AutoDiffScalar< Derivatives > & | y, |
| const Eigen::AutoDiffScalar< Derivatives > & | x ) |
atan2 that keeps the derivative type of its arguments; Eigen's overload returns a dynamically sized derivative that does not nest.
Definition at line 48 of file NestedAutoDiff.h.
|
inline |
Definition at line 40 of file NestedAutoDiff.h.
|
inlinenoexcept |
Definition at line 33 of file CountedReal.h.
|
inlinenoexcept |
Definition at line 159 of file CountedReal.h.
|
inlinenoexcept |
Definition at line 154 of file CountedReal.h.
|
inline |
Cartesian pullback J^T H (J v) of the descriptor Hessian. The descriptor curvature term sum_k (grad m)_k D^2 q_k is the caller's: it does not depend on the kernel derivative method.
Definition at line 550 of file RadialMeanDerivatives.h.
| bool gpr::derivatives::radialMeanGradient | ( | const RadialMeanExpansion & | expansion, |
| MeanDerivativeMethod | method, | ||
| const detail::RealVector< Real > & | q, | ||
| detail::RealVector< Real > & | gradient ) |
Gradient of m at q. False on invalid input or a non-finite result, which a Matern profile produces at an exact centre where its derivative with gradient weights is undefined. HyperDual and Jet need Real = double and return false for a counting scalar.
Definition at line 428 of file RadialMeanDerivatives.h.
| bool gpr::derivatives::radialMeanHessian | ( | const RadialMeanExpansion & | expansion, |
| MeanDerivativeMethod | method, | ||
| const detail::RealVector< Real > & | q, | ||
| detail::RealMatrix< Real > & | hessian ) |
Full Hessian of m at q. False as for radialMeanGradient.
Definition at line 512 of file RadialMeanDerivatives.h.
| bool gpr::derivatives::radialMeanHessianVector | ( | const RadialMeanExpansion & | expansion, |
| MeanDerivativeMethod | method, | ||
| const detail::RealVector< Real > & | q, | ||
| const detail::RealVector< Real > & | u, | ||
| detail::RealVector< Real > & | action ) |
Hessian of m at q applied to u. False as for radialMeanGradient.
Definition at line 470 of file RadialMeanDerivatives.h.
|
inlineconstexpr |
The Enzyme bridge is unavailable until its ABI is pinned.
Definition at line 527 of file DerivativeProvider.h.
|
inlineconstexpr |
Definition at line 523 of file DerivativeProvider.h.