# NAME

fill_covariance_matrix - Fills a covariance matrix for a Gaussian process

# SYNOPSIS

#include "gp/gp_gaussian_processes.h"

Example compile flags (system dependent):
-DLINUX_X86_64 -DLINUX_X86_64_OPTERON  -DGNU_COMPILER
-I/home/kobus/include
-lKJB                               -lfftw3  -lgsl -lgslcblas -ljpeg  -lSVM -lstdc++                    -lpthread -lSLATEC -lg2c    -lacml -lacml_mv -lblas -lg2c      -lncursesw

int fill_covariance_matrix
(
Matrix **cov,
const Vector_vector *indices,
const Vector_vector *indices_2,
const void *hyper_params,
int d,
int (*covariance)(Matrix **,const Vector *,const Vector *,const void *,int)
);

# DESCRIPTION

This routine creates a covariance matrix for a Gaussian process where the dimension of the indices is given by the dimension of the vectors of indices and indices_2, and the dimension of the variables is d. Then, it fills *cov with submatrices that are the result of calling the given covariance function for a pair of indices. For example, the submatrix of *cov of elements 0,1,...,d is A, where A is the matrix gotten in the call covariance(&A, indices->elements[0], indices_2->elements[0], d). Naturally, indices and indices_2 must have the same length, and all of their vectors must have equal lengths. Also, covariance must "return" a dxd matrix (there are some predefined covariance functions in the library). If the routine succeeds, cov will be a square matrix of dimension indices->elements[0]->length*d. hyper_params holds any hyper parameters that the covariance function needs. The covariance function itself should cast it to the correct type. If the matrix pointed to by cov is NULL, then a matrix of the appropriate size is created. If it exists, but is the wrong size, then it is recreated. Otherwise, the storage is recycled.

# RETURNS

If the routine fails (due to storage allocation or an error in the covariance function), then ERROR is returned with and error message being set. Otherwise NO_ERROR is returned.

# RELATED

squared_exponential_covariance_function

# DISCLAIMER

This software is not adequatedly tested. It is recomended that results are checked independantly where appropriate.

Ernesto Brau

Ernesto Brau