Loading...
Searching...
No Matches
gpr::derivatives Namespace Reference

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.

Typedef Documentation

◆ ForceFunction

using gpr::derivatives::ForceFunction = std::function<bool(const Vector&, Vector&)>

Definition at line 23 of file DerivativeProvider.h.

◆ HessianAction

using gpr::derivatives::HessianAction = std::function<bool(const Vector&, Vector&)>

Definition at line 21 of file DerivativeProvider.h.

◆ HessianPreparation

Definition at line 22 of file DerivativeProvider.h.

◆ Matrix

using gpr::derivatives::Matrix = Eigen::MatrixXd

Definition at line 20 of file DerivativeProvider.h.

◆ Vector

using gpr::derivatives::Vector = Eigen::VectorXd

Definition at line 19 of file DerivativeProvider.h.

Enumeration Type Documentation

◆ MeanDerivativeMethod

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.

◆ RadialProfile

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.

Function Documentation

◆ coordinateCharacteristicScale() [1/2]

double gpr::derivatives::coordinateCharacteristicScale ( Eigen::Index column,
const FiniteDifferenceOptions & options = {} )
inline

Characteristic coordinate length floor scale_i for column.

Exceptions
std::invalid_argumentif a configured scale is non-finite or not positive.
std::out_of_rangeif column is negative or not represented by coordinateScales.

Definition at line 287 of file DerivativeProvider.h.

288 {})
289{
290 if (column < 0) throw std::out_of_range("coordinate column is negative");
291 detail::validateStepOptions(options);
292 if (options.coordinateScales.size() == 0) return options.coordinateScale;
293 if (column >= options.coordinateScales.size())
294 throw std::out_of_range("coordinate column exceeds coordinateScales");
295 return options.coordinateScales(column);
296}

◆ coordinateCharacteristicScale() [2/2]

bool gpr::derivatives::coordinateCharacteristicScale ( Eigen::Index column,
double & result,
const FiniteDifferenceOptions & options = {},
std::string * reason = nullptr )
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.

305 {},
306 std::string* reason = nullptr) noexcept
307{
308 return detail::evaluateStep(result, reason, [&] {
309 return coordinateCharacteristicScale(column, options);
310 });
311}
double coordinateCharacteristicScale(Eigen::Index column, const FiniteDifferenceOptions &options={})
Characteristic coordinate length floor scale_i for column.

◆ finiteDifferenceCoordinateStep() [1/2]

double gpr::derivatives::finiteDifferenceCoordinateStep ( const Vector & position,
Eigen::Index column,
const FiniteDifferenceOptions & options = {} )
inline

Per-coordinate central-difference step h_i = h_0 * max(abs(x_i), scale_i).

Exceptions
std::invalid_argumentif position or an option is invalid, or if coordinateScales does not match position.
std::out_of_rangeif column does not index position.

Definition at line 320 of file DerivativeProvider.h.

322 {})
323{
324 if (options.coordinateScales.size() != 0 &&
325 options.coordinateScales.size() != position.size())
326 throw std::invalid_argument(
327 "coordinateScales must match the position dimension");
328 if (column < 0 || column >= position.size())
329 throw std::out_of_range("coordinate column exceeds position");
330 detail::validateStepOptions(options);
331 if (!position.allFinite())
332 throw std::invalid_argument("position must be finite");
333 const double scale_i = coordinateCharacteristicScale(column, options);
334 return options.relativeStep * std::max(std::abs(position(column)), scale_i);
335}

◆ finiteDifferenceCoordinateStep() [2/2]

bool gpr::derivatives::finiteDifferenceCoordinateStep ( const Vector & position,
Eigen::Index column,
double & result,
const FiniteDifferenceOptions & options = {},
std::string * reason = nullptr )
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.

344 {},
345 std::string* reason = nullptr) noexcept
346{
347 return detail::evaluateStep(result, reason, [&] {
348 return finiteDifferenceCoordinateStep(position, column, options);
349 });
350}
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).

◆ finiteDifferenceDirectionStep() [1/2]

double gpr::derivatives::finiteDifferenceDirectionStep ( const Vector & position,
const Vector & direction,
const FiniteDifferenceOptions & options = {} )
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.

Exceptions
std::invalid_argumentif position, direction, or an option is invalid, or if coordinateScales does not match position.

Definition at line 386 of file DerivativeProvider.h.

388 {})
389{
390 if (position.size() == 0)
391 throw std::invalid_argument("position must be non-empty");
392 if (direction.size() != position.size())
393 throw std::invalid_argument(
394 "direction must match the position dimension");
395 if (options.coordinateScales.size() != 0 &&
396 options.coordinateScales.size() != position.size())
397 throw std::invalid_argument(
398 "coordinateScales must match the position dimension");
399 detail::validateStepOptions(options);
400 if (!position.allFinite())
401 throw std::invalid_argument("position must be finite");
402 Vector unit;
403 double direction_norm = 0.0;
404 if (!detail::scaledDirectionUnit(direction, unit, direction_norm))
405 throw std::invalid_argument(
406 "direction must be non-zero and finite with finite norm");
407 const bool per_coordinate = options.coordinateScales.size() != 0;
408 double inverse_step_scale = 0.0;
409 for (Eigen::Index i = 0; i < position.size(); ++i) {
410 const double scale_i = per_coordinate ? options.coordinateScales(i)
411 : options.coordinateScale;
412 const double characteristic = std::max(std::abs(position(i)), scale_i);
413 inverse_step_scale =
414 std::max(inverse_step_scale, std::abs(unit(i)) / characteristic);
415 }
416 const double rounding_ratio =
417 std::cbrt(0.25 * position.stableNorm()) * std::cbrt(inverse_step_scale);
418 return options.relativeStep / inverse_step_scale *
419 std::max(1.0, rounding_ratio);
420}
Eigen::VectorXd Vector

◆ finiteDifferenceDirectionStep() [2/2]

bool gpr::derivatives::finiteDifferenceDirectionStep ( const Vector & position,
const Vector & direction,
double & result,
const FiniteDifferenceOptions & options = {},
std::string * reason = nullptr )
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.

429 {},
430 std::string* reason = nullptr) noexcept
431{
432 return detail::evaluateStep(result, reason, [&] {
433 return finiteDifferenceDirectionStep(position, direction, options);
434 });
435}
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 normali...

◆ lift()

template<typename T, typename Value>
T gpr::derivatives::lift ( const Value & value)

Definition at line 35 of file NestedAutoDiff.h.

36{
37 return Lift<T>::from(value);
38}
static T from(const Value &value)

◆ makeAnalyticDerivativeProvider()

DerivativeProvider gpr::derivatives::makeAnalyticDerivativeProvider ( HessianPreparation prepare)
inline

Adapt an analytic Hessian preparation, such as a fitted GP posterior.

Definition at line 171 of file DerivativeProvider.h.

173{
174 if (!prepare) return {};
175 auto hessian = [prepare](const Vector& position, Matrix& result) {
176 const HessianAction action = prepare(position);
177 if (!action) return false;
178 const Eigen::Index dimension = position.size();
179 result.resize(dimension, dimension);
180 for (Eigen::Index column = 0; column < dimension; ++column) {
181 Vector direction = Vector::Zero(dimension);
182 direction(column) = 1.0;
183 Vector value;
184 if (!action(direction, value) || value.size() != dimension ||
185 !value.allFinite())
186 return false;
187 result.col(column) = value;
188 }
189 return true;
190 };
191 auto hessian_vector = [prepare](const Vector& position,
192 const Vector& direction, Vector& result) {
193 const HessianAction action = prepare(position);
194 return action && action(direction, result);
195 };
196 return {std::move(hessian), std::move(hessian_vector)};
197}
Eigen::MatrixXd Matrix
std::function< bool(const Vector &, Vector &)> HessianAction

◆ makeEnzymeDerivativeProvider()

