Loading...
Searching...
No Matches
ConstantCF.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#include "ConstantCF.h"
6
7namespace gpr {
8
10{
11 constSigma2 = 0.;
12}
13
15{
16 return 0;
17}
18
23
25 std::vector<FieldMatrixd> & /*DKff*/)
26{
27 if (x2.size() == 0) x2 = x;
28}
29
31 const Coord & /*x*/, Coord & /*x2*/, FieldMatrixIdx & /*dims*/,
32 std::vector<FieldMatrixd> & /*DKff*/)
33{
34}
35
37 const Coord & /*x*/, Coord & /*x2*/, FieldMatrixIdx & /*dims1*/,
38 FieldMatrixIdx & /*dims2*/, std::vector<FieldMatrixd> & /*DKff*/)
39{
40}
41
43 std::vector<FieldMatrixd> &DKff)
44{
45 DKff.resize(dims.size());
46 for (Eigen::Index i = 0; i < dims.size(); ++i) {
47 DKff[i].resize(x.rows(), x2.rows());
48 DKff[i].setZero();
49 }
50}
51
53 FieldMatrixIdx &dims2, std::vector<FieldMatrixd> &DKff)
54{
55 DKff.resize(dims1.size() * dims2.size());
56 for (Eigen::Index i = 0; i < (dims1.size() * dims2.size()); ++i) {
57 DKff[i].resize(x.rows(), x2.rows());
58 DKff[i].setZero();
59 }
60}
61
63 std::vector<FieldMatrixd> &DKff)
64{
65 DKff.resize(dims.size());
66 for (Eigen::Index i = 0; i < dims.size(); ++i) {
67 DKff[i].resize(x.rows(), x2.rows());
68 DKff[i].setZero();
69 }
70}
71
73 FieldMatrixd &C)
74{
75 C.resize(x.rows(), x2.rows());
76 C.setConstant(this->constSigma2);
77}
78
79} /* namespace gpr */
@ x
Definition Enums.h:28
void calculateGradOfCovMatrix(const Coord &x, Coord &x2, std::vector< FieldMatrixd > &DKff)
The function takes a matrix x of input vectors and returns DKff, the gradients of covariance matrix K...
double calculateLogPrior()
Evaluate the log prior of covariance function parameters.
FieldMatrixd calculateLogPriorGradient()
Evaluate gradient of the log prior with respect to the parameters.
void ginput2(const Coord &x, Coord &x2, FieldMatrixIdx &dims, std::vector< FieldMatrixd > &DKff)
Evaluate gradient of covariance function with respect to both input variables x and x2 (in same dimen...
void calculateGradOfCovMatrixWithDerivatives2(const Coord &x, Coord &x2, FieldMatrixIdx &dims1, FieldMatrixIdx &dims2, std::vector< FieldMatrixd > &DKff)
Evaluate gradient of covariance function, of which has been taken partial derivatives with respect to...
void calculateCovarianceMatrix(const Coord &x, Coord &x2, FieldMatrixd &C)
Evaluate covariance matrix between two input vectors.
void ginput3(const Coord &x, Coord &x2, FieldMatrixIdx &dims1, FieldMatrixIdx &dims2, std::vector< FieldMatrixd > &DKff)
Evaluate gradient of covariance function with respect to both input variables x and x2 (in different ...
void ginput4(const Coord &x, Coord &x2, FieldMatrixIdx &dims, std::vector< FieldMatrixd > &DKff)
Evaluate gradient of covariance function with respect to x. Simplified and faster version of constant...
void calculateGradOfCovMatrixWithDerivatives(const Coord &x, Coord &x2, FieldMatrixIdx &dims, std::vector< FieldMatrixd > &DKff)
Evaluate gradient of covariance function, of which has been taken partial derivative with respect to ...
Gaussian-process regression, kernels, priors, and the searches that run on the surrogate.
Definition Macros.h:16
Eigen::Matrix< Index_t, EigenDynamic, EigenDynamic, FieldMatrixStorage > FieldMatrixIdx
Definition Macros.h:29
FieldMatrixd Coord
Definition Macros.h:35
Eigen::Matrix< double, EigenDynamic, EigenDynamic, FieldMatrixStorage > FieldMatrixd
Definition Macros.h:25