GPRidge v1.0.0
GPR-accelerated saddle point searches on potential energy surfaces
☾
Toggle main menu visibility
Loading...
Searching...
No Matches
PriorLogUnif.cpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
// Copyright (c) gpridge developers
3
// See LICENSE for details.
4
5
/*
6
* PriorLogUnif.cpp
7
*
8
* Created on: 10 Jul 2020
9
* Author: Maxim Masterov
10
* Company: SURFSara
11
*/
12
13
#include "
PriorLogUnif.h
"
14
15
#include <cmath>
16
17
#include "
../numerics/PortableMath.h
"
18
19
namespace
gpr
{
20
21
double
PriorLogUnif::calculateLogPrior
(
const
FieldMatrixd
&
x
)
22
{
23
double
res = 0.;
24
25
for
(Eigen::Index n = 0; n <
x
.size(); ++n) {
26
res -=
numerics::log
(*(
x
.data() + n));
27
}
28
29
return
res;
30
}
31
32
FieldMatrixd
PriorLogUnif::calculateLogPriorGradient
(
const
FieldMatrixd
&
x
)
33
{
34
FieldMatrixd
lpg;
35
36
lpg.resize(
x
.rows(),
x
.cols());
37
38
for
(Eigen::Index n = 0; n <
x
.size(); ++n) {
39
*(lpg.data() + n) = -1. / *(
x
.data() + n);
40
}
41
42
return
lpg;
43
}
44
45
}
/* namespace gpr */
x
@ x
Definition
Enums.h:28
PortableMath.h
PriorLogUnif.h
gpr::PriorLogUnif::calculateLogPrior
double calculateLogPrior(const FieldMatrixd &x) override
Definition
PriorLogUnif.cpp:21
gpr::PriorLogUnif::calculateLogPriorGradient
FieldMatrixd calculateLogPriorGradient(const FieldMatrixd &x) override
Definition
PriorLogUnif.cpp:32
gpr::numerics::log
double log(double x) noexcept
Definition
PortableMath.cpp:24
gpr
Gaussian-process regression, kernels, priors, and the searches that run on the surrogate.
Definition
Macros.h:16
gpr::FieldMatrixd
Eigen::Matrix< double, EigenDynamic, EigenDynamic, FieldMatrixStorage > FieldMatrixd
Definition
Macros.h:25
gpr
prior
PriorLogUnif.cpp
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf