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
18
19namespace gpr {
20
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
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
Definition Enums.h:28
double calculateLogPrior(const FieldMatrixd &x) override
FieldMatrixd calculateLogPriorGradient(const FieldMatrixd &x) override
double log(double x) noexcept
Gaussian-process regression, kernels, priors, and the searches that run on the surrogate.
Definition Macros.h:16
Eigen::Matrix< double, EigenDynamic, EigenDynamic, FieldMatrixStorage > FieldMatrixd
Definition Macros.h:25