DerivativeProvider gpr::derivatives::makeEnzymeDerivativeProvider ( const ForceFunction & )
inline

Reserved source-compatible factory for the optional Enzyme bridge.

Definition at line 530 of file DerivativeProvider.h.

531{
532 return {};
533}

◆ makeFiniteDifferenceForceProvider()

DerivativeProvider gpr::derivatives::makeFiniteDifferenceForceProvider ( ForceFunction force,
FiniteDifferenceOptions options = {} )
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.

472 {})
473{
474 if (!force || !detail::validOptions(options)) return {};
475 auto hessian = [force, options](const Vector& position, Matrix& result) {
476 const Eigen::Index dimension = position.size();
477 result.resize(dimension, dimension);
478 for (Eigen::Index column = 0; column < dimension; ++column) {
479 const double step =
480 finiteDifferenceCoordinateStep(position, column, options);
481 Vector positive = position;
482 Vector negative = position;
483 positive(column) += step;
484 negative(column) -= step;
485 const double separation = positive(column) - negative(column);
486 Vector positive_force, negative_force;
487 if (!(separation > 0.0) || !std::isfinite(separation) ||
488 !detail::evaluateForce(force, positive, positive_force) ||
489 !detail::evaluateForce(force, negative, negative_force))
490 return false;
491 result.col(column) =
492 -(positive_force - negative_force) / separation;
493 }
494 return true;
495 };
496 auto hessian_vector = [force, options](const Vector& position,
497 const Vector& direction,
498 Vector& result) {
499 Vector unit;
500 double direction_norm = 0.0;
501 if (!detail::scaledDirectionUnit(direction, unit, direction_norm))
502 return false;
503 const double step =
504 finiteDifferenceDirectionStep(position, direction, options);
505 const Vector positive = position + step * unit;
506 const Vector negative = position - step * unit;
507 const double separation = (positive - negative).dot(unit);
508 Vector positive_force, negative_force;
509 if (!(separation > 0.0) || !std::isfinite(separation) ||
510 !detail::evaluateForce(force, positive, positive_force) ||
511 !detail::evaluateForce(force, negative, negative_force))
512 return false;
513 result =
514 (-(positive_force - negative_force) / separation) * direction_norm;
515 return true;
516 };
517 return {std::move(hessian), std::move(hessian_vector)};
518}

◆ nestedAtan2() [1/2]

template<typename Derivatives>
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.

51{
52 using Type = Eigen::AutoDiffScalar<Derivatives>;
53 const auto squared = x.value() * x.value() + y.value() * y.value();
54 return Type(
55 nestedAtan2(y.value(), x.value()),
56 (y.derivatives() * x.value() - x.derivatives() * y.value()) / squared);
57}
@ x
Definition Enums.h:28
@ y
Definition Enums.h:28
double nestedAtan2(double y, double x)

◆ nestedAtan2() [2/2]

double gpr::derivatives::nestedAtan2 ( double y,
double x )
inline

Definition at line 40 of file NestedAutoDiff.h.

41{
42 return std::atan2(y, x);
43}

◆ operationCounts()

OperationCounts & gpr::derivatives::operationCounts ( )
inlinenoexcept

Definition at line 33 of file CountedReal.h.

34{
35 thread_local OperationCounts counts;
36 return counts;
37}

◆ plainValue() [1/2]

double gpr::derivatives::plainValue ( const CountedReal & x)
inlinenoexcept

Definition at line 159 of file CountedReal.h.

160{
161 return x.value();
162}

◆ plainValue() [2/2]

double gpr::derivatives::plainValue ( double x)
inlinenoexcept

Definition at line 154 of file CountedReal.h.

155{
156 return x;
157}

◆ radialMeanCartesianHessianVector()

bool gpr::derivatives::radialMeanCartesianHessianVector ( const RadialMeanExpansion & expansion,
MeanDerivativeMethod method,
const Eigen::VectorXd & q,
const Eigen::MatrixXd & jacobian,
const Eigen::VectorXd & v,
Eigen::VectorXd & action )
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.

