gpp_covariance_test

Contents:

gpp_covariance_test.hpp

Simple function call to run unit tests for covariance functions defined in gpp_covariance.cpp. This function consists of a battery of ping tests that verify the correctness of derivatives and hessians of the various covariance functions available in gpp_covariance.hpp.

namespace optimal_learning

Macro to allow restrict as a keyword for C++ compilation and CUDA/nvcc compilation. See related entry in gpp_common.hpp for more details.

gpp_covariance_test.cpp

This file contains two template classes: one supporting computing covariance and its analytic spatial derivatives, and the other for covariance and its analytic hyperparameter derivatives. Then through a matched pair of template functions, we ping the analytic derivatives using finite differences for validation. (The pinging is done through PingDerivatve() in test_utils.hpp.)

The Run.*() functions invoke the derivative ping funtions on all of the covariance functions declared in gpp_covariance.hpp.

Variables

int dim_

bool gradients_already_computed_

std::vector< double > point_

std::vector< double > point_delta_base_

std::vector< double > reference_point_

std::vector< double > grad_covariance_

CovarianceClass covariance_

int num_hyperparameters_

std::vector< double > point1_

std::vector< double > point2_

std::vector< double > grad_hyperparameter_covariance_

std::vector< double > hessian_hyperparameter_covariance_

namespace optimal_learning

Macro to allow restrict as a keyword for C++ compilation and CUDA/nvcc compilation. See related entry in gpp_common.hpp for more details.

Functions

int RunCovarianceTests()

Ping tests the covariance functions implemented in gpp_covariance.cpp Currently the only covariance option is SquareExponential.

See gpp_test_utils.hpp for further details on ping testing.

Returns:
number of test failures: 0 if all is working well.