12 double const *s,
int n,
double l) {
13 for (
int i = 0; i < n; ++i)
14 for (
int j = 0;
j < n; ++
j) {
15 cov[i][
j] = kernel(x[i], x[
j], l, s[i] * s[
j]);
20 double const *s1,
int n1,
double const *
x2,
21 double const *s2,
int n2,
double l) {
22 for (
int i = 0; i < n1; ++i)
23 for (
int j = 0;
j < n2; ++
j) {
24 cov[i][
j] = kernel(
x1[i],
x2[
j], l, s1[i] * s2[
j]);
29 double const *s2,
int n2,
double const *arr1,
30 double const *
x1,
double const *s1,
int n1,
double len) {
31 double **cov1, **cov2;
40 int *indx =
new int[n1];
41 double *
b =
new double[n1];
42 memcpy(
b, arr1, n1 *
sizeof(
double));
46 mvdot(arr2, cov2,
b, n2, n1);
48 double d = -0.5 *
vvdot(arr1,
b, n1);
60 double const *s1,
int n1,
double len) {
66 int *indx =
new int[n1];
67 double d, *
b =
new double[n1];
68 memcpy(
b, arr1, n1 *
sizeof(
double));
73 d = -0.5 *
vvdot(arr1,
b, n1);
double gp_lnprior(KernelFunction_t kernel, double const *arr1, double const *x1, double const *s1, int n1, double len)
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)
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(* KernelFunction_t)(double, double, double, double)
void lubksb(double **a, int n, int *indx, double *b)
void mvdot(double *r, double **m, double const *v, int n1, int n2)
int ludcmp(double **a, int n, int *indx)
double vvdot(double const *a, double const *b, int n)
void NewCArray(T **&a, int n1, int n2)