GPRidge v1.0.0
GPR-accelerated saddle point searches on potential energy surfaces
☾
Toggle main menu visibility
Loading...
Searching...
No Matches
HyperparameterDomain.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
// Copyright (c) gpridge developers
3
// See LICENSE for details.
4
#pragma once
5
6
#include <Eigen/Core>
7
#include <cmath>
8
#include <limits>
9
10
#include "
../../structures/Structures.h
"
11
#include "
../numerics/PortableMath.h
"
12
13
namespace
gpr::detail {
14
15
// Packed hyperparameters are logarithms of positive kernel scales and noise.
16
// Reject a proposal before unpacking so the accepted covariance state survives
17
// an underflow, overflow, or non-finite optimizer trial.
18
inline
bool
logParametersAreRepresentable(
const
Eigen::VectorXd& theta)
19
{
20
for
(Eigen::Index j = 0; j < theta.size(); ++j) {
21
const
double
value =
numerics::exp
(theta(j));
22
if
(!(value > 0.0) || !std::isfinite(value))
return
false
;
23
}
24
return
true
;
25
}
26
27
inline
bool
rejectInvalidHyperparameters(
const
Eigen::VectorXd& theta,
28
EnergyAndGradient& result)
29
{
30
if
(logParametersAreRepresentable(theta))
return
false
;
31
result.energy = std::numeric_limits<double>::infinity();
32
result.gradient = Eigen::VectorXd::Zero(theta.size());
33
return
true
;
34
}
35
36
}
// namespace gpr::detail
PortableMath.h
Structures.h
gpr::numerics::exp
double exp(double x) noexcept
Definition
PortableMath.cpp:20
gpr
ml
HyperparameterDomain.h
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf