Commit ef8bd619 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

refactored covariance function

parent 7783383e
......@@ -39,7 +39,7 @@ MainVerbose = 1
MCVerbose = 2
MLMCVerbose = 2
PDEVerbose = 1
GeneratorVerbose = 0
GeneratorVerbose = 1
GeneratorPlotting = 4
MCPlotting = 3
......@@ -51,7 +51,7 @@ sigma = 1.0
norm_p = 2
lambda1 = 0.15
lambda2 = 0.15
alpha = 1.0
smoothing = 1.0
evtol = 1e-10
# Other
......
......@@ -3,18 +3,18 @@
class CovarianceFunction {
public:
double sigma;
int norm_p;
double lambda1;
double lambda2; // Has no influence on 1D
double alpha;
double sigma = 1.0;
int norm_p = 2;
double lambda1 = 0.15;
double lambda2 = 0.15; // Has no influence on 1D
double smoothing = 1.0;
CovarianceFunction() {
ReadConfig(Settings, "sigma", sigma);
ReadConfig(Settings, "norm_p", norm_p);
ReadConfig(Settings, "lambda1", lambda1);
ReadConfig(Settings, "lambda2", lambda2);
ReadConfig(Settings, "alpha", alpha);
config.get("sigma", sigma);
config.get("norm_p", norm_p);
config.get( "lambda1", lambda1);
config.get( "lambda2", lambda2);
config.get( "smoothing", smoothing);
}
virtual double covariance_fct(double *tau) = 0;
......@@ -26,7 +26,7 @@ class CovarianceFunction1D : CovarianceFunction {
public:
double covariance_fct(double *tau) override {
tau[0] /= lambda1;
return pow(sigma, 2) * exp(-pow(norm(tau), alpha));
return pow(sigma, 2) * exp(-pow(norm(tau), smoothing));
}
double norm(const double *x) override {
......@@ -39,7 +39,7 @@ public:
double covariance_fct(double *tau) override {
tau[0] /= lambda1;
tau[1] /= lambda2;
return pow(sigma, 2) * exp(-pow(norm(tau), alpha));
return pow(sigma, 2) * exp(-pow(norm(tau), smoothing));
}
double norm(const double *x) override {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment