https://mooseframework.inl.gov
LMC.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 #ifdef MOOSE_LIBTORCH_ENABLED
10 
11 #pragma once
12 
13 #include "CovarianceFunctionBase.h"
14 
20 {
21 public:
24 
25  void computeCovarianceMatrix(torch::Tensor & K,
26  const torch::Tensor & x,
27  const torch::Tensor & xp,
28  const bool is_self_covariance) const override;
29 
30  bool computedKdhyper(torch::Tensor & dKdhp,
31  const torch::Tensor & x,
32  const std::string & hyper_param_name,
33  unsigned int ind) const override;
34 
35 protected:
43  void computeBMatrix(torch::Tensor & Bmat, const unsigned int exp_i) const;
44 
52  void
53  computeAGradient(torch::Tensor & grad, const unsigned int exp_i, const unsigned int index) const;
54 
62  void computeLambdaGradient(torch::Tensor & grad,
63  const unsigned int exp_i,
64  const unsigned int index) const;
65 
67  const unsigned int _num_expansion_terms;
68 
69 private:
72  std::vector<const torch::Tensor *> _a_coeffs;
73  std::vector<const torch::Tensor *> _lambdas;
74 };
75 
76 #endif
bool computedKdhyper(torch::Tensor &dKdhp, const torch::Tensor &x, const std::string &hyper_param_name, unsigned int ind) const override
Redirect dK/dhp for hyperparameter "hp".
Definition: LMC.C:86
const unsigned int _num_expansion_terms
The number of expansion terms in the output ovariance matrix.
Definition: LMC.h:67
static const std::string K
Definition: NS.h:174
const InputParameters & parameters() const
LMC(const InputParameters &parameters)
Definition: LMC.C:30
Base class for covariance functions that are used in Gaussian Processes.
static InputParameters validParams()
Definition: LMC.C:18
std::vector< const torch::Tensor * > _lambdas
Definition: LMC.h:73
const std::vector< double > x
std::string grad(const std::string &var)
Definition: NS.h:92
void computeAGradient(torch::Tensor &grad, const unsigned int exp_i, const unsigned int index) const
Computes the gradient of $B$ with respect to the entries in $a_i$ in the following expression: $B = ...
Definition: LMC.C:168
void computeBMatrix(torch::Tensor &Bmat, const unsigned int exp_i) const
Computes the covariance matrix for the outputs (using the latent coefficients) We use a $B = a_i a_i...
Definition: LMC.C:160
void computeLambdaGradient(torch::Tensor &grad, const unsigned int exp_i, const unsigned int index) const
Computes the gradient of $B$ with respect to the entries in $lambda_i$ in the following expression: $...
Definition: LMC.C:183
void computeCovarianceMatrix(torch::Tensor &K, const torch::Tensor &x, const torch::Tensor &xp, const bool is_self_covariance) const override
Generates the Covariance Matrix given two sets of points in the parameter space.
Definition: LMC.C:63
std::vector< const torch::Tensor * > _a_coeffs
The vectors in the $B = a_i a_i^T + diag(lambda_i)$ expansion.
Definition: LMC.h:72
Covariance function for multi-output Gaussian Processes based on the linear model of coregionalizatio...
Definition: LMC.h:19