Canoe
Comprehensive Atmosphere N' Ocean Engine
gaussian_process.hpp
Go to the documentation of this file.
1 #ifndef SRC_INVERSION_GAUSSIAN_PROCESS_HPP_
2 #define SRC_INVERSION_GAUSSIAN_PROCESS_HPP_
3 
4 #include <cmath>
5 
6 typedef double (*KernelFunction_t)(double, double, double, double);
7 
8 inline double SquaredExponential(double x1, double x2, double l,
9  double s1s2 = 1.) {
10  return s1s2 * exp(-(x1 - x2) * (x1 - x2) / (2. * l * l));
11 }
12 
13 inline double OrnsteinUhlenbeck(double x1, double x2, double l,
14  double s1s2 = 1.) {
15  return s1s2 * exp(-std::fabs(x1 - x2) / l);
16 }
17 
18 void gp_covariance(KernelFunction_t kernel, double **cov, double const *x,
19  double const *s, int n, double l);
20 
21 void gp_covariance2(KernelFunction_t kernel, double **cov, double const *x1,
22  double const *s1, int n1, double const *x2,
23  double const *s2, int n2, double l);
24 
25 double gp_predict(KernelFunction_t kernel, double *arr2, double const *x2,
26  double const *s2, int n2, double const *arr1,
27  double const *x1, double const *s1, int n1, double len);
28 
29 double gp_lnprior(KernelFunction_t kernel, double const *arr1, double const *x1,
30  double const *s1, int n1, double len);
31 
32 #endif // SRC_INVERSION_GAUSSIAN_PROCESS_HPP_
double gp_lnprior(KernelFunction_t kernel, double const *arr1, double const *x1, double const *s1, int n1, double len)
double SquaredExponential(double x1, double x2, double l, double s1s2=1.)
double gp_predict(KernelFunction_t kernel, double *arr2, double const *x2, double const *s2, int n2, double const *arr1, double const *x1, double const *s1, int n1, double len)
void gp_covariance(KernelFunction_t kernel, double **cov, double const *x, double const *s, int n, double l)
double(* KernelFunction_t)(double, double, double, double)
void gp_covariance2(KernelFunction_t kernel, double **cov, double const *x1, double const *s1, int n1, double const *x2, double const *s2, int n2, double l)
double OrnsteinUhlenbeck(double x1, double x2, double l, double s1s2=1.)