554{
555 action.resize(0);
556 if (jacobian.rows() != q.size() || jacobian.cols() != v.size())
557 return false;
558 Eigen::VectorXd descriptor;
559 if (!radialMeanHessianVector<double>(expansion, method, q, jacobian * v,
560 descriptor))
561 return false;
562 action = jacobian.transpose() * descriptor;
563 return action.allFinite();
564}
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.

◆ radialMeanGradient()

template<typename Real = double>
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.

432{
433 gradient.resize(0);
434 if (!expansion.valid() || q.size() != expansion.centers.cols())
435 return false;
436 const auto c = detail::castCentres<Real>(expansion);
437 switch (method) {
440 detail::closedGradient(method, expansion.profile, c, q, gradient);
441 break;
443 if constexpr (!detail::kDifferentiable<Real>)
444 return false;
445 else
446 detail::hyperDualGradient(expansion.profile, c, q, gradient);
447 break;
449 if constexpr (!detail::kDifferentiable<Real>) {
450 return false;
451 } else {
452 detail::RealVector<Real> unused;
453 detail::jetHessianVector(
454 expansion.profile, c, q,
455 detail::RealVector<Real>(
456 detail::RealVector<Real>::Zero(q.size())),
457 unused, &gradient);
458 }
459 break;
460 }
461 if (gradient.size() != q.size() || !detail::allFinite(gradient)) {
462 gradient.resize(0);
463 return false;
464 }
465 return true;
466}
Eigen::MatrixXd centers
n x m centre descriptors

◆ radialMeanHessian()

template<typename Real = double>
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.

516{
517 hessian.resize(0, 0);
518 if (!expansion.valid() || q.size() != expansion.centers.cols())
519 return false;
520 const auto c = detail::castCentres<Real>(expansion);
521 switch (method) {
524 detail::closedHessian(method, expansion.profile, c, q, hessian);
525 break;
527 if constexpr (!detail::kDifferentiable<Real>)
528 return false;
529 else
530 detail::hyperDualHessian(expansion.profile, c, q, hessian);
531 break;
533 if constexpr (!detail::kDifferentiable<Real>)
534 return false;
535 else
536 detail::jetHessian(expansion.profile, c, q, hessian);
537 break;
538 }
539 if (hessian.rows() != q.size() || hessian.cols() != q.size() ||
540 !detail::allFinite(hessian)) {
541 hessian.resize(0, 0);
542 return false;
543 }
544 return true;
545}

◆ radialMeanHessianVector()

template<typename Real = double>
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.

475{
476 action.resize(0);
477 if (!expansion.valid() || q.size() != expansion.centers.cols() ||
478 u.size() != q.size())
479 return false;
480 const auto c = detail::castCentres<Real>(expansion);
481 switch (method) {
484 detail::closedHessianVector(method, expansion.profile, c, q, u,
485 action);
486 break;
488 if constexpr (!detail::kDifferentiable<Real>)
489 return false;
490 else
491 detail::hyperDualHessianVector(expansion.profile, c, q, u,
492 action);
493 break;
495 if constexpr (!detail::kDifferentiable<Real>)
496 return false;
497 else
498 detail::jetHessianVector(
499 expansion.profile, c, q, u, action,
500 static_cast<detail::RealVector<Real>*>(nullptr));
501 break;
502 }
503 if (action.size() != q.size() || !detail::allFinite(action)) {
504 action.resize(0);
505 return false;
506 }
507 return true;
508}

Variable Documentation

◆ kEnzymeDerivativeProviderAvailable

bool gpr::derivatives::kEnzymeDerivativeProviderAvailable = false
inlineconstexpr

The Enzyme bridge is unavailable until its ABI is pinned.

Definition at line 527 of file DerivativeProvider.h.

◆ kEnzymeToolchainDetected

bool gpr::derivatives::kEnzymeToolchainDetected = false
inlineconstexpr

Definition at line 523 of file DerivativeProvider.h.